-
Notifications
You must be signed in to change notification settings - Fork 474
/
sidecars.go
34 lines (30 loc) · 999 Bytes
/
sidecars.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package models
import (
"github.com/kiali/kiali/kubernetes"
)
type Sidecars []Sidecar
type Sidecar struct {
IstioBase
Spec struct {
WorkloadSelector interface{} `json:"workloadSelector"`
Ingress interface{} `json:"ingress"`
Egress interface{} `json:"egress"`
OutboundTrafficPolicy interface{} `json:"outboundTrafficPolicy"`
Localhost interface{} `json:"localhost"`
} `json:"spec"`
}
func (scs *Sidecars) Parse(sidecars []kubernetes.IstioObject) {
for _, sc := range sidecars {
sidecar := Sidecar{}
sidecar.Parse(sc)
*scs = append(*scs, sidecar)
}
}
func (sc *Sidecar) Parse(sidecar kubernetes.IstioObject) {
sc.IstioBase.Parse(sidecar)
sc.Spec.WorkloadSelector = sidecar.GetSpec()["workloadSelector"]
sc.Spec.Ingress = sidecar.GetSpec()["ingress"]
sc.Spec.Egress = sidecar.GetSpec()["egress"]
sc.Spec.OutboundTrafficPolicy = sidecar.GetSpec()["outboundTrafficPolicy"]
sc.Spec.Localhost = sidecar.GetSpec()["localhost"]
}