Skip to content

Commit

Permalink
Added Http Health Check and Topology Constraints (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelotinho authored Jan 14, 2022
1 parent 3be5cd1 commit 2d7fd38
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/gcloud-sqlproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ name: gcloud-sqlproxy
sources:
- https://github.com/rimusz/charts
type: application
version: 0.22.3
version: 0.22.4
10 changes: 10 additions & 0 deletions stable/gcloud-sqlproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ The following table lists the configurable parameters of the `gcloud-sqlproxy` c
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
| `useStatefulset` | Deploy as a statefulset rather than a deployment | false |
| `httpReadinessProbe.enabled` | Enables http readiness probe | `false` |
| `httpReadinessProbe.port` | Overrides the default http port | 8090 |
| `httpLivenessProbe.enabled` | Enables http liveness probe | `false` |
| `httpLivenessProbe.port` | Overrides the default http port | 8090 |
| `topologyConstraints.enabled` | Flag to toggle pod topology constraints. | `false` |
| `topologyConstraints.maxSkew` | Uneven pod distribution | 1 |
| `topologyConstraints.topologyKey` | Node label Key | `""` |
| `topologyConstraints.whenNotSatisfied` | Pod handling for unsatisfactory spread constraint | 8090 |
| `topologyConstraints.labels` | Pod Label Selector | `{}` |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Expand Down
27 changes: 27 additions & 0 deletions stable/gcloud-sqlproxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ spec:
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
spec:
{{- if .Values.topologyConstraints.enabled }}
topologySpreadConstraints:
- maxSkew: {{ .Values.topologyConstraints.maxSkew }}
topologyKey: {{ .Values.topologyConstraints.topologyKey }}
whenUnsatisfiable: {{ .Values.topologyConstraints.whenNotSatisfied }}
labelSelector:
matchLabels:
{{- include "common.tplvalues.render" (dict "value" .Values.topologyConstraints.labels "context" $) | nindent 12 }}
{{- end }}
serviceAccountName: {{ template "gcloud-sqlproxy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
Expand All @@ -51,6 +60,12 @@ spec:
{{ toYaml .Values.resources | indent 10 }}
command:
- /cloud_sql_proxy
{{- if .Values.httpLivenessProbe.enabled }}
- -use_http_health_check
{{- if ne (int .Values.httpLivenessProbe.port) 8090 }}
- -health_check_port={{ .Values.httpLivenessProbe.port }}
{{- end }}
{{- end }}
- --dir=/cloudsql
- -instances={{- range .Values.cloudsql.instances -}}
{{ .project }}:{{ .region }}:{{ .instance }}=tcp:0.0.0.0:{{ .port }},
Expand All @@ -73,8 +88,14 @@ spec:
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.httpLivenessProbe.enabled }}
httpGet:
path: /liveness/
port: {{ .Values.httpLivenessProbe.port }}
{{- else }}
tcpSocket:
port: {{ .Values.livenessProbe.port }}
{{- end }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
Expand All @@ -83,8 +104,14 @@ spec:
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.httpReadinessProbe.enabled }}
httpGet:
path: /readiness/
port: {{ .Values.httpReadinessProbe.port }}
{{- else }}
tcpSocket:
port: {{ .Values.readinessProbe.port }}
{{- end }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
Expand Down
18 changes: 18 additions & 0 deletions stable/gcloud-sqlproxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ livenessProbe:
failureThreshold: 18
successThreshold: 1


# Http Liveness Probe if enabled will override default tcp port check
httpLivenessProbe:
enabled: false
port: 8090

# Http Readiness Probe if enabled will override default tcp port check
httpReadinessProbe:
enabled: false
port: 8090

readinessProbe:
enabled: false
port: 5432
Expand Down Expand Up @@ -186,3 +197,10 @@ podDisruptionBudget: |
## Uncomment the term_timeout line for the proxy to wait your chosen time before terminating connections
extraArgs: {}
# term_timeout: 30s

topologyConstraints:
enabled: false
maxSkew: 1
topologyKey: ""
whenNotSatisfied: "DoNotSchedule"
labels: {}

0 comments on commit 2d7fd38

Please sign in to comment.