From c3e7329e8eb0bbbf1c40ec7f9f39282f4d2ab31f Mon Sep 17 00:00:00 2001 From: knightXun <1004815462@qq.com> Date: Sun, 16 Feb 2020 15:02:09 +0800 Subject: [PATCH] support hostNetwork --- kubernetes/helm/templates/_helpers.tpl | 9 +++++---- kubernetes/helm/templates/statefulset.yaml | 8 ++++++++ kubernetes/helm/values.yaml | 8 +++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/kubernetes/helm/templates/_helpers.tpl b/kubernetes/helm/templates/_helpers.tpl index 4ccd03ae049..2306f2c3012 100644 --- a/kubernetes/helm/templates/_helpers.tpl +++ b/kubernetes/helm/templates/_helpers.tpl @@ -64,9 +64,10 @@ Create the name of the service account to use {{- define "metad.endpoints" -}} {{- $thriftPort := toString (.Values.port.metad.thriftPort) }} -{{- $replicas := int (toString (.Values.replication.metad.replicas)) }} -{{- $uname := printf "nebula-metad" }} - {{- range $i, $e := untilStep 0 $replicas 1 -}} -{{ $uname }}-{{ $i }}.nebula-metad:{{ $thriftPort }}, +{{- range .Values.Hosts }} +{{- $uname := printf "" }} + {{- with . }} +{{ $uname }}-{{ .value }}:{{ $thriftPort }}, + {{- end -}} {{- end -}} {{- end -}} \ No newline at end of file diff --git a/kubernetes/helm/templates/statefulset.yaml b/kubernetes/helm/templates/statefulset.yaml index 94afeaf3620..e17c13f225d 100644 --- a/kubernetes/helm/templates/statefulset.yaml +++ b/kubernetes/helm/templates/statefulset.yaml @@ -19,6 +19,10 @@ spec: terminationGracePeriodSeconds: 60 # hostname: meta.nebula.services restartPolicy: Always +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }} containers: - name: nebula-metad image: "{{ .Values.image.metad.repository }}:{{ .Values.image.metad.tag }}" @@ -96,6 +100,10 @@ spec: spec: terminationGracePeriodSeconds: 60 restartPolicy: Always +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }} containers: - name: nebula-storaged image: "{{ .Values.image.storaged.repository }}:{{ .Values.image.storaged.tag }}" diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index f48dd75d1b3..ec622cb5e50 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -27,6 +27,11 @@ livenessProbe: Enable: true storaged: Enable: true + +hosts: + - hostIP: 192.168.8.21 + - hostIP: 192.168.8.22 + - hostIP: 192.168.8.23 ## Optional resource requests and limits for the nebula container resources: @@ -95,7 +100,8 @@ storage: metad: size: 20Gi -nodeSelector: {} +nodeSelector: + nebula: "yes" tolerations: []