-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add pod annotations specific for openshift environment #2116
feat: Add pod annotations specific for openshift environment #2116
Conversation
Signed-off-by: Erez Tamam <erezo9@gmail.com>
@@ -25,7 +25,11 @@ spec: | |||
template: | |||
metadata: | |||
annotations: | |||
{{- toYaml .Values.podAnnotations | trim | nindent 8 }} | |||
{{- if .Values.openshift.enabled }} | |||
{{- toYaml .Values.openshift.podAnnotations | trim | nindent 8 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use spaces instead of tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chewong ill change the replacments and run make again to see the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chewong done and pushed
Signed-off-by: Erez Tamam <erezo9@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will hand it off it @sozercan for a final review.
Codecov Report
@@ Coverage Diff @@
## master #2116 +/- ##
==========================================
- Coverage 54.38% 54.31% -0.08%
==========================================
Files 111 111
Lines 9478 9478
==========================================
- Hits 5155 5148 -7
- Misses 3933 3938 +5
- Partials 390 392 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/hold I tried to reproduce #2102 but could not. |
how did you try to reproduce? and my values are:
and this is the annotations that I got on the controller manager deployment
|
PTAL: #2102 (comment) |
I was able to repro it. I suspected that helm was trying to merge the pod annotations from the default values.yaml with the custom values.yaml you provided. To fix that, we need to set the default value of our pod annotations to be diff --git a/cmd/build/helmify/replacements.go b/cmd/build/helmify/replacements.go
index 4610edab..f44ac272 100644
--- a/cmd/build/helmify/replacements.go
+++ b/cmd/build/helmify/replacements.go
@@ -49,7 +49,11 @@ var replacements = map[string]string{
"HELMSUBST_DEPLOYMENT_REPLICAS": `{{ .Values.replicas }}`,
- `HELMSUBST_ANNOTATIONS: ""`: `{{- toYaml .Values.podAnnotations | trim | nindent 8 }}`,
+ `HELMSUBST_ANNOTATIONS: ""`: `{{- if .Values.podAnnotations }}
+ {{- toYaml .Values.podAnnotations | trim | nindent 8 }}
+ {{- else }}
+ container.seccomp.security.alpha.kubernetes.io/manager: runtime/default
+ {{- end }}`,
"HELMSUBST_SECRET_ANNOTATIONS": `{{- toYaml .Values.secretAnnotations | trim | nindent 4 }}`,
diff --git a/cmd/build/helmify/static/values.yaml b/cmd/build/helmify/static/values.yaml
index 9f0eca2c..ee7514c0 100644
--- a/cmd/build/helmify/static/values.yaml
+++ b/cmd/build/helmify/static/values.yaml
@@ -80,8 +80,7 @@ image:
release: v3.9.0-beta.2
pullPolicy: IfNotPresent
pullSecrets: []
-podAnnotations:
- {container.seccomp.security.alpha.kubernetes.io/manager: runtime/default}
+podAnnotations: {}
podLabels: {}
podCountLimit: 100
secretAnnotations: {}
diff --git a/manifest_staging/charts/gatekeeper/templates/gatekeeper-audit-deployment.yaml b/manifest_staging/charts/gatekeeper/templates/gatekeeper-audit-deployment
.yaml
index 06f82ba2..2bbe5ffb 100644
--- a/manifest_staging/charts/gatekeeper/templates/gatekeeper-audit-deployment.yaml
+++ b/manifest_staging/charts/gatekeeper/templates/gatekeeper-audit-deployment.yaml
@@ -25,7 +25,11 @@ spec:
template:
metadata:
annotations:
+ {{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | trim | nindent 8 }}
+ {{- else }}
+ container.seccomp.security.alpha.kubernetes.io/manager: runtime/default
+ {{- end }}
labels:
{{- include "gatekeeper.podLabels" . }}
app: '{{ template "gatekeeper.name" . }}'
diff --git a/manifest_staging/charts/gatekeeper/templates/gatekeeper-controller-manager-deployment.yaml b/manifest_staging/charts/gatekeeper/templates/gatekeeper-controller-manager-deployment.yaml
index e1a47339..1b94c448 100644
--- a/manifest_staging/charts/gatekeeper/templates/gatekeeper-controller-manager-deployment.yaml
+++ b/manifest_staging/charts/gatekeeper/templates/gatekeeper-controller-manager-deployment.yaml
@@ -25,7 +25,11 @@ spec:
template:
metadata:
annotations:
+ {{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | trim | nindent 8 }}
+ {{- else }}
+ container.seccomp.security.alpha.kubernetes.io/manager: runtime/default
+ {{- end }}
labels:
{{- include "gatekeeper.podLabels" . }}
app: '{{ template "gatekeeper.name" . }}'
diff --git a/manifest_staging/charts/gatekeeper/values.yaml b/manifest_staging/charts/gatekeeper/values.yaml
index 9f0eca2c..ee7514c0 100644
--- a/manifest_staging/charts/gatekeeper/values.yaml
+++ b/manifest_staging/charts/gatekeeper/values.yaml
@@ -80,8 +80,7 @@ image:
release: v3.9.0-beta.2
pullPolicy: IfNotPresent
pullSecrets: []
-podAnnotations:
- {container.seccomp.security.alpha.kubernetes.io/manager: runtime/default}
+podAnnotations: {}
podLabels: {}
podCountLimit: 100
secretAnnotations: {} I have tested the changes above and it worked. Feel free to do more testing and update the PR. |
@chewong
In this PR im trying to keep the k8s annotation which is a must, and the openshift annotations that are not needed Also, lets say i have an annotation i want to add, just prometheus.io/scrape: true |
@erezo9 does the If so, we can add |
Well if you are removing the annotation, shouldn’t you be also removing the security context? |
Signed-off-by: Erez Tamam <erezo9@gmail.com>
@chewong @sozercan |
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
We are planning to remove this deprecated annotation anyway in favor of the new |
Ill check tommorow, but I think the isOpenshift flag will be relavent for that as well and for other things possible in the future |
Signed-off-by: Erez Tamam <erezo9@gmail.com>
@chewong |
That works. I think we can omit the openshift-specific template that we currently have and use a new value |
that could work, so ill change the code and add to this change? |
Sounds good. |
can you send me a message on slack? |
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
Signed-off-by: Erez Tamam <erezo9@gmail.com>
…ekeeper into openshift-annotations
Signed-off-by: Erez Tamam <erezo9@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold cancel
Looks much better!
Thanks for the PR @erezo9!
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: Christoph Fraundorfer <christoph.fraundorfer@allianzdirect.de>
…licy-agent#2116) Signed-off-by: davis-haba <davishaba@google.com>
Signed-off-by: Erez Tamam erezo9@gmail.com
What this PR does / why we need it:
Because openshift environment does not need scc, i have mad a key created for openshift (might be usefull for other things in the future) that will allow pod annotations for that vendor
@sozercan as we talked in the weekly
Fixes #1329