Skip to content

Admission webhooks vol add #13127

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

Closed

Conversation

arjunbnair97
Copy link

What this PR does / why we need it:

This change helps add extraVolumes and extraVolumeMounts for the AdmissionsWebhooks Job-Patch createSecret and patchwebhook Jobs. Currently if automountServiceAccountToken is set to false in both the jobs, the jobs will fail. That was our initial issue. By merging the current PR, it provides an approach to manually add extraVolumes and extraVolumeMounts so that the jobs run smoothly.

This PR helps resolve Issue: #13031.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

How Has This Been Tested?

We had tested this in our local and dev Kubernetes clusters. We manually downloaded the latest HELM charts and applied these changes and tested.

We had tested this in our local and dev K8s cluster environments.

Currently if automountServiceAccountToken is set to false in both the jobs, the jobs will fail. That was our initial issue. By merging the current PR, it provides an approach to manually add extraVolumes and extraVolumeMounts so that the jobs run smoothly.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • [ ] All new and existing tests passed.

Copy link

linux-foundation-easycla bot commented Mar 30, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 30, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: arjunbnair97
Once this PR has been reviewed and has the lgtm label, please assign strongjz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. area/helm Issues or PRs related to helm charts labels Mar 30, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @arjunbnair97!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 30, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @arjunbnair97. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 30, 2025
Copy link

netlify bot commented Mar 30, 2025

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit 573e885
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/67ebd3e4f9c50f000835a080

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 30, 2025
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

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

/triage accepted
/kind feature
/priority backlog
/hold

Please see my comments, re-generate the README.md by running helm-docs and implement unit tests in the tests/ directory. Also please make yourself familiar with how to setup volumes and volume mounts in Kubernetes first.

Thank you!

@@ -65,6 +65,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.createSecretJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.createSecretJob.extraVolumeMounts }}
extraVolumeMount: {{- toYaml .Values.controller.admissionWebhooks.createSecretJob.extraVolumeMounts | nindent 12 }}
Copy link
Member

Choose a reason for hiding this comment

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

There's no such thing as extraVolumeMount in Pods.

@@ -77,4 +80,8 @@ spec:
{{- if .Values.controller.admissionWebhooks.patch.securityContext }}
securityContext: {{ toYaml .Values.controller.admissionWebhooks.patch.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.createSecretJob.extraVolumes }}
extraVolumes: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.extraVolumes | nindent 8 }}
Copy link
Member

Choose a reason for hiding this comment

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

And neither is extraVolumes.

{{- if .Values.controller.admissionWebhooks.createSecretJob.extraVolumes }}
extraVolumes: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.extraVolumes | nindent 8 }}
{{- end }}

Copy link
Member

Choose a reason for hiding this comment

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

Please remove this newline.

@@ -67,6 +67,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.extraVolumeMounts }}
extraVolumeMount: {{- toYaml .Values.controller.admissionWebhooks.patchWebhookJob.extraVolumeMounts | nindent 12 }}
Copy link
Member

Choose a reason for hiding this comment

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

Same here as above.

@@ -79,4 +82,7 @@ spec:
{{- if .Values.controller.admissionWebhooks.patch.securityContext }}
securityContext: {{ toYaml .Values.controller.admissionWebhooks.patch.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.extraVolumes }}
extraVolumes: {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.extraVolumes | nindent 8 }}
Copy link
Member

Choose a reason for hiding this comment

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

Same here as above.

Comment on lines 796 to 804
extraVolumeMounts: []
## Additional volumeMounts to the AdmissionsWebhook createSecretJob.
# - name: kube-api-access
# mountPath: /var/run/secrets/kubernetes.io/serviceaccount
# readOnly: true
extraVolumes: []
## Additional volume to the AdmissionsWebhook createSecretJob.
# - name: kube-api-access
# emptyDir: {}
Copy link
Member

Choose a reason for hiding this comment

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

Please put the comment before the actual property and use # -- notation for documentation.

Comment on lines 820 to 828
extraVolumeMounts: []
## Additional volumeMounts to the AdmissionsWebhook patchWebhookJob.
# - name: kube-api-access
# mountPath: /var/run/secrets/kubernetes.io/serviceaccount
# readOnly: true
extraVolumes: []
## Additional volume to the AdmissionsWebhook patchWebhookJob.
# - name: kube-api-access
# emptyDir: {}
Copy link
Member

Choose a reason for hiding this comment

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

Please put the comment before the actual property and use # -- notation for documentation.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Mar 31, 2025
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority labels Mar 31, 2025
@@ -65,6 +65,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.createSecretJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.createSecretJob.volumeMounts }}
Copy link
Member

Choose a reason for hiding this comment

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

Please keep using extraVolumeMounts here.

@@ -65,6 +65,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.createSecretJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.createSecretJob.volumeMounts }}
volumeMount: {{- toYaml .Values.controller.admissionWebhooks.createSecretJob.volumeMounts | nindent 12 }}
Copy link
Member

Choose a reason for hiding this comment

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

The property is called volumeMounts. Please read the following documentation for reference: https://kubernetes.io/docs/concepts/storage/volumes

@@ -67,6 +67,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.volumeMounts }}
Copy link
Member

Choose a reason for hiding this comment

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

Please keep using extraVolumeMounts here.

@@ -67,6 +67,9 @@ spec:
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.volumeMounts }}
volumeMount: {{- toYaml .Values.controller.admissionWebhooks.patchWebhookJob.volumeMounts | nindent 12 }}
Copy link
Member

Choose a reason for hiding this comment

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

The property is called volumeMounts. Please read the following documentation for reference: https://kubernetes.io/docs/concepts/storage/volumes

@@ -77,4 +80,7 @@ spec:
{{- if .Values.controller.admissionWebhooks.patch.securityContext }}
securityContext: {{ toYaml .Values.controller.admissionWebhooks.patch.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.createSecretJob.volumes }}
Copy link
Member

Choose a reason for hiding this comment

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

Please keep using extraVolumes here.

# mountPath: /var/run/secrets/kubernetes.io/serviceaccount
# readOnly: true
volumeMounts: []
# -- volume to the AdmissionsWebhook createSecretJob.
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
# -- volume to the AdmissionsWebhook createSecretJob.
# -- Extra volumes for secret creation pods

Comment on lines 821 to 830
# -- volumeMounts to the AdmissionsWebhook patchWebhookJob.
# Example:
# - name: kube-api-access
# mountPath: /var/run/secrets/kubernetes.io/serviceaccount
# readOnly: true
volumeMounts: []
# -- volume to the AdmissionsWebhook patchWebhookJob.
# - name: kube-api-access
# emptyDir: {}
volumes: []
Copy link
Member

Choose a reason for hiding this comment

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

Adapt from above suggestions.

@arjunbnair97 arjunbnair97 requested a review from Gacko April 1, 2025 11:10
@arjunbnair97
Copy link
Author

@Gacko Could you please review?

@Gacko
Copy link
Member

Gacko commented Apr 2, 2025

Your changes are currently breaking tests. Please see the details of the failed checks for why.

@Gacko Gacko closed this Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm Issues or PRs related to helm charts cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants