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

blade kill k8s pod with multi labels not work #770

Closed
Allen-yan opened this issue Aug 10, 2022 · 1 comment · Fixed by chaosblade-io/chaosblade-operator#174
Closed

blade kill k8s pod with multi labels not work #770

Allen-yan opened this issue Aug 10, 2022 · 1 comment · Fixed by chaosblade-io/chaosblade-operator#174
Assignees

Comments

@Allen-yan
Copy link

Issue Description

Type: bug report

Describe what happened (or what feature you want)

I want to delete pod with multi labels
but it always math the last label "app=b", and kill the pod with label "app=b"

Describe what you expected to happen

I want it to kill (app=a OR app=b) pods

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

`apiVersion: chaosblade.io/v1alpha1
kind: ChaosBlade
metadata:
name: pod-delete-by-labels
spec:
experiments:

  • scope: pod
    target: pod
    action: delete
    desc: "delete pod by labels"
    matchers:
    • name: labels
      value:
      • "app=a"
      • "app=b"
      • name: namespace
        value:
      • "backend"
    • name: percent
      value:
      • "5"`

Tell us your environment

k8s: v1.20.15
chaosblade-operator: 1.6.0/1.6.1

Anything else we need to know?

@heroesm
Copy link

heroesm commented Jan 24, 2025

chaosblade-io/chaosblade-operator#174

这个修改,只是把多个相同 key 的标签改成了 IN 匹配,如果使用的是多个不同 key 的标签,还是按照 AND 关系进行匹配的吧

    - name: labels
      value:
      - app.kubernetes.io/name=a                                                                                                                                                              
      - app=b

像上面这样写实际上只能匹配到同时有这两个标签的 pod

和文档描述里的 Pod 资源标签,多个标签之间是或的关系 不一致

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

Successfully merging a pull request may close this issue.

3 participants