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["sidecar.istio.io/inject"] = "false"
//todo not sure if we need istio yet
if template.Metadata.Labels != nil {
if sidecar, ok := template.Metadata.Labels["sidecar"]; ok {
if sidecar == "sys-visualization-sidecar" {
//For workflows with accessible sidecars, we need istio
//Istio does not prevent the main container from stopping
for _, s := range template.Sidecars {
if s.TTY == true {
template.Metadata.Annotations["sidecar.istio.io/inject"] = "true"
}
//Only need one instance to require istio injection
break
}
}