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

Infrastructure Manager - implement kubeconfig secret management #10

Closed
6 tasks done
akgalwas opened this issue Sep 6, 2023 · 7 comments
Closed
6 tasks done

Infrastructure Manager - implement kubeconfig secret management #10

akgalwas opened this issue Sep 6, 2023 · 7 comments
Assignees
Labels
area/control-plane Related to all activities around Kyma Control Plane

Comments

@akgalwas
Copy link
Contributor

akgalwas commented Sep 6, 2023

Description

The Infrastructure Manager must manage dynamic kubeconfigs.

Acceptance criteria:

Reasons

In the long term the Infrastructure Manager will replace Provisioner. In the first step it will be responsible for kubeconfig management in the Kyma Control Plane.

@akgalwas akgalwas self-assigned this Sep 6, 2023
@akgalwas akgalwas changed the title Implement kubeconfig secret management Cluster Inventory - implement kubeconfig secret management Sep 6, 2023
@akgalwas
Copy link
Contributor Author

akgalwas commented Sep 6, 2023

The POC code is here: kyma-project/control-plane#3017.
What needs to be done to productise the POC:

  • Code fetching the dynamic kubeconfig from Gardener
  • Kubeconfig for shoot cluster, and control plane needs to be passed
  • Tests, and code implemented as a part of POC must be reviewed, and refined.
  • Cluster CR status needs to be set when error occurs, or the operator successfully creates/rotates secret

@akgalwas akgalwas changed the title Cluster Inventory - implement kubeconfig secret management Infrastructure Manager - implement kubeconfig secret management Sep 13, 2023
@Disper Disper self-assigned this Sep 15, 2023
@Disper Disper added the area/control-plane Related to all activities around Kyma Control Plane label Sep 15, 2023
@akgalwas
Copy link
Contributor Author

akgalwas commented Sep 15, 2023

Workplan:

@Disper Disper changed the title Infrastructure Manager - implement kubeconfig secret management [WiP] Infrastructure Manager - implement kubeconfig secret management Sep 29, 2023
@Disper Disper changed the title [WiP] Infrastructure Manager - implement kubeconfig secret management Infrastructure Manager - implement kubeconfig secret management Sep 29, 2023
@akgalwas
Copy link
Contributor Author

There is couple of things to be done as follow up:

  • Context management : we probably should pass the context from reconciliation loop everywhere
  • Getting secret : there is no need to find the secret by label, as GardenerCluster spec contains secret name

@Disper
Copy link
Member

Disper commented Nov 7, 2023

Currently, the secret is rotated both periodically and if operator.kyma-project.io/force-kubeconfig-rotation is added to the GardenCluster CR. That means that secrets

  • .data.config is regenerated
  • .metadata.annotations.operator.kyma-project.io/last-sync is updated with the time of the rotation.

@Disper
Copy link
Member

Disper commented Nov 7, 2023

As of now, if you will get the kubeconfig from that secret using e.g. k get secret kubeconfig-md-im -n kcp-system -ojsonpath={.data.config} | base64 -D > ~/kubeconfig.yaml, you will still be able to access the cluster with that kubeconfig after the secret is rotated. Regardless if the rotation happened periodically or was forced.

@ebensom could you help us understand whether this is acceptable behavior?

@ebensom
Copy link
Member

ebensom commented Nov 13, 2023

@Disper Yes AFAIK this is expected behavior, as tokens obtained via Gardener TokenRequest are OIDC tokens with exp field. When new token is requested via API, the old tokens are not invalidated, they are still valid until the expiration.

@Disper
Copy link
Member

Disper commented Nov 14, 2023

We will do a tiny refactoring in the code to reflect that we're not doing the revocation, but rotation.
But it will not affect the functionality so I'm closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/control-plane Related to all activities around Kyma Control Plane
Projects
None yet
Development

No branches or pull requests

3 participants