From 8380d7fd140235b8cbb2af14f98364facdd9d8d2 Mon Sep 17 00:00:00 2001 From: brucejunlli Date: Thu, 18 Jan 2024 11:01:39 +0800 Subject: [PATCH] change update workload to update workload status --- deploy/craned/rbac.yaml | 11 ++++++++++- pkg/controller/recommendation/updater.go | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/deploy/craned/rbac.yaml b/deploy/craned/rbac.yaml index 16ec973aa..275648654 100644 --- a/deploy/craned/rbac.yaml +++ b/deploy/craned/rbac.yaml @@ -72,7 +72,16 @@ rules: - get - list - watch - - update +- apiGroups: + - apps + resources: + - daemonsets/status + - deployments/status + - deployments/scale + - statefulsets/status + - statefulsets/scale + verbs: + - update - apiGroups: - autoscaling resources: diff --git a/pkg/controller/recommendation/updater.go b/pkg/controller/recommendation/updater.go index ecf940a0d..37b0ff08e 100644 --- a/pkg/controller/recommendation/updater.go +++ b/pkg/controller/recommendation/updater.go @@ -99,7 +99,8 @@ func (c *RecommendationController) UpdateRecommendation(ctx context.Context, rec if needUpdate { unstructed.SetAnnotations(annotation) - err = c.Client.Update(ctx, unstructed) + //Convergence craned permissions + err = c.Client.Status().Update(ctx, unstructed) if err != nil { return false, fmt.Errorf("update target annotation failed: %v. ", err) }