From c0804550dfb13583df00e2b2e195aaca1ba52a1b Mon Sep 17 00:00:00 2001 From: grzegorz-ciezkowski Date: Thu, 9 Jan 2025 10:10:39 +0100 Subject: [PATCH] feat(pluginpresets) Documentation and log update --- docs/user-guides/plugin/plugin-management.md | 3 +-- pkg/admission/pluginpreset_webhook.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/user-guides/plugin/plugin-management.md b/docs/user-guides/plugin/plugin-management.md index 30ac4cd48..523ff73d2 100644 --- a/docs/user-guides/plugin/plugin-management.md +++ b/docs/user-guides/plugin/plugin-management.md @@ -21,8 +21,7 @@ In case the _PluginPreset_ is updated all of the Plugin instances that are manag Changes that are done directly on a _Plugin_ which was created from a _PluginPreset_ will be overwritten immediately by the _PluginPreset_ Controller. All changes must be performed on the _PluginPreset_ itself. If a _Plugin_ already existed with the same name as the _PluginPreset_ would create, this _Plugin_ will be ignored in following reconciliations. -To prevent accidental deletion of the _Plugin_, the _PluginPreset_ has the annotation `greenhouse.sap/prevent-deletion`. To delete the pluginPreset along with the plugins, you must first remove the annotation. - +A __PluginPreset__ with the annotation `greenhouse.sap/prevent-deletion` may not be deleted. This is to prevent the accidental deletion of a __PluginPreset__ including the managed __Plugins__ and their deployed Helm releases. Only after removing the annotation it is possible to delete a __PluginPreset__. ## Example _PluginPreset_ ```yaml diff --git a/pkg/admission/pluginpreset_webhook.go b/pkg/admission/pluginpreset_webhook.go index 52a9ef514..c24b31603 100644 --- a/pkg/admission/pluginpreset_webhook.go +++ b/pkg/admission/pluginpreset_webhook.go @@ -133,7 +133,7 @@ func ValidateDeletePluginPreset(_ context.Context, _ client.Client, obj runtime. var allErrs field.ErrorList if _, ok := pluginPreset.Annotations[preventDeletionAnnotation]; ok { allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("annotation").Child(preventDeletionAnnotation), - pluginPreset.Annotations, "Plugin preset has prevent deletion annotation")) + pluginPreset.Annotations, fmt.Sprintf("PluginPreset with annotation '%s' set may not be deleted.", preventDeletionAnnotation))) } if len(allErrs) > 0 {