-
Notifications
You must be signed in to change notification settings - Fork 38
feat: deploy cloud-sql-proxy in its down deployment #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{{ if .Values.controlplane.sqlProxy.enabled }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "chainloop.sql-proxy.fullname" . }} | ||
labels: | ||
{{- include "chainloop.sql-proxy.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
{{- include "chainloop.sql-proxy.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/default-container: cloud-sql-proxy | ||
labels: | ||
{{- include "chainloop.sql-proxy.selectorLabels" . | nindent 8 }} | ||
spec: | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: controlplane | ||
topologyKey: kubernetes.io/hostname | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the topology key required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it is indeed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
{{- with .Values.controlplane.image.pullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "controlplane.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.controlplane.podSecurityContext | nindent 8 }} | ||
containers: | ||
|
||
- name: cloud-sql-proxy | ||
# It is recommended to use the latest version of the Cloud SQL proxy | ||
# Make sure to update on a regular schedule! | ||
image: gcr.io/cloudsql-docker/gce-proxy:1.33.10 # make sure the use the latest version | ||
command: | ||
- "/cloud_sql_proxy" | ||
# If connecting from a VPC-native GKE cluster, you can use the | ||
# following flag to have the proxy connect over private IP | ||
# - "-ip_address_types=PRIVATE" | ||
|
||
# By default, the proxy will write all logs to stderr. In some | ||
# environments, anything printed to stderr is consider an error. To | ||
# disable this behavior and write all logs to stdout (except errors | ||
# which will still go to stderr), use: | ||
- "-log_debug_stdout" | ||
- "-instances={{ .Values.controlplane.sqlProxy.connectionName }}=tcp:0.0.0.0:5432" | ||
securityContext: | ||
runAsNonRoot: true | ||
resources: | ||
{{- toYaml .Values.controlplane.sqlProxy.resources | nindent 12 }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{ if .Values.controlplane.sqlProxy.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "chainloop.sql-proxy.fullname" . }} | ||
labels: | ||
{{- include "chainloop.sql-proxy.labels" . | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: {{ .Values.controlplane.externalDatabase.port }} | ||
targetPort: {{ .Values.controlplane.externalDatabase.port }} | ||
protocol: TCP | ||
name: tpc | ||
selector: | ||
{{- include "chainloop.sql-proxy.selectorLabels" . | nindent 4 }} | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the affinity code might look like
but I think it will only guarantee that one of the controlplane replicas will have a proxy in the same node, not that both replicas have it.
In any case I believe it is still worth it and we can just keep an eye on it. WDYT?