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

Backport of [NET-9500] Cleanup orphaned inline-certs and acl role/policy into release/1.3.x #4121

Conversation

hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #4067 to be assessed for backporting due to the inclusion of the label backport/1.3.x.

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@jm96441n
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: unable to process merge commit: "743d568ebdf89d94c06ea007499a2db55d04caea", automatic backport requires rebase workflow

The below text is copied from the body of the original PR.


Changes proposed in this PR

  • Add a goroutine on start up that loops and tries to clean up inline certs that are no longer referenced by any gateway and the original shared acl role/policy that is now specific to each gateway. Once all those are cleaned up the goroutine will exit and stop polling

How I've tested this PR

Run/Write tests

Manual Testing:

  1. clone the following gist: https://gist.github.com/jm96441n/b92a80c2251c7a54d1feada320c5eac6
  2. run the start.sh script in the gist (this will install consul 1.18-ent so ensure you have an ent license setup)
  3. port forward port 8501 to the consul server instance
  4. once the cluster is up run the following in another terminal:
export CONSUL_HTTP_ADDR="127.0.0.1:8501"
export CONSUL_HTTP_TOKEN=$(kubectl get --namespace consul secrets/consul-consul-bootstrap-acl-token --template={{.data.token}} | base64 -d)
export CONSUL_HTTP_SSL=true
export CONSUL_HTTP_SSL_VERIFY=false
  1. run consul acl role list and you will see the shared "managed-gateway-acl-role"
  2. run consul acl policy list and you will see the shared "api-gateway-token-policy"
  3. run consul acl binding-rule list and you will see the shared binding-rules referencing both managed-gateway-acl-role
  4. run consul config list -kind inline-certificate and you will see an inline certificate listed
  5. in the consul_values.yaml uncomment lines 3 and 4 and comment lines 4 and 5 (also make sure you build consul-k8s from this branch and have an up to date build of main of consul)
  6. in the same terminal run export CONSUL_K8S_CHARTS_LOCATION="$HOME/hashi/consul-k8s/charts/consul" and replace the value being set with the location of the helm charts in your local copy of consul-k8s
  7. run the following helm upgrade --install consul $CONSUL_K8S_CHARTS_LOCATION -f ./consul_values.yaml -n consul --create-namespace --wait to install the new version of consul-k8s that you built
  8. force a re-reconciliation of your gateways (this should happen by default due to the change in dataplane version, if it does not you can delete and recreate the gateways)
  9. run consul acl role list and you will not see the shared "managed-gateway-acl-role"
  10. run consul acl policy list and you will not see the shared "api-gateway-token-policy"
  11. . run consul acl binding-rule list and you will not see the shared binding-rules referencing managed-gateway-acl-role
  12. run consul config list -kind inline-certificate and you will see no inline certificates listed

How I expect reviewers to test this PR

read the code
run the tests
do the above steps

Checklist


Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/NET-9500-cleanup-existing-inline-certs-and-old-acl-policy/sadly-adequate-mole branch from a6b79d4 to 1606edb Compare June 12, 2024 22:47
@jm96441n
Copy link
Member

closing, already backported via #4132

@jm96441n jm96441n closed this Jun 20, 2024
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

2 participants