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

Use env expansion to provide namespace in container args #5951

Merged
merged 3 commits into from
Jul 29, 2020
Merged

Use env expansion to provide namespace in container args #5951

merged 3 commits into from
Jul 29, 2020

Conversation

pst
Copy link
Contributor

@pst pst commented Jul 29, 2020

What this PR does / why we need it:

Users using the provided static manifests have to change the namespace in various places when they want to deploy to a custom namespace.

This PR uses the namespace name from the DownwardAPI for the Deployment and Job container args that need the namesapce name.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Which issue/s this PR fixes

How Has This Been Tested?

Automated tests

  • make test [passing]
  • make lua-test [passing]
  • make kind-e2e-test [passing]
    • first run use-proxy-protocol test failed
    • rerunning with FOCUS="use-proxy-protocol" passed this test as well

Manual test

I used the generated cloud/deploy.yaml included in this PR and Kustomize to customise the metadata.namespace attribute with a different namespace name: ingress-nginx-test.

kustomize.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: ingress-nginx-test

resources:
- deploy.yaml

patches:
- path: patch-namespace.yaml
  target:
    kind: Namespace
    name: ingress-nginx
    version: v1

patch-namespace.yaml

- op: replace
  path: /metadata/name
  value: ingress-nginx-test

kubectl get pod

$ kubectl get pod --all-namespaces
NAMESPACE            NAME                                                       READY   STATUS      RESTARTS   AGE
ingress-nginx-test   ingress-nginx-admission-create-jtsj8                       0/1     Completed   0          34s
ingress-nginx-test   ingress-nginx-admission-patch-whrb2                        0/1     Completed   2          37s
ingress-nginx-test   ingress-nginx-controller-77f5884bdd-nmz8x                  1/1     Running     0          38s

Checklist:

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

pst added 2 commits July 29, 2020 11:44
When deploying the controller to a custom namespace, users have to
overwrite the namespace attribute as well as the hardcoded namespace
values in a number of args for the Deployment and the admission
controller Jobs.

Instead, this commit, uses the namespace name from the DownwardAPI,
and allows users to simply change the namespace attribute without
having to worry about the container args.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 29, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @pst!

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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 29, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @pst. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 29, 2020
@pst
Copy link
Contributor Author

pst commented Jul 29, 2020

/assign @aledbf

@pst pst changed the title Use env expansion to provide namespace names in container args Use env expansion to provide namespace in container args Jul 29, 2020
@aledbf
Copy link
Member

aledbf commented Jul 29, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 29, 2020
@aledbf
Copy link
Member

aledbf commented Jul 29, 2020

@pst please increase the version https://github.com/kubernetes/ingress-nginx/blob/master/charts/ingress-nginx/Chart.yaml#L3

@pst
Copy link
Contributor Author

pst commented Jul 29, 2020

@aledbf I bumped the patch, since it was only a small change in the Chart itself and did not affect the Nginx version. Let me know if you'd rather have me bump the minor version.

@aledbf
Copy link
Member

aledbf commented Jul 29, 2020

@aledbf I bumped the patch, since it was only a small change in the Chart itself and did not affect the Nginx version. Let me know if you'd rather have me bump the minor version.

No need

@aledbf
Copy link
Member

aledbf commented Jul 29, 2020

/lgtm
/approve

@aledbf
Copy link
Member

aledbf commented Jul 29, 2020

@pst thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 29, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, pst

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

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2020
@k8s-ci-robot k8s-ci-robot merged commit a4f7006 into kubernetes:master Jul 29, 2020
@pst pst deleted the usenamespaceenvexpansion branch July 30, 2020 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants