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

Make cilium install idempotent #206

Closed
wants to merge 1 commit into from

Conversation

lfundaro
Copy link

@lfundaro lfundaro commented May 2, 2021

[No tests yet, waiting for discussion with Authors]

This PR makes the command cilium install idempotent.
It checks the error returned from the API and continues
in case the resource has been created already.

Fixes: #205

Signed-off-by: Lorenzo Fundaró lorenzofundaro@gmail.com

This PR makes the command cilium install idempotent.
It checks the error returned from the API and continues
in case the resource has been created already.

Fixes: cilium#205

Signed-off-by: Lorenzo Fundaró <lorenzofundaro@gmail.com>
@lfundaro lfundaro temporarily deployed to ci May 2, 2021 20:28 Inactive
@lfundaro
Copy link
Author

lfundaro commented May 2, 2021

No tests yet, since there remains the question whether cilium install should be idempotent.

@pchaigno pchaigno marked this pull request as draft May 27, 2021 10:15
@pchaigno
Copy link
Member

From the issue reactions, it looks like it would be appreciated :-)

Could you update the PR with tests? I switched to draft mode in the meantime.

@lfundaro
Copy link
Author

From the issue reactions, it looks like it would be appreciated :-)

Could you update the PR with tests? I switched to draft mode in the meantime.

sure 👍 . I'll ping you back when I have something to review. Cheers.

@lfundaro
Copy link
Author

@pchaigno, one question, in this PR we are skipping the installation of certificates if we see there is a resource already there. Is this the behavior that we want ? I'm thinking some edge cases:

  1. As an operator, if I want to update all cilium certificates I could just issue cilium install and expect that all certificates would be refreshed. In this case, instead of skipping like in this block we would upsert the certificate, i.e.: if the k8s secret already exits, we just refresh data with a new cert, otherwise we create a new k8s secret.
  2. From a security perspective, we may want cilium-cli to be authoritative on the installation process as a whole, i.e.: we guarantee that installed certificates come exclusively from the cli instead from unknown sources.

wdyt ?

I'm leaning towards upsert but I'm open to discuss.

@pchaigno
Copy link
Member

AFAIU, option 1 also means the command won't actually be idempotent. Probably worth asking the wider community for opinions on #development (although note many folks are currently OOO with the long weekend).

@lfundaro
Copy link
Author

AFAIU, option 1 also means the command won't actually be idempotent. Probably worth asking the wider community for opinions on #development (although note many folks are currently OOO with the long weekend).

yes, we would lose idempotency, but if option 2 is more important then we may as well forget about that property. I will ask on a wider forum. Cheers !

@ti-mo
Copy link
Contributor

ti-mo commented Jun 1, 2021

As an operator, if I want to update all cilium certificates I could just issue cilium install and expect that all certificates would be refreshed. In this case, instead of skipping like in this block we would upsert the certificate, i.e.: if the k8s secret already exits, we just refresh data with a new cert, otherwise we create a new k8s secret.

Making cilium install perform cert upserts would be surprising to me as an operator. This probably belongs in cilium upgrade (following Helm behaviour) or might even warrant a new cilium rotate or cilium encryption rotate command (for clustermesh/wg/ipsec).

As discussed on Slack, introducing skips does not add idempotency. It will cause headaches when we make this install routine create more resources and a user runs cilium install instead of cilium upgrade. Either we merge cilium upgrade into cilium install and make the whole lot fully idempotent (including diffs and dry-run), or we simply point the user to cilium upgrade when one of the resources created in cilium install already exists, with a graceful exit code.

@lfundaro
Copy link
Author

lfundaro commented Jun 1, 2021

or we simply point the user to cilium upgrade when one of the resources created in cilium install already exists, with a graceful exit code.

I would lean towards this approach. In practical terms, it yields the same value as merging upgrade into install and is waaaay much simpler. 😄 👍

I'll ping you both when I have a commit.

Cheers !

@lfundaro
Copy link
Author

lfundaro commented Jun 3, 2021

closing this PR and opening #282 since this is no longer about making install idempotent. cc @ti-mo @pchaigno

@lfundaro lfundaro closed this Jun 3, 2021
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.

Idempotent Cilium Install ?
3 participants