Created
February 25, 2019 18:59
-
-
Save alpeb/2ad3f5df7038eb2822a7901c18db4b34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/controller/proxy-injector/webhook.go b/controller/proxy-injector/webhook.go | |
index 66683126..85c1756b 100644 | |
--- a/controller/proxy-injector/webhook.go | |
+++ b/controller/proxy-injector/webhook.go | |
@@ -153,6 +153,10 @@ func (w *Webhook) inject(request *admissionv1beta1.AdmissionRequest) (*admission | |
patch.addInitContainer(proxyInit) | |
} | |
+ if deployment.Spec.Template.Annotations == nil { | |
+ deployment.Spec.Template.Annotations = map[string]string{} | |
+ } | |
+ | |
if w.tlsEnabled { | |
caBundle, tlsSecrets, err := w.volumesSpec(identity) | |
if err != nil { | |
@@ -166,13 +170,9 @@ func (w *Webhook) inject(request *admissionv1beta1.AdmissionRequest) (*admission | |
} | |
patch.addVolume(caBundle) | |
patch.addVolume(tlsSecrets) | |
- patch.addPodAnnotations(map[string]string{ | |
- k8sPkg.IdentityModeAnnotation: k8sPkg.IdentityModeOptional, | |
- }) | |
+ deployment.Spec.Template.Annotations[k8sPkg.IdentityModeAnnotation] = k8sPkg.IdentityModeOptional | |
} else { | |
- patch.addPodAnnotations(map[string]string{ | |
- k8sPkg.IdentityModeAnnotation: k8sPkg.IdentityModeDisabled, | |
- }) | |
+ deployment.Spec.Template.Annotations[k8sPkg.IdentityModeAnnotation] = k8sPkg.IdentityModeDisabled | |
} | |
if deployment.Spec.Template.Labels == nil { | |
@@ -200,9 +200,6 @@ func (w *Webhook) inject(request *admissionv1beta1.AdmissionRequest) (*admission | |
imageTag = image[1] | |
} | |
- if deployment.Spec.Template.Annotations == nil { | |
- deployment.Spec.Template.Annotations = map[string]string{} | |
- } | |
deployment.Spec.Template.Annotations[k8sPkg.CreatedByAnnotation] = fmt.Sprintf("linkerd/proxy-injector %s", imageTag) | |
deployment.Spec.Template.Annotations[k8sPkg.ProxyVersionAnnotation] = imageTag | |
patch.addPodAnnotations(deployment.Spec.Template.Annotations) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment