Checking for istio injection by checking if the sidecar has "tty"

set to true.
This commit is contained in:
Aleksandr Melnikov
2020-11-06 16:10:10 -08:00
parent 0f226eb0b7
commit d8101bff8e

View File

@@ -279,12 +279,13 @@ func (c *Client) injectAutomatedFields(namespace string, wf *wfv1.Workflow, opts
template.Metadata.Annotations = make(map[string]string) template.Metadata.Annotations = make(map[string]string)
} }
template.Metadata.Annotations["sidecar.istio.io/inject"] = "false" template.Metadata.Annotations["sidecar.istio.io/inject"] = "false"
//todo not sure if we need istio yet //For workflows with accessible sidecars, we need istio
if template.Metadata.Labels != nil { //Istio does not prevent the main container from stopping
if sidecar, ok := template.Metadata.Labels["sidecar"]; ok { for _, s := range template.Sidecars {
if sidecar == "sys-visualization-sidecar" { if s.TTY == true {
template.Metadata.Annotations["sidecar.istio.io/inject"] = "true" template.Metadata.Annotations["sidecar.istio.io/inject"] = "true"
} //Only need one instance to require istio injection
break
} }
} }