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

Ignore resources from apply if it already exists #936

Closed
emmetog opened this issue Aug 3, 2023 · 1 comment · Fixed by #943
Closed

Ignore resources from apply if it already exists #936

emmetog opened this issue Aug 3, 2023 · 1 comment · Fixed by #943
Assignees
Labels
enhancement New feature or request

Comments

@emmetog
Copy link

emmetog commented Aug 3, 2023

There's an interesting situation in GKE when setting up cert manager to secure Ingress resources (same thing also happens for the alternative Gateway approach). It's a chicken and egg situation, GKE can only create the routes to allow the HTTP challenge to go ahead in the first place if there is already a "dummy" tls cert provisioned on the cluster. The need for this is explained here (an official tutorial from cert-manager explaining how to do it with Ingress) and here (similar community tutorial but with Gateway instead of Ingress).

This is arguably something that should be fixed by GKE so that the Ingress/Gateway can go ahead even with no placeholder secret created, but as it is it unfortunately means that provisioning cert-manager on GKE cannot be handled fully by flux, as even if flux initially created the dummy secret it would overwrite the real cert with the dummy again on every reconciliation. The cert must be initially created manually (outside of flux).

One idea that would solve this chicken and egg issue could be a "ignore this resource if it already exists, but create it as defined if not" kind of annotation, or even something more flexible to allow specifying individual fields in the resource to ignore when reconciling. Then we could use this to tell flux to create the dummy secret if it's not there already, but if cert-manager has updated it then flux would not overwrite it again.

Is there another solution (other than manually creating the initial tls secrets) which might get me closer to my aim of getting this situation fully managed by flux?

@stefanprodan
Copy link
Member

You can do this via Git, after the initial sync, set the kustomize.toolkit.fluxcd.io/reconcile: disabled annotation on the secret.

Another way would be to use a Job that runs kubectl annotate, Flux will sync the Secret and Job, then it will ignore the secret.

@stefanprodan stefanprodan changed the title Cert-manager on GKE - chicken and egg with initial TLS certs Ignore resources from apply if it already exists Aug 8, 2023
@stefanprodan stefanprodan added the enhancement New feature or request label Aug 8, 2023
@stefanprodan stefanprodan self-assigned this Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants