Support annotations in environment specs (#733)

* Added annotations to runtime and builder environment specs
* Use crd annotations for env pod
This commit is contained in:
Erwin van Eyk
2018-06-30 05:38:22 +08:00
committed by Ta-Ching Chen
parent 65fd1d9fbb
commit 032d1a8b9a
4 changed files with 159 additions and 10 deletions
+6 -3
View File
@@ -498,9 +498,12 @@ func (envw *environmentWatcher) createBuilderDeployment(env *crd.Environment, ns
sel := envw.getLabels(env.Metadata.Name, ns, env.Metadata.ResourceVersion)
var replicas int32 = 1
podAnnotation := make(map[string]string)
podAnnotations := env.Metadata.Annotations
if podAnnotations == nil {
podAnnotations = make(map[string]string)
}
if envw.useIstio && env.Spec.AllowAccessToExternalNetwork {
podAnnotation["sidecar.istio.io/inject"] = "false"
podAnnotations["sidecar.istio.io/inject"] = "false"
}
deployment := &v1beta1.Deployment{
@@ -517,7 +520,7 @@ func (envw *environmentWatcher) createBuilderDeployment(env *crd.Environment, ns
Template: apiv1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: sel,
Annotations: podAnnotation,
Annotations: podAnnotations,
},
Spec: apiv1.PodSpec{
Volumes: []apiv1.Volume{