Skip to content

[BUG] sidecarset打散策略有问题 #1226

@13567436138

Description

@13567436138

What happened:
sidecarset/ss-updateStrategy-scatterStrategy.yaml

kubectl apply -f ss-updateStrategy-scatterStrategy.yaml -n kruise

apiVersion: apps.kruise.io/v1alpha1
kind: SidecarSet
metadata:
  name: sidecarset
spec:
  selector:
    matchLabels:
      app: nginx
  containers:
  - name: sidecar1
    image: centos:6.7
    command: ["sleep", "999d"]
    podInjectPolicy: BeforeAppContainer
    volumeMounts:
    - name: log-volume
      mountPath: /var/log
  volumes:
  - name: log-volume
    emptyDir: {}
  updateStrategy:
    maxUnavailable: 1
    scatterStrategy:
    - key: foo
      value: bar

sidecarset/cloneset-nginx-updateStrategy.yaml

kubectl apply -f cloneset-nginx-updateStrategy.yaml -n kruise

apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 5
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
  updateStrategy:
    type: ReCreate
    maxUnavailable: 1
kubectl label pod -n kruise nginx-4znwb foo=bar
kubectl label pod -n kruise nginx-frrb9 foo=bar
kubectl label pod -n kruise nginx-m9j99 foo=bar

kubectl patch SidecarSet sidecarset --type='json'  -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"busybox:latest"}]' -n kruise

[root@node01 ~]# kubectl get pod -n kruise -w
NAME                                      READY   STATUS    RESTARTS   AGE
nfs-client-provisioner-69557bfdb8-hzplg   0/1     Unknown   0          98d
nginx-4znwb                               2/2     Running   0          78s
nginx-frrb9                               2/2     Running   0          78s
nginx-m9j99                               2/2     Running   0          78s
nginx-n8xd5                               2/2     Running   0          78s
nginx-rwtmb                               2/2     Running   0          78s
nginx-frrb9                               2/2     Running   0          93s
nginx-frrb9                               2/2     Running   1          2m3s
nginx-frrb9                               2/2     Running   1          2m4s
nginx-n8xd5                               2/2     Running   0          2m8s
nginx-n8xd5                               2/2     Running   1          2m39s
nginx-n8xd5                               2/2     Running   1          2m40s
nginx-rwtmb                               2/2     Running   0          2m44s
nginx-rwtmb                               2/2     Running   1          3m15s
nginx-rwtmb                               2/2     Running   1          3m16s
nginx-m9j99                               2/2     Running   0          3m20s
nginx-m9j99                               2/2     Running   1          3m52s
nginx-m9j99                               2/2     Running   1          3m53s
nginx-4znwb                               2/2     Running   0          3m57s
nginx-4znwb                               2/2     Running   1          4m28s
nginx-4znwb                               2/2     Running   1          4m29s


nginx-m9j99和nginx-4znwb 应该分开的

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kruise version:1.3.0
  • Kubernetes version (use kubectl version):
  • Install details (e.g. helm install args):
  • Others:

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions