Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将发布策略从 batch 切换到canary 报错 #201

Open
542928492 opened this issue Jan 19, 2024 · 1 comment
Open

将发布策略从 batch 切换到canary 报错 #201

542928492 opened this issue Jan 19, 2024 · 1 comment

Comments

@542928492
Copy link

542928492 commented Jan 19, 2024

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:
    • 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
        `

下面是报错信息:
[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
Copy link
Author

我貌似只能删除重建?!
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant