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

Improve Templates deletion validation #355

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

eromanova
Copy link
Member

@eromanova eromanova commented Sep 19, 2024

The following template deletion rules are validated:

  1. ClusterTemplate or ServiceTemplate can't be removed if it is in use by ManagedCluster or owned by TemplateChain
  2. ProviderTemplate can't be removed if it's a core provider or enabled in Management spec.providers

Closes #329

@eromanova eromanova self-assigned this Sep 19, 2024
@eromanova eromanova force-pushed the template-validation branch 2 times, most recently from 176cb64 to f27b9ce Compare September 23, 2024 10:31
@eromanova eromanova marked this pull request as ready for review September 23, 2024 10:32
@eromanova eromanova requested a review from Kshatrix September 23, 2024 11:44
@eromanova eromanova force-pushed the template-validation branch 4 times, most recently from 8fa5584 to 5d46cee Compare September 26, 2024 13:45
@eromanova eromanova requested a review from zerospiel September 26, 2024 13:52
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
@eromanova eromanova force-pushed the template-validation branch from 5d46cee to f01b819 Compare October 16, 2024 16:35
@eromanova eromanova marked this pull request as draft October 16, 2024 16:42
@eromanova eromanova force-pushed the template-validation branch from f01b819 to fb3d9e0 Compare October 18, 2024 12:10
@eromanova eromanova marked this pull request as ready for review October 18, 2024 12:11
@eromanova eromanova changed the title Allow Templates deletion by the controller only Improve Templates deletion validation Oct 18, 2024
@eromanova eromanova force-pushed the template-validation branch from fb3d9e0 to 7dbda57 Compare October 21, 2024 09:34
api/v1alpha1/common.go Outdated Show resolved Hide resolved
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
internal/webhook/userinfo.go Outdated Show resolved Hide resolved
@eromanova eromanova marked this pull request as draft October 21, 2024 13:07
@eromanova eromanova force-pushed the template-validation branch from 7dbda57 to 03becc2 Compare October 21, 2024 18:54
@eromanova eromanova marked this pull request as ready for review October 21, 2024 18:55
@eromanova eromanova force-pushed the template-validation branch from 03becc2 to 83d4900 Compare October 22, 2024 12:27
@eromanova eromanova requested a review from Kshatrix October 22, 2024 12:30
@eromanova eromanova marked this pull request as draft October 24, 2024 09:21
@eromanova eromanova force-pushed the template-validation branch 2 times, most recently from ee7c734 to 995c17f Compare October 25, 2024 11:16
@eromanova eromanova marked this pull request as ready for review October 25, 2024 12:15
@eromanova eromanova force-pushed the template-validation branch from 995c17f to d24f391 Compare October 28, 2024 09:26
@eromanova eromanova force-pushed the template-validation branch 2 times, most recently from aa3e359 to 5c08a8c Compare November 11, 2024 09:42
@eromanova
Copy link
Member Author

eromanova commented Nov 12, 2024

@Kshatrix Could you please retake a look when you have time? Tests are failing in the CI env due to #624 but succeeded when run locally. Thanks

@eromanova eromanova marked this pull request as draft November 21, 2024 11:43
@eromanova eromanova marked this pull request as ready for review November 21, 2024 12:26
@eromanova eromanova requested review from Kshatrix and removed request for squizzi and Kshatrix November 25, 2024 11:03
@eromanova eromanova force-pushed the template-validation branch 3 times, most recently from d967b7d to d2c3317 Compare December 3, 2024 11:09
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
@eromanova eromanova marked this pull request as draft December 3, 2024 14:16
@eromanova eromanova force-pushed the template-validation branch from d2c3317 to de21f26 Compare December 3, 2024 17:05
@eromanova eromanova marked this pull request as ready for review December 3, 2024 17:07
@eromanova eromanova force-pushed the template-validation branch from de21f26 to ea50696 Compare December 4, 2024 08:35
@eromanova eromanova requested a review from Kshatrix December 4, 2024 09:50
@eromanova eromanova force-pushed the template-validation branch from ea50696 to 74cc3ef Compare December 4, 2024 12:49
zerospiel
zerospiel previously approved these changes Dec 4, 2024
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
internal/webhook/template_webhook.go Outdated Show resolved Hide resolved
The following rules are validated:
1. ClusterTemplate or ServiceTemplate can't be removed if it is in use by
   ManagedCluster or owned by TemplateChain
2. ProviderTemplate can't be removed if it's a core provider or enabled in
   Management spec.providers
@eromanova eromanova force-pushed the template-validation branch from abf3e0c to 5bc172d Compare December 6, 2024 10:37
@Kshatrix Kshatrix merged commit c08df7b into Mirantis:main Dec 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[admission] Restrict manual removal of Templates managed by HMC
3 participants