Skip to content
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: separate podlabels in controller-manager and audit deployment #3378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bobertrublik
Copy link

@bobertrublik bobertrublik commented May 9, 2024

What this PR does / why we need it:

We want to introduce new labels across our infrastructure and validate them using the K8sRequiredLabels policy. Depending on its workload each pod will receive a different workload label which is then used to enrich metrics collected from it. The Gatekeeper Helm chart doesn't allow setting separate labels for the controller manager pod and audit pod which will break our idea.

Special notes for your reviewer:

I was following the PR below to apply the changes here.

I had to remove {{- include "gatekeeper.podLabels" . | nindent 8 }} across all jobs since it's removed from the helpers.tpl file.

@bobertrublik bobertrublik requested a review from a team as a code owner May 9, 2024 13:02
@bobertrublik bobertrublik changed the title Separate podlabels in controller-manager and audit deployment feat: separate podlabels in controller-manager and audit deployment May 9, 2024
@bobertrublik bobertrublik marked this pull request as draft May 9, 2024 13:13
@bobertrublik bobertrublik marked this pull request as ready for review May 9, 2024 13:30
obj = strings.Replace(obj, " priorityClassName: system-cluster-critical", " {{- if .Values.audit.priorityClassName }}\n priorityClassName: {{ .Values.audit.priorityClassName }}\n {{- end }}", 1)
obj = strings.Replace(obj, " - emptyDir: {}", " {{- if .Values.audit.writeToRAMDisk }}\n - emptyDir:\n medium: Memory\n {{ else }}\n - emptyDir: {}\n {{- end }}", 1)
}

if kind == DeploymentKind {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @bobertrublik! We need to ensure backward compatibilities as to not break existing things users might be using and reduce developer toil. can you pls bring back all the existing podLabels and add support for new audit and controller manager podLabels?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I'm just a little unsure how to approach this. Are you saying that I should readd the .Values.podLabels field to ensure backward compatibility? Are the labels set there added to all pods and we can additionally set the .Values.controllerManager.podLabels and .Values.audit.podLabels to add specific ones?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, Pod can have many labels. Please restore the existing values.podLabels field to ensure backward compatibility. Then add the new labels.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I restored .values.podLabels and kept .Values.controllerManager.podLabels and .Values.audit.podLabels. 🙂

@bobertrublik bobertrublik force-pushed the separate-deployment-labels branch 3 times, most recently from 367d0b0 to dacf5ee Compare May 13, 2024 11:21
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.76%. Comparing base (3350319) to head (5be0b6a).
Report is 65 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3378      +/-   ##
==========================================
- Coverage   54.49%   46.76%   -7.74%     
==========================================
  Files         134      218      +84     
  Lines       12329    14784    +2455     
==========================================
+ Hits         6719     6913     +194     
- Misses       5116     7070    +1954     
- Partials      494      801     +307     
Flag Coverage Δ
unittests 46.76% <ø> (-7.74%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants