Merge "Charts: Use secrets for configs in chart"

This commit is contained in:
Zuul 2018-08-29 03:31:22 +00:00 committed by Gerrit Code Review
commit 93b0ccdd74
19 changed files with 88 additions and 117 deletions

View File

@ -20,21 +20,17 @@ limitations under the License.
{{- if and (.Values.conf.elasticsearch.repository.enabled) (empty .Values.conf.elasticsearch.config.path.repo) -}} {{- if and (.Values.conf.elasticsearch.repository.enabled) (empty .Values.conf.elasticsearch.config.path.repo) -}}
{{- set .Values.conf.elasticsearch.config.path "repo" .Values.conf.elasticsearch.repository.location -}} {{- set .Values.conf.elasticsearch.config.path "repo" .Values.conf.elasticsearch.repository.location -}}
{{- end -}} {{- end -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: elasticsearch-etc name: elasticsearch-etc
type: Opaque
data: data:
elasticsearch.yml: | elasticsearch.yml: {{ toYaml .Values.conf.elasticsearch.config | b64enc }}
{{ toYaml .Values.conf.elasticsearch.config | indent 4 }} action_file.yml: {{ toYaml .Values.conf.curator.action_file | b64enc }}
log4j2.properties: | config.yml: {{ toYaml .Values.conf.curator.config | b64enc }}
{{- tuple .Values.conf.elasticsearch "etc/_log4j2.properties.tpl" . | include "helm-toolkit.utils.configmap_templater" }}
action_file.yml: |
{{ toYaml .Values.conf.curator.action_file | indent 4 }}
config.yml: |
{{ toYaml .Values.conf.curator.config | indent 4 }}
#NOTE(portdirect): this must be last, to work round helm ~2.7 bug. #NOTE(portdirect): this must be last, to work round helm ~2.7 bug.
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf") | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf" "format" "Secret") | indent 2 }}
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.log4j2 "key" "log4j2.properties" "format" "Secret") | indent 2 }}
{{- end }} {{- end }}

View File

@ -74,7 +74,7 @@ spec:
name: elasticsearch-bin name: elasticsearch-bin
defaultMode: 0555 defaultMode: 0555
- name: elasticsearch-etc - name: elasticsearch-etc
configMap: secret:
name: elasticsearch-etc secretName: elasticsearch-etc
defaultMode: 0444 defaultMode: 0444
{{- end }} {{- end }}

View File

@ -234,8 +234,8 @@ spec:
name: elasticsearch-bin name: elasticsearch-bin
defaultMode: 0555 defaultMode: 0555
- name: elasticsearch-etc - name: elasticsearch-etc
configMap: secret:
name: elasticsearch-etc secretName: elasticsearch-etc
defaultMode: 0444 defaultMode: 0444
- name: storage - name: storage
emptyDir: {} emptyDir: {}

View File

@ -190,8 +190,8 @@ spec:
name: elasticsearch-bin name: elasticsearch-bin
defaultMode: 0555 defaultMode: 0555
- name: elasticsearch-etc - name: elasticsearch-etc
configMap: secret:
name: elasticsearch-etc secretName: elasticsearch-etc
defaultMode: 0444 defaultMode: 0444
- name: storage - name: storage
emptyDir: {} emptyDir: {}

View File

@ -1,37 +0,0 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${hostName}.log
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${hostName}.log.%i
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{DEFAULT}][%-5p][%-25c] %.10000m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=100MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5
appender.rolling.strategy.fileIndex = min
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
rootLogger.appenderRef.rolling.ref = rolling

View File

@ -187,8 +187,8 @@ spec:
name: elasticsearch-bin name: elasticsearch-bin
defaultMode: 0555 defaultMode: 0555
- name: elasticsearch-etc - name: elasticsearch-etc
configMap: secret:
name: elasticsearch-etc secretName: elasticsearch-etc
defaultMode: 0444 defaultMode: 0444
{{ if .Values.storage.filesystem_repository.enabled }} {{ if .Values.storage.filesystem_repository.enabled }}
- name: snapshots - name: snapshots

View File

@ -271,6 +271,26 @@ conf:
Require valid-user Require valid-user
</Proxy> </Proxy>
</VirtualHost> </VirtualHost>
log4j2: |
appender.console.type=Console
appender.console.name=console
appender.console.layout.type=PatternLayout
appender.console.layout.pattern="[%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n"
appender.rolling.type=RollingFile
appender.rolling.name=rolling
appender.rolling.fileName="${sys:es.logs.base_path}${sys:file.separator}${hostName}.log"
appender.rolling.filePattern="${sys:es.logs.base_path}${sys:file.separator}${hostName}.log.%i"
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern="[%d{DEFAULT}][%-5p][%-25c] %.10000m%n"
appender.rolling.policies.type=Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=100MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max=5
appender.rolling.strategy.fileIndex=min
rootLogger.level=info
rootLogger.appenderRef.console.ref=console
rootLogger.appenderRef.rolling.ref=rolling
init: init:
max_map_count: 262144 max_map_count: 262144
curator: curator:
@ -408,10 +428,6 @@ conf:
type: fs type: fs
env: env:
java_opts: "-Xms256m -Xmx256m" java_opts: "-Xms256m -Xmx256m"
log4j2:
override:
prefix:
append:
prometheus_elasticsearch_exporter: prometheus_elasticsearch_exporter:
es: es:
all: true all: true

