From e30937550e6bf981bea11e0d67ff76014c2523b2 Mon Sep 17 00:00:00 2001 From: lou Date: Wed, 1 Nov 2023 21:53:30 +0800 Subject: [PATCH] update after review Signed-off-by: lou --- internal/resourcemodifiers/resource_modifiers.go | 2 +- site/content/docs/main/restore-resource-modifiers.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/resourcemodifiers/resource_modifiers.go b/internal/resourcemodifiers/resource_modifiers.go index 46f4aa859..d4ae93e71 100644 --- a/internal/resourcemodifiers/resource_modifiers.go +++ b/internal/resourcemodifiers/resource_modifiers.go @@ -105,7 +105,7 @@ func (r *ResourceModifierRule) apply(obj *unstructured.Unstructured, groupResour } } - g, err := glob.Compile(r.Conditions.GroupResource) + g, err := glob.Compile(r.Conditions.GroupResource, '.') if err != nil { log.Errorf("Bad glob pattern of groupResource in condition, groupResource: %s, err: %s", r.Conditions.GroupResource, err) return err diff --git a/site/content/docs/main/restore-resource-modifiers.md b/site/content/docs/main/restore-resource-modifiers.md index 241d6bc99..0c1f2f217 100644 --- a/site/content/docs/main/restore-resource-modifiers.md +++ b/site/content/docs/main/restore-resource-modifiers.md @@ -183,4 +183,5 @@ resourceModifierRules: - You can specify multiple rules in the `matches` list. The patch will be applied only if all the matches are satisfied. ### Wildcard Support for GroupResource -The user can specify a wildcard for groupResource in the conditions' struct. This will allow the user to apply the patches for all the resources of a particular group or all resources in all groups. For example, `*.apps` will apply to all the resources in the `apps` group, `*` will apply to all the resources in all groups. +The user can specify a wildcard for groupResource in the conditions' struct. This will allow the user to apply the patches for all the resources of a particular group or all resources in all groups. For example, `*.apps` will apply to all the resources in the `apps` group, `*` will apply to all the resources in core group, `*.*` will apply to all the resources in all groups. +- If both `*.groupName` and `namespaces` are specified, the patches will be applied to all the namespaced resources in this group in the specified namespaces and all the cluster resources in this group. \ No newline at end of file