Skip to content

Commit

Permalink
add: MASTER_NODES_LABEL (#3597)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps authored Jan 3, 2024
1 parent d8e51e2 commit f7bd252
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ Get IP-addresses of master nodes
{{- $nodes := lookup "v1" "Node" "" "" -}}
{{- $ips := list -}}
{{- range $node := $nodes.items -}}
{{- if eq (index $node.metadata.labels "kube-ovn/role") "master" -}}
{{- $label := splitList "=" $.Values.MASTER_NODES_LABEL }}
{{- $key := index $label 0 }}
{{- $val := "" }}
{{- if eq (len $label) 2 }}
{{- $val = index $label 1 }}
{{- end }}
{{- if eq (index $node.metadata.labels $key) $val -}}
{{- range $address := $node.status.addresses -}}
{{- if eq $address.type "InternalIP" -}}
{{- $ips = append $ips $address.address -}}
Expand Down
4 changes: 3 additions & 1 deletion charts/templates/central-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ spec:
timeoutSeconds: 45
nodeSelector:
kubernetes.io/os: "linux"
kube-ovn/role: "master"
{{- with splitList "=" .Values.MASTER_NODES_LABEL }}
{{ index . 0 }}: "{{ if eq (len .) 2 }}{{ index . 1 }}{{ end }}"
{{- end }}
volumes:
- name: host-run-ovs
hostPath:
Expand Down
6 changes: 4 additions & 2 deletions charts/templates/monitor-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ spec:
timeoutSeconds: 3
nodeSelector:
kubernetes.io/os: "linux"
kube-ovn/role: "master"
{{- with splitList "=" .Values.MASTER_NODES_LABEL }}
{{ index . 0 }}: "{{ if eq (len .) 2 }}{{ index . 1 }}{{ end }}"
{{- end }}
volumes:
- name: host-run-ovs
hostPath:
Expand All @@ -134,4 +136,4 @@ spec:
secretName: kube-ovn-tls
- name: kube-ovn-log
hostPath:
path: {{ .Values.log_conf.LOG_DIR }}/kube-ovn
path: {{ .Values.log_conf.LOG_DIR }}/kube-ovn
1 change: 1 addition & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ image:

namespace: kube-system
MASTER_NODES: ""
MASTER_NODES_LABEL: "kube-ovn/role=master"

networking:
# NET_STACK could be dual_stack, ipv4, ipv6
Expand Down

0 comments on commit f7bd252

Please sign in to comment.