mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
feat: add annotations to node (#2594)
Signed-off-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
parent
38944a5d2f
commit
ff50e145ca
|
|
@ -73,3 +73,8 @@
|
|||
- name: Add work label
|
||||
command: |
|
||||
/usr/local/bin/kubectl label --overwrite node {{ .hostname }} node-role.kubernetes.io/worker=
|
||||
|
||||
- name: Add annotations
|
||||
when: .annotations | empty | not
|
||||
command: |
|
||||
kubectl annotate {{ .hostname }} {{- range $k,$v := .annotations }}{{ printf "%s=%s" $k $v}} {{- end }}
|
||||
|
|
@ -47,6 +47,11 @@
|
|||
command: |
|
||||
/usr/local/bin/kubectl label --overwrite node {{ .hostname }} node-role.kubernetes.io/worker=
|
||||
|
||||
- name: Add annotations
|
||||
when: .annotations | empty | not
|
||||
command: |
|
||||
kubectl annotate {{ .hostname }} {{- range $k,$v := .annotations }}{{ printf "%s=%s" $k $v}} {{- end }}
|
||||
|
||||
- name: Set change custom hosts to localDNS file
|
||||
when:
|
||||
- eq .kubernetes.control_plane_endpoint.type "local"
|
||||
|
|
|
|||
|
|
@ -188,6 +188,23 @@ func TestParseBool(t *testing.T) {
|
|||
},
|
||||
excepted: true,
|
||||
},
|
||||
// ======= empty =======
|
||||
{
|
||||
name: "empty true-1",
|
||||
condition: []string{`{{ empty .foo }}`},
|
||||
variable: map[string]any{
|
||||
"foo": map[string]any{},
|
||||
},
|
||||
excepted: true,
|
||||
},
|
||||
{
|
||||
name: "empty true-2",
|
||||
condition: []string{`{{ empty .foo }}`},
|
||||
variable: map[string]any{
|
||||
"foo": []any{},
|
||||
},
|
||||
excepted: true,
|
||||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue