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

Validate available upgrades for managed clusters #391

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eromanova
Copy link
Member

@eromanova eromanova commented Sep 25, 2024

Admission webhook will validate the ManagedCluster's spec.template update and in case the ManagedCluster is not in dry run mode and the ClusterTemplate is managed by HMC it will verify if the new ClusterTemplate is in the list of available upgrades in the ClusterTemplateChain.

Closes #372
Closes #244

@eromanova eromanova self-assigned this Sep 25, 2024
api/v1alpha1/templates_common.go Outdated Show resolved Hide resolved
internal/templateutil/interface.go Show resolved Hide resolved
internal/templateutil/interface.go Outdated Show resolved Hide resolved
internal/templateutil/state.go Outdated Show resolved Hide resolved
internal/templateutil/state.go Outdated Show resolved Hide resolved
internal/webhook/managedcluster_webhook.go Outdated Show resolved Hide resolved
internal/templateutil/state.go Show resolved Hide resolved
internal/webhook/managedcluster_webhook.go Outdated Show resolved Hide resolved
internal/webhook/managedcluster_webhook.go Outdated Show resolved Hide resolved
internal/webhook/managedcluster_webhook_test.go Outdated Show resolved Hide resolved
@eromanova eromanova force-pushed the clusters-upgrade-validation branch 4 times, most recently from 1fcaa14 to d5d6aeb Compare September 26, 2024 08:32
@eromanova eromanova marked this pull request as draft September 26, 2024 09:35
@eromanova eromanova marked this pull request as ready for review September 26, 2024 11:34
Copy link
Member

@zerospiel zerospiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -84,6 +97,15 @@ func (v *ManagedClusterValidator) ValidateUpdate(ctx context.Context, _ runtime.
if err != nil {
return nil, fmt.Errorf("%s: %v", errInvalidManagedCluster, err)
}
if !newManagedCluster.Spec.DryRun && templateutil.IsManagedByHMC(template) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted to have a list of available upgrades in the managedcluster status and only check that the requested template is in the list in admission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Allow ManagedCluster's upgrade to supported templates only [Admission] Improve Deployment validation
3 participants