将发布策略从 batch 切换到canary 报错
542928492 opened this issue · 1 comments
542928492 commented
kruise-rollout(V0.5.0) : v1beta1
我预期从发布策略从 batch 切换到canary 。执行apply报错
这个是batch策略的yaml配置
`[root@k8s 240119]# kubectl get rollouts.rollouts.kruise.io hello0119canary -o yaml
- kubectl get rollouts.rollouts.kruise.io hello0119canary -o yaml
apiVersion: rollouts.kruise.io/v1beta1
kind: Rollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"rollouts.kruise.io/v1beta1","kind":"Rollout","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"hello0119canary"},"name":"hello0119canary","namespace":"default"},"spec":{"strategy":{"canary":{"enableExtraWorkloadForCanary":false,"steps":[{"replicas":1},{"replicas":2},{"replicas":3},{"replicas":"100%"}]}},"workloadRef":{"apiVersion":"apps/v1","kind":"Deployment","name":"hello0119canary"}}}
rollouts.kruise.io/hash: vc568d4c778wv979v78dwwd4cc4fdx49d9xdv47v22b5x562f962b2wf4ww58f42
creationTimestamp: "2024-01-19T06:43:06Z"
finalizers:- rollouts.kruise.io/rollout
generation: 2
labels:
app.kubernetes.io/instance: hello0119canary
name: hello0119canary
namespace: default
resourceVersion: "8187529"
uid: 50361e13-0c82-4a0c-acd8-2bcfbde9b60f
spec:
disabled: false
strategy:
canary:
steps:- pause: {}
replicas: 1 - pause: {}
replicas: 2 - pause: {}
replicas: 3 - pause: {}
replicas: 100%
workloadRef:
apiVersion: apps/v1
kind: Deployment
name: hello0119canary
status:
canaryStatus:
canaryReadyReplicas: 1
canaryReplicas: 1
canaryRevision: 5b4496b8bb
currentStepIndex: 1
currentStepState: StepPaused
lastUpdateTime: "2024-01-19T06:44:39Z"
message: BatchRelease is at state Ready, rollout-id , step 1
observedWorkloadGeneration: 7
podTemplateHash: 5b4496b8bb
rolloutHash: vc568d4c778wv979v78dwwd4cc4fdx49d9xdv47v22b5x562f962b2wf4ww58f42
stableRevision: 5c6b56494b
conditions:
- pause: {}
- lastTransitionTime: "2024-01-19T06:44:27Z"
lastUpdateTime: "2024-01-19T06:44:27Z"
message: Rollout is in Progressing
reason: InRolling
status: "True"
type: Progressing
message: Rollout is in step(1/4), and you need manually confirm to enter the next
step
observedGeneration: 2
phase: Progressing
下面是预期切换的 canary策略yaml。 执行命令为 kubectl apply -f
[root@k8s 240119]# cat hello0119canary-rollout.yaml
apiVersion: rollouts.kruise.io/v1beta1
kind: Rollout
metadata:
labels:
app.kubernetes.io/instance: hello0119canary
name: hello0119canary
namespace: default
spec:
workloadRef:
apiVersion: apps/v1
kind: Deployment
name: hello0119canary
strategy:
canary:
enableExtraWorkloadForCanary: true
steps:- traffic: 20%
replicas: 20%
trafficRoutings: - service: hello0119canary
ingress:
classType: nginx
name: hello0119canary
`
- traffic: 20%
- rollouts.kruise.io/rollout
下面是报错信息:
[root@k8s 240119]# kubectl apply -f hello0119canary-rollout.yaml
- kubectl apply -f hello0119canary-rollout.yaml
Error from server: error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{"apiVersion":"rollouts.kruise.io/v1beta1","kind":"Rollout","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"hello0119canary"},"name":"hello0119canary","namespace":"default"},"spec":{"strategy":{"canary":{"enableExtraWorkloadForCanary":true,"steps":[{"replicas":"20%","traffic":"20%"}],"trafficRoutings":[{"ingress":{"classType":"nginx","name":"hello0119canary"},"service":"hello0119canary"}]}},"workloadRef":{"apiVersion":"apps/v1","kind":"Deployment","name":"hello0119canary"}}}\n"}},"spec":{"strategy":{"canary":{"enableExtraWorkloadForCanary":true,"steps":[{"replicas":"20%","traffic":"20%"}],"trafficRoutings":[{"ingress":{"classType":"nginx","name":"hello0119canary"},"service":"hello0119canary"}]}}}}
to:
Resource: "rollouts.kruise.io/v1beta1, Resource=rollouts", GroupVersionKind: "rollouts.kruise.io/v1beta1, Kind=Rollout"
Name: "hello0119canary", Namespace: "default"
for: "hello0119canary-rollout.yaml": error when patching "hello0119canary-rollout.yaml": admission webhook "vrollout.kb.io" denied the request: Spec.Strategy.Canary.TrafficRoutings: Forbidden: Rollout 'Strategy.Canary.TrafficRoutings' field is immutable
542928492 commented
我貌似只能删除重建?!
kubectl delete rollouts.rollouts.kruise.io hello0119canary
- kubectl delete rollouts.rollouts.kruise.io hello0119canary
rollout.rollouts.kruise.io "hello0119canary" deleted
[root@k8s 240119]# kubectl apply -f hello0119canary-rollout.yaml
- kubectl apply -f hello0119canary-rollout.yaml
rollout.rollouts.kruise.io/hello0119canary created