Feat: rollout support statefulsets (#5202)

* rollout support workload

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

* modify the error output

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>
This commit is contained in:
suwliang3
2022-12-19 12:08:42 +08:00
committed by GitHub
parent dcb5378ff9
commit e6fe7eb7d3
2 changed files with 4 additions and 0 deletions

View File

@@ -114,6 +114,7 @@ func HandleReplicas(ctx context.Context, rolloutComp string, c client.Client) as
klog.InfoS("assemble force set workload replicas to 0", "Kind", u.GetKind(), "name", u.GetName())
return nil
}
klog.Errorf("fail to get workload %s: %v", u.GetName(), err)
return err
}
// the workload already exist, we cannot reset the replicas with manifest
@@ -122,6 +123,7 @@ func HandleReplicas(ctx context.Context, rolloutComp string, c client.Client) as
wlpv := fieldpath.Pave(workload.UnstructuredContent())
replicas, err := wlpv.GetInteger(replicasFieldPath)
if err != nil {
klog.Errorf("fail to get `spec.replicas` field from workload %s: %v", u.GetName(), err)
return err
}
if err = pv.SetNumber(replicasFieldPath, float64(replicas)); err != nil {

View File

@@ -49,6 +49,8 @@ rules:
- apiGroups:
- "apps"
resources:
- statefulsets
- statefulsets/status
- deployments
- deployments/status
- controllerrevisions