MariaDB: Clean up values file and exporter start script

This PS cleans up the default values file, and also allows some
aspects of the mysql exporter's operation to be configured.

Change-Id: I577e3237ca0bfe3665e7a57cf2a9364baea7c24a
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2019-04-06 15:08:27 -04:00 committed by Pete Birley
parent 1a81952929
commit 75b823e875
5 changed files with 22 additions and 28 deletions

View File

@ -14,4 +14,4 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{ .Values.database.config_override }} {{ .Values.conf.database.config_override }}

View File

@ -17,14 +17,8 @@ limitations under the License.
*/}} */}}
set -ex set -ex
COMMAND="${@:-start}"
function start () { exec /bin/mysqld_exporter \
exec /bin/mysqld_exporter -config.my-cnf=/etc/mysql/mysql_user.cnf -config.my-cnf=/etc/mysql/mysql_user.cnf \
} -web.listen-address="${POD_IP}:${LISTEN_PORT}" \
-web.telemetry-path="$TELEMETRY_PATH"
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -54,10 +54,9 @@ spec:
{{ tuple $envAll $envAll.Values.pod.resources.prometheus_mysql_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.prometheus_mysql_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /tmp/mysqld-exporter.sh - /tmp/mysqld-exporter.sh
- start
ports: ports:
- name: metrics - name: metrics
containerPort: {{ .Values.network.prometheus_mysql_exporter.port }} containerPort: {{ tuple "prometheus_mysql_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
env: env:
- name: EXPORTER_USER - name: EXPORTER_USER
valueFrom: valueFrom:
@ -74,6 +73,14 @@ spec:
secretKeyRef: secretKeyRef:
name: mysql-exporter-secrets name: mysql-exporter-secrets
key: DATA_SOURCE_NAME key: DATA_SOURCE_NAME
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: LISTEN_PORT
value: {{ tuple "prometheus_mysql_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: TELEMETRY_PATH
value: {{ tuple "prometheus_mysql_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.keystone_endpoint_path_lookup" | quote }}
volumeMounts: volumeMounts:
- name: mysql-exporter-secrets - name: mysql-exporter-secrets
mountPath: /etc/mysql/mysql_user.cnf mountPath: /etc/mysql/mysql_user.cnf

View File

@ -31,7 +31,7 @@ metadata:
spec: spec:
ports: ports:
- name: metrics - name: metrics
port: {{ .Values.network.prometheus_mysql_exporter.port }} port: {{ tuple "prometheus_mysql_exporter" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector: selector:
{{ tuple $envAll "prometheus_mysql_exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ tuple $envAll "prometheus_mysql_exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }} {{- end }}

View File

@ -226,8 +226,6 @@ dependencies:
- endpoint: internal - endpoint: internal
service: oslo_db service: oslo_db
force_bootstrap: false
volume: volume:
chown_on_start: true chown_on_start: true
enabled: true enabled: true
@ -271,24 +269,19 @@ conf:
--single-transaction --quick --skip-opt --single-transaction --quick --skip-opt
--add-drop-database --add-drop-table --databases --add-drop-database --add-drop-table --databases
days_of_backup_to_keep: 3 days_of_backup_to_keep: 3
database:
database: config_override: null
config_override: null # Any configuration here will override the base config.
# Any configuration here will override the base config. # config_override: |-
# config_override: |- # [mysqld]
# [mysqld] # wsrep_slave_threads=1
# wsrep_slave_threads=1
monitoring: monitoring:
prometheus: prometheus:
enabled: false enabled: true
mysqld_exporter: mysqld_exporter:
scrape: true scrape: true
network:
prometheus_mysql_exporter:
port: 9104
# typically overridden by environmental # typically overridden by environmental
# values, but should include all endpoints # values, but should include all endpoints
# required by this chart # required by this chart