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

Allow API Gateway controller to update k8s Deployments + Services #1014

Merged
merged 3 commits into from
Feb 2, 2022

Conversation

nathancoleman
Copy link
Member

@nathancoleman nathancoleman commented Feb 2, 2022

The k8s client abstraction in consul-api-gateway expects to be able to create or update k8s Deployments and Services; however, the ClusterRole as defined today does not allow for updates to these resources. This prevents the Consul API Gateway controller from successfully installing a new gateway to the cluster.

Changes proposed in this PR:

  • Modify ClusterRole to allow controller to update k8s Deployment
  • Modify ClusterRole to allow controller to update k8s Service

How I've tested this PR:
Applied changes to deployment on GKE

How I expect reviewers to test this PR:
Follow the Learn tutorial for Consul API Gateway; however, the Consul Helm chart install needs to use the branch in this PR.

I believe the easiest way to do that is to check this branch out locally and $ helm install ... from there (replacing $ helm install --values consul/config.yaml consul hashicorp/consul --version "0.40.0" with the following):

# git checkout the branch from this PR locally
...
$ helm install --values consul/config.yaml consul <path/to>/consul-k8s/charts/consul

Checklist:

  • Tests added
  • CHANGELOG entry added

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

@nathancoleman nathancoleman marked this pull request as ready for review February 2, 2022 21:31
Copy link
Contributor

@andrewstucki andrewstucki left a comment

Choose a reason for hiding this comment

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

Clarification that this does allow for new gateways to be deployed, but subsequent modifications to the gateway that affect the deployment/service configurations such as an annotation change on the gateway or listener port changes while the gateway has an associated service deployment should fail without these permission updates.

Aside from me commenting on the scope of this, LGTM. Also linking in the related PR for the source of the generated RBAC policy: hashicorp/consul-api-gateway#86

Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

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

LGTM. Would you mind also updating the Changelog?

Copy link
Member

@nickethier nickethier 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 catching this!

@nathancoleman nathancoleman merged commit e0db0c1 into main Feb 2, 2022
@nathancoleman nathancoleman deleted the nc-apigw-allow-updates branch February 2, 2022 22:56
geobeau pushed a commit to geobeau/consul-k8s that referenced this pull request May 20, 2022
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.

4 participants