Unverified Commit cd267840 authored by David McKay's avatar David McKay Committed by GitHub

feat/ca mount (#163)

* feat: support mounting a ca bundle into the certs directory * feat: support alternative secret for CA * fix: don't strip newline * Changing how images are passed in * Add conditional to override tag as per fede * Update to handle external commands and top level image * Updating changes * Fixed tagging * Adding helper named template to get the image * Template working * chore: version bump * fix: revert values.yaml changes Co-authored-by: 's avatarJames Nieper <james.nieper@gmail.com>
parent 5f666720
apiVersion: v2 apiVersion: v1
version: 0.1.6 version: 0.1.7
appVersion: 1.8.0 appVersion: 1.8.0
engine: gotpl engine: gotpl
......
...@@ -50,3 +50,19 @@ Selector labels ...@@ -50,3 +50,19 @@ Selector labels
app.kubernetes.io/name: {{ include "influxdb-enterprise.name" . }} app.kubernetes.io/name: {{ include "influxdb-enterprise.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }} {{- end }}
{{- define "influxdb-enterprise.image" -}}
{{- $dataTagName := (printf "%s-%s" .chart.AppVersion .podtype) -}}
{{- if (.imageroot) }}
{{- if (.imageroot.tag) -}}
{{- $dataTagName = .imageroot.tag -}}
{{- end -}}
{{- if (.imageroot.addsuffix) -}}
{{- $dataTagName = printf "%s-%s" $dataTagName .podtype -}}
{{- end -}}
{{- end }}
image: "{{ .podvals.image.repository | default "influxdb" }}:{{ $dataTagName }}"
{{- end }}
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
initContainers: initContainers:
{{- if .Values.bootstrap.auth.secretName }} {{- if .Values.bootstrap.auth.secretName }}
- name: auth - name: auth
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 8 }}
imagePullPolicy: {{ .Values.data.image.pullPolicy }} imagePullPolicy: {{ .Values.data.image.pullPolicy }}
# Exposing these environment variables makes this command idempotent # Exposing these environment variables makes this command idempotent
# as even if the authentication has been setup, we can still execute the command # as even if the authentication has been setup, we can still execute the command
...@@ -68,7 +68,7 @@ spec: ...@@ -68,7 +68,7 @@ spec:
{{ end }} {{ end }}
{{- if .Values.bootstrap.ddldml.configMap }} {{- if .Values.bootstrap.ddldml.configMap }}
- name: ddl - name: ddl
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 8 }}
imagePullPolicy: {{ .Values.data.image.pullPolicy }} imagePullPolicy: {{ .Values.data.image.pullPolicy }}
{{- if .Values.bootstrap.auth.secretName }} {{- if .Values.bootstrap.auth.secretName }}
env: env:
...@@ -105,7 +105,7 @@ spec: ...@@ -105,7 +105,7 @@ spec:
{{ end }} {{ end }}
{{- if .Values.bootstrap.ddldml.configMap }} {{- if .Values.bootstrap.ddldml.configMap }}
- name: dml - name: dml
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 8 }}
imagePullPolicy: {{ .Values.data.image.pullPolicy }} imagePullPolicy: {{ .Values.data.image.pullPolicy }}
{{- if .Values.bootstrap.auth.secretName }} {{- if .Values.bootstrap.auth.secretName }}
env: env:
...@@ -142,7 +142,7 @@ spec: ...@@ -142,7 +142,7 @@ spec:
{{ end }} {{ end }}
containers: containers:
- name: success - name: success
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 8 }}
imagePullPolicy: {{ .Values.data.image.pullPolicy }} imagePullPolicy: {{ .Values.data.image.pullPolicy }}
command: command:
- echo - echo
......
...@@ -69,6 +69,17 @@ data: ...@@ -69,6 +69,17 @@ data:
$ENV{INFLUXDB_HOSTNAME} = `hostname -f`; $ENV{INFLUXDB_HOSTNAME} = `hostname -f`;
$ENV{INFLUXDB_HOSTNAME} =~ s/\n$//; $ENV{INFLUXDB_HOSTNAME} =~ s/\n$//;
{{ if .Values.data.preruncmds }}
# These are commands that will run before influxdb is initialized
{{- range .Values.data.preruncmds }}
{{ if .description }}
# {{ .description }}
{{- end }}
system('{{ .cmd }}');
{{- end }}
{{ end }}
$pid = fork(); $pid = fork();
# Inside this conditional is our child process, which # Inside this conditional is our child process, which
......
...@@ -60,6 +60,20 @@ spec: ...@@ -60,6 +60,20 @@ spec:
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{- if and .Values.data.https.enabled .Values.data.https.secret }}
{{- if .Values.data.https.secret.ca -}}
- name: tls-ca
secret:
{{ if .Values.data.https.secret.caSecret -}}
secretName: {{ .Values.data.https.secret.caSecret }}
{{ else }}
secretName: {{ .Values.data.https.secret.name }}
{{ end }}
items:
- key: {{ .Values.data.https.secret.ca }}
path: ca.crt
{{ end }}
{{ end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
command: command:
...@@ -68,7 +82,7 @@ spec: ...@@ -68,7 +82,7 @@ spec:
- "/etc/influxdb/entrypoint.pl" - "/etc/influxdb/entrypoint.pl"
securityContext: securityContext:
{{- toYaml .Values.data.securityContext | nindent 12 }} {{- toYaml .Values.data.securityContext | nindent 12 }}
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 10 }}
imagePullPolicy: {{ .Values.data.image.pullPolicy }} imagePullPolicy: {{ .Values.data.image.pullPolicy }}
env: env:
- name: RELEASE_NAME - name: RELEASE_NAME
...@@ -120,6 +134,13 @@ spec: ...@@ -120,6 +134,13 @@ spec:
- name: tls - name: tls
mountPath: /var/run/secrets/tls/ mountPath: /var/run/secrets/tls/
{{ end }} {{ end }}
{{- if and .Values.data.https.enabled .Values.data.https.secret }}
{{- if .Values.data.https.secret.ca -}}
- name: tls-ca
mountPath: /etc/ssl/certs/ca-certificates.crt
subPath: ca.crt
{{ end }}
{{ end }}
resources: resources:
{{- toYaml .Values.data.resources | nindent 12 }} {{- toYaml .Values.data.resources | nindent 12 }}
{{- with .Values.data.nodeSelector }} {{- with .Values.data.nodeSelector }}
......
...@@ -48,8 +48,20 @@ data: ...@@ -48,8 +48,20 @@ data:
$ENV{INFLUXDB_HOSTNAME} = `hostname -f`; $ENV{INFLUXDB_HOSTNAME} = `hostname -f`;
$ENV{INFLUXDB_HOSTNAME} =~ s/\n$//; $ENV{INFLUXDB_HOSTNAME} =~ s/\n$//;
{{ if .Values.meta.preruncmds }}
# These are commands that will run before influxdb is initialized
{{- range .Values.meta.preruncmds }}
{{ if .description }}
# {{ .description }}
{{- end }}
system('{{ .cmd }}');
{{- end }}
{{ end }}
$pid = fork(); $pid = fork();
# Inside this conditional is our child process, which # Inside this conditional is our child process, which
# will return `influxd-meta` # will return `influxd-meta`
if($pid == 0) { if($pid == 0) {
......
...@@ -60,6 +60,20 @@ spec: ...@@ -60,6 +60,20 @@ spec:
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{- if and .Values.meta.https.enabled .Values.meta.https.secret }}
{{- if .Values.meta.https.secret.ca -}}
- name: tls-ca
secret:
{{ if .Values.meta.https.secret.caSecret -}}
secretName: {{ .Values.meta.https.secret.caSecret }}
{{ else }}
secretName: {{ .Values.meta.https.secret.name }}
{{ end }}
items:
- key: {{ .Values.meta.https.secret.ca }}
path: ca.crt
{{ end }}
{{ end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
command: command:
...@@ -68,7 +82,7 @@ spec: ...@@ -68,7 +82,7 @@ spec:
- "/etc/influxdb/entrypoint.pl" - "/etc/influxdb/entrypoint.pl"
securityContext: securityContext:
{{- toYaml .Values.meta.securityContext | nindent 12 }} {{- toYaml .Values.meta.securityContext | nindent 12 }}
image: "{{ .Values.meta.image.repository | default "influxdb" }}:{{ .Values.meta.image.tag | default (printf "%s-%s" .Chart.AppVersion "meta") }}" {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.meta "podtype" "meta") | indent 10 }}
imagePullPolicy: {{ .Values.meta.image.pullPolicy }} imagePullPolicy: {{ .Values.meta.image.pullPolicy }}
env: env:
- name: INFLUXDB_META_INTERNAL_SHARED_SECRET - name: INFLUXDB_META_INTERNAL_SHARED_SECRET
...@@ -110,6 +124,13 @@ spec: ...@@ -110,6 +124,13 @@ spec:
- name: tls - name: tls
mountPath: /var/run/secrets/tls/ mountPath: /var/run/secrets/tls/
{{ end }} {{ end }}
{{- if and .Values.meta.https.enabled .Values.meta.https.secret }}
{{- if .Values.meta.https.secret.ca -}}
- name: tls-ca
mountPath: /usr/share/ca-certificates/selfsigned/ca.crt
subPath: ca.crt
{{ end }}
{{ end }}
resources: resources:
{{- toYaml .Values.meta.resources | nindent 12 }} {{- toYaml .Values.meta.resources | nindent 12 }}
{{- with .Values.meta.nodeSelector }} {{- with .Values.meta.nodeSelector }}
......
...@@ -43,20 +43,32 @@ bootstrap: ...@@ -43,20 +43,32 @@ bootstrap:
# configMap: ddl-dml # configMap: ddl-dml
# resources: {} # resources: {}
# Sets the tagged version of the docker image that you want to run, will default to latest
# The suffix is if you are pulling from influx repo, example images will be influxdb:1.8.0-meta and influxdb:1.8.0-data
# If set to true, the suffix won't be added
#image:
# tag: v1.eg.whatever
# ignoresuffix: true | false
meta: meta:
replicas: 1 replicas: 1
image: {} image: {}
# override: true # override: true
# pullPolicy: IfNotPresent # pullPolicy: IfNotPresent
# repository: influxdb # repository: influxdb
# tag: "meta"
# nodeSelector: {} # nodeSelector: {}
# tolerations: [] # tolerations: []
# affinity: {} # affinity: {}
# podAnnotations: {} # podAnnotations: {}
#
# podSecurityContext: {} # podSecurityContext: {}
# fsGroup: 2000 # fsGroup: 2000
#
# This allows you to run the pods as a non-privileged user, set to the uid
# securityContext: {} # securityContext: {}
# runAsUser: 2000
# runAsGroup: 2000
# capabilities: # capabilities:
# drop: # drop:
# - ALL # - ALL
...@@ -64,7 +76,12 @@ meta: ...@@ -64,7 +76,12 @@ meta:
# runAsNonRoot: true # runAsNonRoot: true
# runAsUser: 1000 # runAsUser: 1000
# #
# # These are the commands that will be run before influxdb is started
# preruncmds:
# - cmd: ls -l
# description: We want to see what's in the directory
# - cmd: stat $HOME/somefile
# description: And we run a second command
# This secret needs a key called "secret" and it should be a long random string # This secret needs a key called "secret" and it should be a long random string
# Please see docs for shared-internal-secret: # Please see docs for shared-internal-secret:
# https://docs.influxdata.com/enterprise_influxdb/v1.8/administration/config-data-nodes/#meta-internal-shared-secret # https://docs.influxdata.com/enterprise_influxdb/v1.8/administration/config-data-nodes/#meta-internal-shared-secret
...@@ -107,6 +124,8 @@ meta: ...@@ -107,6 +124,8 @@ meta:
name: tls-secret name: tls-secret
# crt: tls.crt # crt: tls.crt
# key: tls.key # key: tls.key
# ca: ca.crt
# caSecret: secret-name # only use if different from the above
insecure: true insecure: true
...@@ -116,20 +135,36 @@ data: ...@@ -116,20 +135,36 @@ data:
# override: true # override: true
# pullPolicy: IfNotPresent # pullPolicy: IfNotPresent
# repository: influxdb # repository: influxdb
# tag: "data"
# nodeSelector: {} # nodeSelector: {}
# tolerations: [] # tolerations: []
# affinity: {} # affinity: {}
# podAnnotations: {} # podAnnotations: {}
#
# podSecurityContext: {} # podSecurityContext: {}
# fsGroup: 2000 # fsGroup: 2000
#
# This allows you to run the pods as a non-privileged user, set to the uid
# securityContext: {} # securityContext: {}
# runAsUser: 2000
# runAsGroup: 2000
# capabilities: # capabilities:
# drop: # drop:
# - ALL # - ALL
# capabilities:
# drop:
# - ALL
#
# readOnlyRootFilesystem: true # readOnlyRootFilesystem: true
# runAsNonRoot: true # runAsNonRoot: true
# runAsUser: 1000 # runAsUser: 1000
#
# These are the commands that will be run before influxdb is started
# preruncmds:
# - cmd: ls -l
# description: We want to see what's in the directory
# - cmd: stat $HOME/somefile
# description: And we run a second command
#
## Persist data to a persistent volume ## Persist data to a persistent volume
## ##
persistence: persistence:
...@@ -162,4 +197,6 @@ data: ...@@ -162,4 +197,6 @@ data:
name: tls-secret name: tls-secret
# crt: tls.crt # crt: tls.crt
# key: tls.key # key: tls.key
# ca: ca.crt
# caSecret: secret-name # only use if different from the above
insecure: true insecure: true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment