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: helm chart podLabels #1126

Merged
merged 3 commits into from
Feb 12, 2021
Merged

feat: helm chart podLabels #1126

merged 3 commits into from
Feb 12, 2021

Conversation

jdolce
Copy link
Contributor

@jdolce jdolce commented Feb 10, 2021

What this PR does / why we need it:
Allow Helm chart users to add additional labels to pods. This is important for us so that specific labels are added to the Prometheus metrics, which allows us to see what environment alerts are coming from.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #

Special notes for your reviewer:
Put this together quickly as an alternative to #1125, which modifies the generated files.

I followed the same pattern as the podAnnotations, and deleted the gatekeeper.labels template as it was not being used. The alternative to this is that we remove the commonLabels from the kustomize patches and add the labels to each object either with a template or directly. Not using the commonLabels seems like it might be harder to maintain going forward. I am not a super big fan of string replacement in the main.go for all Deployments, but seems like the easiest to maintain.

@codecov-io
Copy link

Codecov Report

Merging #1126 (437b467) into master (db5a580) will increase coverage by 0.74%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1126      +/-   ##
==========================================
+ Coverage   47.84%   48.58%   +0.74%     
==========================================
  Files          62       63       +1     
  Lines        4264     4339      +75     
==========================================
+ Hits         2040     2108      +68     
- Misses       1966     1975       +9     
+ Partials      258      256       -2     
Flag Coverage Δ
unittests 48.58% <ø> (+0.74%) ⬆️

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

Impacted Files Coverage Δ
pkg/mutation/path/tester/tester.go 67.56% <0.00%> (ø)
pkg/mutation/assignmeta_mutator.go 46.66% <0.00%> (+0.95%) ⬆️
...onstrainttemplate/constrainttemplate_controller.go 56.63% <0.00%> (+3.88%) ⬆️
pkg/mutation/mutation_function.go 70.76% <0.00%> (+5.32%) ⬆️
pkg/mutation/assign_mutator.go 37.25% <0.00%> (+9.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db5a580...437b467. Read the comment docs.

Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This LGTM, @sozercan LGTY?

Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

LGTM, small nit on the description

looks like DCO and CLA needs to be signed

@@ -28,6 +28,7 @@
| audit.hostNetwork | Enables audit to be deployed on hostNetwork | `false` |
| replicas | The number of Gatekeeper replicas to deploy for the webhook | `1` |
| podAnnotations | The annotations to add to the Gatekeeper pods | `container.seccomp.security.alpha.kubernetes.io/manager: runtime/default` |
| podLabels | The pods to add to the Gatekeeper pods | `{}` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| podLabels | The pods to add to the Gatekeeper pods | `{}` |
| podLabels | The labels to add to the Gatekeeper pods | `{}` |

@@ -28,6 +28,7 @@
| audit.hostNetwork | Enables audit to be deployed on hostNetwork | `false` |
| replicas | The number of Gatekeeper replicas to deploy for the webhook | `1` |
| podAnnotations | The annotations to add to the Gatekeeper pods | `container.seccomp.security.alpha.kubernetes.io/manager: runtime/default` |
| podLabels | The pods to add to the Gatekeeper pods | `{}` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| podLabels | The pods to add to the Gatekeeper pods | `{}` |
| podLabels | The labels to add to the Gatekeeper pods | `{}` |

Signed-off-by: Julian Dolce <jdolce@qnx.com>
Signed-off-by: Julian Dolce <jdolce@qnx.com>
@jdolce
Copy link
Contributor Author

jdolce commented Feb 12, 2021

I signed it

@jdolce
Copy link
Contributor Author

jdolce commented Feb 12, 2021

@sozercan @maxsmythe Pulled in the latest changes and updated the documentation, but having issues with upgrade / [Helm] Upgrade test (2.17.0) (pull_request) This is failing while running the e2e tests after installing the 3.1.1 base image, so this isn't even hitting my code. This is also failing in another PR of mine.

Any insight into what is going on here? I have ran the test locally against a different cluster and it passed. I couldn't spot anything in the logs that might be the cause.

@sozercan sozercan merged commit 4270b0b into open-policy-agent:master Feb 12, 2021
@ritazh ritazh added this to the v3.3.1 milestone Mar 16, 2021
@ritazh ritazh modified the milestones: v3.3.1, v3.4.0 Mar 23, 2021
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

5 participants