sealerio / sealer

Build, Share and Run Both Your Kubernetes Cluster and Distributed Applications (Project under CNCF)
http://sealer.cool
Apache License 2.0
2.06k stars 362 forks source link

plugin不生效 #2338

Open ChenWoChong opened 7 months ago

ChenWoChong commented 7 months ago

What happen?

当我使用一下clusterfile去创建集群时,plugin不生效,不知道是哪里写错了

apiVersion: sealer.io/v2
kind: Cluster
metadata:
  name: my-cluster
spec:

  hosts:
    - ips:
        - 10.56.60.165
      roles:
        - master
      ssh: {}
    - ips:
        - 10.56.60.217
      roles:
        - node
      ssh: {}
#  image: docker.io/sealerio/kubernetes:v1-22-15-sealerio-2
  image: localhost/my-cluster:v1.0.2
  registry:
    localRegistry:
      cert: {}
      domain: sea.hub
      ha: true
      insecure: false
      port: 5000

---
apiVersion: sealer.aliyun.com/v1alpha1
kind: Plugin
metadata:
  name: LabelDrsNode
spec:
  type: SHELL
  action: PostInstall # # 指定运行阶段【PreInit | PostInstall | PostClean】
  'on': node-role.kubernetes.io/master=
  data: |
    kubectl label nodes $(kubectl get nodes --selector='node-role.kubernetes.io/node=' -o=jsonpath='{.items[*].metadata.name}') node-role.kubernetes.io/drs= --overwrite
---
apiVersion: sealer.aliyun.com/v1alpha1
kind: Plugin
metadata:
  name: LoadImg
spec:
  type: SHELL
  action: PostInstall # # 指定运行阶段【PreInit | PostInstall | PostClean】
  data: |
    source drs-charts/install.sh img -d

sealer version: sealer version {"gitVersion":"v0.9.3","gitCommit":"a51d0ec","buildDate":"2023-03-31 05:58:58","goVersion":"go1.17.13","compiler":"gc","platform":"linux/amd64"}

Relevant log output?

[root@sea drs-charts]# kubectl get nodes --show-labels | grep drs
什么都没有

What you expected to happen?

在后置postinstall里增加了label,worker节点应该会显示的

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

No response

Anything else we need to know?

No response

What is the version of Sealer you using?

sealer version {"gitVersion":"v0.9.3","gitCommit":"a51d0ec","buildDate":"2023-03-31 05:58:58","goVersion":"go1.17.13","compiler":"gc","platform":"linux/amd64"}

What is your OS environment?

No response

What is the Kernel version?

CentOS 7.6

Other environment you want to tell us?