View File

@ -18,18 +18,15 @@ limitations under the License.
{{- $envAll := . }} {{- $envAll := . }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: fluent-logging-etc name: fluent-logging-etc
type: Opaque
data: data:
fluent-bit.conf: | fluent-bit.conf: {{ include "fluent_logging.utils.to_fluentbit_conf" .Values.conf.fluentbit | b64enc }}
{{ include "fluent_logging.utils.to_fluentbit_conf" .Values.conf.fluentbit | indent 4 }} parsers.conf: {{ include "fluent_logging.utils.to_fluentbit_conf" .Values.conf.parsers | b64enc }}
parsers.conf: | fluent.conf: {{ include "fluent_logging.utils.to_fluentd_conf" .Values.conf.td_agent | b64enc }}
{{ include "fluent_logging.utils.to_fluentbit_conf" .Values.conf.parsers | indent 4 }}
fluent.conf: |
{{ include "fluent_logging.utils.to_fluentd_conf" .Values.conf.td_agent | indent 4 }}
{{ range $template, $fields := .Values.conf.templates }} {{ range $template, $fields := .Values.conf.templates }}
{{ $template }}.json: | {{ $template }}.json: {{ toJson $fields | b64enc }}
{{ toJson $fields | indent 4 }}
{{ end }} {{ end }}
{{- end }} {{- end }}

View File

@ -148,8 +148,8 @@ spec:
name: fluent-logging-bin name: fluent-logging-bin
defaultMode: 0555 defaultMode: 0555
- name: fluent-logging-etc - name: fluent-logging-etc
configMap: secret:
name: fluent-logging-etc secretName: fluent-logging-etc
defaultMode: 0444 defaultMode: 0444
{{ if $mounts_fluentbit.volumes }}{{ toYaml $mounts_fluentbit.volumes | indent 8 }}{{ end }} {{ if $mounts_fluentbit.volumes }}{{ toYaml $mounts_fluentbit.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}

View File

@ -150,8 +150,8 @@ spec:
- name: pod-etc-fluentd - name: pod-etc-fluentd
emptyDir: {} emptyDir: {}
- name: fluent-logging-etc - name: fluent-logging-etc
configMap: secret:
name: fluent-logging-etc secretName: fluent-logging-etc
defaultMode: 0444 defaultMode: 0444
- name: fluent-logging-bin - name: fluent-logging-bin
configMap: configMap:

View File

@ -78,8 +78,8 @@ spec:
name: fluent-logging-bin name: fluent-logging-bin
defaultMode: 0555 defaultMode: 0555
- name: fluent-logging-etc - name: fluent-logging-etc
configMap: secret:
name: fluent-logging-etc secretName: fluent-logging-etc
defaultMode: 0666 defaultMode: 0444
{{ if $mounts_elasticsearch_template.volumes }}{{ toYaml $mounts_elasticsearch_template.volumes | indent 8 }}{{ end }} {{ if $mounts_elasticsearch_template.volumes }}{{ toYaml $mounts_elasticsearch_template.volumes | indent 8 }}{{ end }}
{{- end }} {{- end }}

View File

@ -30,21 +30,18 @@ limitations under the License.
{{- end -}} {{- end -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: grafana-etc name: grafana-etc
type: Opaque
data: data:
datasources.yaml: | datasources.yaml: {{ include "grafana.utils.generate_datasources" (dict "envAll" $envAll "datasources" .Values.conf.provisioning.datasources) | b64enc }}
{{- include "grafana.utils.generate_datasources" (dict "envAll" $envAll "datasources" .Values.conf.provisioning.datasources) | indent 4 }} dashboards.yaml: {{ toYaml .Values.conf.provisioning.dashboards | b64enc }}
dashboards.yaml: | grafana.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.grafana | b64enc }}
{{ toYaml .Values.conf.provisioning.dashboards | indent 4 }}
grafana.ini: |
{{ include "helm-toolkit.utils.to_ini" .Values.conf.grafana | indent 4 }}
{{ if not (empty .Values.conf.ldap) }} {{ if not (empty .Values.conf.ldap) }}
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.ldap.template "key" "ldap.toml") | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.ldap.template "key" "ldap.toml" "format" "Secret") | indent 2 }}
{{ end }} {{ end }}
{{ range $key, $value := .Values.conf.dashboards }} {{ range $key, $value := .Values.conf.dashboards }}
{{$key}}.json: | {{$key}}.json: {{ toJson $value | b64enc }}
{{ toJson $value | indent 4 }}
{{ end }} {{ end }}
{{- end }} {{- end }}

View File

@ -115,8 +115,8 @@ spec:
name: grafana-bin name: grafana-bin
defaultMode: 0555 defaultMode: 0555
- name: grafana-etc - name: grafana-etc
configMap: secret:
name: grafana-etc secretName: grafana-etc
defaultMode: 0444 defaultMode: 0444
- name: data - name: data
emptyDir: {} emptyDir: {}

