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

Authorization token for ignition server does not refresh #169

Closed
raz-bn opened this issue Aug 1, 2022 · 7 comments · Fixed by #211
Closed

Authorization token for ignition server does not refresh #169

raz-bn opened this issue Aug 1, 2022 · 7 comments · Fixed by #211
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@raz-bn
Copy link

raz-bn commented Aug 1, 2022

When a new VM is provisioned, it pulls its authorization token from the user-data-{NAMESPACE}-{HASH}-userdata
secret. The creation of this secret is happening in the kubevirtmachine controller , the source of the data contained in the secret comes from the user-data-{NAMESPACE}-{HASH} secret, which is created by the nodepool controller in HyperShift, the secret is referenced in the Machine object under the field spec.bootstrap.dataSecretName.
The nodepool controller rotates the authorization token every 24H (inside the user-data-{NAMESPACE}-{HASH} secret), but there is no mechanized for rotating the user-data-{NAMESPACE}-{HASH}-userdata which means new VMs can not pull their ignition file. The only way to workaround it is to delete the user-data-{NAMESPACE}-{HASH}-userdatasecret.

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 1, 2022
@raz-bn
Copy link
Author

raz-bn commented Aug 3, 2022

I wonder if there is any reason for creating the user-data-{NAMESPACE}-{HASH}-userdata secret since it is basically identical to the user-data-{NAMESPACE}-{HASH} secret. why not just mounting the existing secret to VMs?

@nirarg
Copy link
Contributor

nirarg commented Aug 11, 2022

The secret is duplicated because when new KubevirtMachine is created it look for userdata data key inside this secret, while the original secret is created with the data key: value

Its look like the solution should be not skipping the secret creation code if the duplication secret is already exists, but need to update the secret if the secret data was changed since the last time.
here is the location for the suggested change:

bootstrapDataSecret := &corev1.Secret{}

@davidvossel davidvossel self-assigned this Aug 11, 2022
@davidvossel
Copy link
Contributor

Its look like the solution should be not skipping the secret creation code if the duplication secret is already exists, but need to update the secret if the secret data was changed since the last time.

I think that's the simplest solution for now.

Long term i want us to get out of the business of creating that separate secret for the VM/VMIs entirely. That requires deprecating the ssh and capk user support for the cloud-config types though.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 9, 2022
@nirarg
Copy link
Contributor

nirarg commented Nov 13, 2022

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 13, 2022
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Nov 28, 2022
After 24 hours the userdata secret for a VM contains an outdated value.

In order not to return a stale copy of a VM secret refetch it and store.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Nov 28, 2022
After 24 hours the userdata secret for a VM contains an outdated value.

In order not to return a stale copy of a VM secret refetch it and store.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Nov 28, 2022
After 24 hours the userdata secret for a VM contains an outdated value.

In order not to return a stale copy of a VM secret refetch it and store.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Dec 20, 2022
After 24 hours the userdata secret for a VM contains an outdated value.

We must refetch and update the cloud init secret with the latest data,
otherwise a node will fail the ignition stage.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 11, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 13, 2023
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Mar 26, 2023
After 24 hours the userdata secret for a VM contains an outdated value.

We must refetch and update the cloud init secret with the latest data,
otherwise a node will fail the ignition stage.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
rgolangh added a commit to rgolangh/cluster-api-provider-kubevirt-1 that referenced this issue Mar 26, 2023
After 24 hours the userdata secret for a VM contains an outdated value.

We must refetch and update the cloud init secret with the latest data,
otherwise a node will fail the ignition stage.

Fixes: kubernetes-sigs#169

Signed-off-by: Roy Golan <rgolan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants