Skip to content

Commit

Permalink
feat(prometheus-mysql-exporter)!: upgrade cloud-sql-proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Marcelo Clavel <[email protected]>
  • Loading branch information
mclavel committed Jul 13, 2023
1 parent 7b28323 commit e097274
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-mysql-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for prometheus mysql exporter with cloudsqlproxy
name: prometheus-mysql-exporter
version: 1.14.0
version: 2.0.0
home: https://github.com/prometheus/mysqld_exporter
appVersion: v0.14.0
sources:
Expand Down
18 changes: 18 additions & 0 deletions charts/prometheus-mysql-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
helm upgrade [RELEASE_NAME] [CHART] --install
```

### From 1.x to 2.x

This version uses [cloud-sql-proxy v2](https://github.com/GoogleCloudPlatform/cloud-sql-proxy/blob/main/migration-guide.md).

If you use `cloudsqlproxy.ipAddressTypes` to set private connections, please set `cloudsqlproxy.privateIp`.

```yaml
cloudsqlproxy:
ipAddressTypes: PRIVATE,PUBLIC
```
to:
```yaml
cloudsqlproxy:
privateIp: true
```
### To =< 1.0.0
Version 1.0.0 is a major update.
Expand Down
59 changes: 45 additions & 14 deletions charts/prometheus-mysql-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,52 @@ spec:
- name: cloudsql-proxy
image: "{{ .Values.cloudsqlproxy.image.repo }}:{{ .Values.cloudsqlproxy.image.tag }}"
imagePullPolicy: "{{ .Values.cloudsqlproxy.image.PullPolicy }}"
command: ["/cloud_sql_proxy"
,"-instances={{ .Values.cloudsqlproxy.instanceConnectionName }}=tcp:{{ .Values.cloudsqlproxy.port }}"
{{- if .Values.cloudsqlproxy.ipAddressTypes }}
,"-ip_address_types={{ .Values.cloudsqlproxy.ipAddressTypes }}"
{{- end }}
{{- if not .Values.cloudsqlproxy.workloadIdentity.enabled }}
,"-credential_file=/secrets/cloudsql/credentials.json"
{{- end }}
{{- if .Values.cloudsqlproxy.extraArgs }}
,"{{ .Values.cloudsqlproxy.extraArgs }}"
{{- end }}
]
args: ["{{ .Values.cloudsqlproxy.instanceConnectionName }}?port:{{ .Values.cloudsqlproxy.port }}"
,"--health-check"
,"--http-address=0.0.0.0"
,"--run-connection-test"
{{- if .Values.cloudsqlproxy.privateIp }}
,"--private-ip"
{{- end }}
{{- if not .Values.cloudsqlproxy.workloadIdentity.enabled }}
,"--credentials-file=/secrets/cloudsql/credentials.json"
{{- end }}
{{- if .Values.cloudsqlproxy.extraArgs }}
,"{{ .Values.cloudsqlproxy.extraArgs }}"
{{- end }}
]
livenessProbe:
exec:
command: ["nc", "-z", "127.0.0.1", "3306"]
httpGet:
path: /liveness
port: 9090
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 1
readinessProbe:
httpGet:
path: /readiness
port: 9090
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 1
startupProbe:
httpGet:
path: /startup
port: 9090
periodSeconds: 1
timeoutSeconds: 5
failureThreshold: 20
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsUser: 10000
runAsNonRoot: true
{{- if not .Values.cloudsqlproxy.workloadIdentity.enabled }}
volumeMounts:
- name: cloudsql-proxy-sa-credentials
Expand Down
6 changes: 3 additions & 3 deletions charts/prometheus-mysql-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ mysql:
cloudsqlproxy:
enabled: false
image:
repo: "gcr.io/cloudsql-docker/gce-proxy"
tag: "1.33.0-alpine"
repo: "gcr.io/cloud-sql-connectors/cloud-sql-proxy"
tag: "2.4.0"
pullPolicy: "IfNotPresent"
instanceConnectionName: "project:us-central1:dbname"
ipAddressTypes: ""
port: "3306"
privateIp: false
credentialsSecret: ""
# service account json
credentials: ""
Expand Down

0 comments on commit e097274

Please sign in to comment.