View File

@ -18,12 +18,12 @@ limitations under the License.
{{- $envAll := . }} {{- $envAll := . }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: kibana-etc name: kibana-etc
type: Opaque
data: data:
kibana.yml: | kibana.yml: {{ toYaml .Values.conf.kibana | b64enc }}
{{ toYaml .Values.conf.kibana | indent 4 }}
#NOTE(portdirect): this must be last, to work round helm ~2.7 bug. #NOTE(portdirect): this must be last, to work round helm ~2.7 bug.
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf") | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf" "format" "Secret") | indent 2 }}
{{- end }} {{- end }}

View File

@ -127,7 +127,7 @@ spec:
name: kibana-bin name: kibana-bin
defaultMode: 0555 defaultMode: 0555
- name: kibana-etc - name: kibana-etc
configMap: secret:
name: kibana-etc secretName: kibana-etc
defaultMode: 0444 defaultMode: 0444
{{- end }} {{- end }}

View File

@ -14,25 +14,27 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{ define "configmap_etc._nagios_objects" }}
{{- tuple "contact" $.Values.conf.nagios.contacts | include "nagios.utils.object_definition" }}
{{- tuple "contactgroup" $.Values.conf.nagios.contactgroups | include "nagios.utils.object_definition" }}
{{- tuple "host" $.Values.conf.nagios.hosts | include "nagios.utils.object_definition" }}
{{- tuple "hostgroup" $.Values.conf.nagios.host_groups | include "nagios.utils.object_definition" }}
{{- tuple "command" $.Values.conf.nagios.commands | include "nagios.utils.object_definition" }}
{{- tuple "service" $.Values.conf.nagios.services | include "nagios.utils.object_definition" }}
{{- end }}
{{- if .Values.manifests.configmap_etc }} {{- if .Values.manifests.configmap_etc }}
{{- $envAll := . }} {{- $envAll := . }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: nagios-etc name: nagios-etc
type: Opaque
data: data:
cgi.cfg: |+ cgi.cfg: {{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.cgi | b64enc }}
{{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.cgi | indent 4 }} nagios.cfg: {{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.nagios | b64enc }}
nagios.cfg: |+ nagios_objects.cfg: {{ include "configmap_etc._nagios_objects" $ | b64enc }}
{{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.nagios | indent 4 }}
nagios_objects.cfg: |+
{{- tuple "contact" .Values.conf.nagios.contacts | include "nagios.utils.object_definition" | indent 4 }}
{{- tuple "contactgroup" .Values.conf.nagios.contactgroups | include "nagios.utils.object_definition" | indent 4 }}
{{- tuple "host" .Values.conf.nagios.hosts | include "nagios.utils.object_definition" | indent 4 }}
{{- tuple "hostgroup" .Values.conf.nagios.host_groups | include "nagios.utils.object_definition" | indent 4 }}
{{- tuple "command" .Values.conf.nagios.commands | include "nagios.utils.object_definition" | indent 4 }}
{{- tuple "service" .Values.conf.nagios.services | include "nagios.utils.object_definition" | indent 4 }}
#NOTE(portdirect): this must be last, to work round helm ~2.7 bug. #NOTE(portdirect): this must be last, to work round helm ~2.7 bug.
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf") | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf" "format" "Secret") | indent 2 }}
{{- end }} {{- end }}

View File

@ -162,8 +162,8 @@ spec:
readOnly: true readOnly: true
volumes: volumes:
- name: nagios-etc - name: nagios-etc
configMap: secret:
name: nagios-etc secretName: nagios-etc
defaultMode: 0444 defaultMode: 0444
- name: pod-etc-apache - name: pod-etc-apache
emptyDir: {} emptyDir: {}

View File

@ -38,16 +38,15 @@ limitations under the License.
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: prometheus-etc name: prometheus-etc
type: Opaque
data: data:
prometheus.yml: |+ prometheus.yml: {{ toYaml .Values.conf.prometheus.scrape_configs | b64enc }}
{{ toYaml .Values.conf.prometheus.scrape_configs | indent 4 }}
{{ range $key, $value := .Values.conf.prometheus.rules }} {{ range $key, $value := .Values.conf.prometheus.rules }}
{{ $key }}.rules: | {{ $key }}.rules: {{ toYaml $value | b64enc }}
{{ toYaml $value | indent 4 }}
{{ end }} {{ end }}
#NOTE(srwilkers): this must be last, to work round helm ~2.7 bug. #NOTE(srwilkers): this must be last, to work round helm ~2.7 bug.
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf") | indent 2 }} {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf" "format" "Secret") | indent 2 }}
{{- end }} {{- end }}

View File

@ -189,8 +189,9 @@ spec:
- name: rulesprometheus - name: rulesprometheus
emptyDir: {} emptyDir: {}
- name: prometheus-etc - name: prometheus-etc
configMap: secret:
name: prometheus-etc secretName: prometheus-etc
defaultMode: 0444
- name: prometheus-bin - name: prometheus-bin
configMap: configMap:
name: prometheus-bin name: prometheus-bin