Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Skip referencing the secret elasticsearch-certs if .Values.elasticsea…
Browse files Browse the repository at this point in the history
…rchCertificateSecret is empty

Signed-off-by: Nobi <[email protected]>
  • Loading branch information
nobiit committed Dec 6, 2022
1 parent 2fd64d0 commit c93cc4c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kibana/templates/configmap-helm-scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ data:
const esUsername = getEnvVar('ELASTICSEARCH_USERNAME');
const esPassword = getEnvVar('ELASTICSEARCH_PASSWORD');
const esAuth = esUsername + ':' + esPassword;
const esCaFile = getEnvVar('ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES');
const esCa = fs.readFileSync(esCaFile);
const esCaFile = process.env['ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES'];
const esCa = esCaFile ? fs.readFileSync(esCaFile) : null;
// Kubernetes API
const k8sHostname = getEnvVar('KUBERNETES_SERVICE_HOST');
Expand Down
4 changes: 4 additions & 0 deletions kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ spec:
volumes:
- name: kibana-tokens
emptyDir: {}
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
secret:
secretName: {{ .Values.elasticsearchCertificateSecret }}
{{- end }}
{{- if .Values.kibanaConfig }}
- name: kibanaconfig
configMap:
Expand Down Expand Up @@ -163,9 +165,11 @@ spec:
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
mountPath: {{ template "kibana.home_dir" . }}/config/certs
readOnly: true
{{- end }}
- name: kibana-tokens
mountPath: {{ template "kibana.home_dir" . }}/config/tokens
readOnly: true
Expand Down
4 changes: 4 additions & 0 deletions kibana/templates/post-delete-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@ spec:
- name: ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES
value: "{{ template "kibana.home_dir" . }}/config/certs/{{ .Values.elasticsearchCertificateAuthoritiesFile }}"
volumeMounts:
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
mountPath: {{ template "kibana.home_dir" . }}/config/certs
readOnly: true
{{- end }}
- name: kibana-helm-scripts
mountPath: {{ template "kibana.home_dir" . }}/helm-scripts
serviceAccount: post-delete-{{ template "kibana.fullname" . }}
volumes:
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
secret:
secretName: {{ .Values.elasticsearchCertificateSecret }}
{{- end }}
- name: kibana-helm-scripts
configMap:
name: {{ template "kibana.fullname" . }}-helm-scripts
Expand Down
6 changes: 6 additions & 0 deletions kibana/templates/pre-install-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ spec:
secretKeyRef:
name: {{ .Values.elasticsearchCredentialSecret }}
key: password
{{- if .Values.elasticsearchCertificateSecret }}
- name: ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES
value: "{{ template "kibana.home_dir" . }}/config/certs/{{ .Values.elasticsearchCertificateAuthoritiesFile }}"
{{- end }}
volumeMounts:
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
mountPath: {{ template "kibana.home_dir" . }}/config/certs
readOnly: true
{{- end }}
- name: kibana-helm-scripts
mountPath: {{ template "kibana.home_dir" . }}/helm-scripts
serviceAccount: pre-install-{{ template "kibana.fullname" . }}
volumes:
{{- if .Values.elasticsearchCertificateSecret }}
- name: elasticsearch-certs
secret:
secretName: {{ .Values.elasticsearchCertificateSecret }}
{{- end }}
- name: kibana-helm-scripts
configMap:
name: {{ template "kibana.fullname" . }}-helm-scripts
Expand Down

0 comments on commit c93cc4c

Please sign in to comment.