diff --git a/submariner/templates/_helpers.tpl b/submariner/templates/_helpers.tpl index 8b30f4e..d512372 100644 --- a/submariner/templates/_helpers.tpl +++ b/submariner/templates/_helpers.tpl @@ -74,3 +74,10 @@ Create the name of the submariner-lighthouse service account to use {{ default "default" .Values.serviceAccounts.lighthouse.name }} {{- end -}} {{- end -}} + +{{/* +Create the name of the submariner-lighthouse-coredns service name to use +*/}} +{{- define "submariner.lighthouseDnsName" -}} +{{- default (printf "%s-lighthouse-coredns" (include "submariner.fullname" .)) .Values.lighthouseCoredns.name }} +{{- end -}} diff --git a/submariner/templates/lighthouse-coredns.yaml b/submariner/templates/lighthouse-coredns.yaml new file mode 100644 index 0000000..d6ab12a --- /dev/null +++ b/submariner/templates/lighthouse-coredns.yaml @@ -0,0 +1,74 @@ +{{- if .Values.submariner.serviceDiscovery }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "submariner.lighthouseDnsName" . }} + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: {{ template "submariner.chart" . }} + app: {{ template "submariner.lighthouseDnsName" . }} + component: lighthouse-coredns +spec: + selector: + matchLabels: + app: {{ template "submariner.lighthouseDnsName" . }} + replicas: 2 + template: + metadata: + labels: + app: {{ template "submariner.lighthouseDnsName" . }} + spec: + containers: + - args: + - -conf + - /etc/coredns/Corefile + image: {{ .Values.lighthouseCoredns.image.repository }}:{{ .Values.lighthouseCoredns.image.tag }} + imagePullPolicy: {{ .Values.lighthouseCoredns.image.pullPolicy }} + name: {{ template "submariner.fullname" . }}-lighthouse-agent + volumeMounts: + - mountPath: /etc/coredns + name: config-volume + readOnly: true + serviceAccountName: {{ template "submariner.lighthouseServiceAccountName" . }} + volumes: + - configMap: + defaultMode: 420 + items: + - key: Corefile + path: Corefile + name: {{ template "submariner.lighthouseDnsName" . }} + name: config-volume +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "submariner.lighthouseDnsName" . }} + labels: + app: {{ template "submariner.lighthouseDnsName" . }} +spec: + ports: + - name: udp + port: 53 + protocol: UDP + targetPort: 53 + selector: + app: {{ template "submariner.lighthouseDnsName" . }} + type: ClusterIP +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "submariner.lighthouseDnsName" . }} +data: + Corefile: | + supercluster.local:53 { +{{- if .Values.submariner.debug }} + log +{{- end }} + lighthouse + errors + health + ready + } +{{- end }} diff --git a/submariner/templates/rbac.yaml b/submariner/templates/rbac.yaml index bfa94a3..165f146 100644 --- a/submariner/templates/rbac.yaml +++ b/submariner/templates/rbac.yaml @@ -118,7 +118,7 @@ metadata: name: {{ template "submariner.fullname" . }}:lighthouse rules: - apiGroups: [""] - resources: ["services", "namespaces"] + resources: ["services", "namespaces", "configmaps"] verbs: ["get", "list", "watch", "update"] - apiGroups: ["lighthouse.submariner.io"] resources: ["*"] diff --git a/submariner/values.yaml b/submariner/values.yaml index 023c050..cae1b10 100644 --- a/submariner/values.yaml +++ b/submariner/values.yaml @@ -64,6 +64,12 @@ lighthouse: repository: lighthouse-agent tag: local pullPolicy: IfNotPresent +lighthouseCoredns: + name: "" + image: + repository: lighthouse-coredns + tag: local + pullPolicy: IfNotPresent serviceAccounts: engine: create: true