Skip to content

ENG-935: Added deployment template #178

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions helm/prenet-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,61 @@ extraEnvVars:
value: "/dns/polybase-rust-0.polybase-rust-headless.polybase.svc.cluster.local/tcp/5001,/dns/polybase-rust-1.polybase-rust-headless.polybase.svc.cluster.local/tcp/5001,/dns/polybase-rust-2.polybase-rust-headless.polybase.svc.cluster.local/tcp/5001"
- name: MIGRATION_BATCH_SIZE
value: "2000"

deployments:
- name: gateway
labels:
app: polybase
replicaCount: 4
command: run
imagePullPolicy: Always
podSecurityContext: false
livenessProbe:
enabled: false
readinessProbe:
enabled: false
startupProbe:
enabled: false
containerPorts:
public_api: 80
p2p: 8080
cloudsql:
usePrivateIP: true
project: prenet
region: us-central1
db_instance: polybase
image: sql_proxy
tag: 1.0.0
- name: indexer
labels:
app: polybase
replicaCount: 16
command: run
imagePullPolicy: Always
podSecurityContext: false
livenessProbe:
enabled: false
readinessProbe:
enabled: false
startupProbe:
enabled: false
containerPorts:
public_api: 80
p2p: 8080
- name: prover
labels:
app: polybase
replicaCount: 5
command: run
imagePullPolicy: Always
podSecurityContext: false
livenessProbe:
enabled: false
readinessProbe:
enabled: false
startupProbe:
enabled: false
containerPorts:
public_api: 80
p2p: 8080

127 changes: 127 additions & 0 deletions helm/templates/deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{{- range .Values.deployments }}

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .name }}
namespace: {{ $.Release.Namespace | quote }}
labels:
{{- if .labels }}
{{- toYaml .labels | nindent 4}}
{{- end }}
{{- if .commonAnnotations }}
annotations: {{- include "polybase.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "polybase.labels" $ | nindent 8 }}
replicas: {{ .replicaCount }}
template:
metadata:
labels:
{{- include "polybase.labels" $ | nindent 8 }}
{{- if .podLabels }}
{{- toYaml .podLabels | nindent 8 }}
{{- end }}
{{- if or .podAnnotations }}
annotations:
{{- if .podAnnotations }}
{{- toYaml .podAnnotations | nindent 8 }}
{{- end }}
{{- end }}
spec:
{{- if .nodeSelector }}
nodeSelector: {{- include "polybase.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .tolerations }}
tolerations: {{- include "polybase.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
{{- end }}
containers:
- name: {{ .name }}
command: {{ .command }}
{{- if .args }}
args: {{ .args }}
{{- end }}
image: {{ include "polybase.main_image" $ }}
imagePullPolicy: {{ .imagePullPolicy | quote }}
env:
{{- if .extraEnvVars }}
{{- include "polybase.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 10 }}
{{- end }}
{{- if .customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: {{ .livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .livenessProbe.periodSeconds }}
timeoutSeconds: {{ .livenessProbe.timeoutSeconds }}
successThreshold: {{ .livenessProbe.successThreshold }}
failureThreshold: {{ .livenessProbe.failureThreshold }}
{{- end }}
{{- if .customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /v0/health
port: 8080
initialDelaySeconds: {{ .readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .readinessProbe.periodSeconds }}
timeoutSeconds: {{ .readinessProbe.timeoutSeconds }}
successThreshold: {{ .readinessProbe.successThreshold }}
failureThreshold: {{ .readinessProbe.failureThreshold }}
{{- end }}
{{- if .customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
{{- else if .startupProbe.enabled }}
startupProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: {{ .startupProbe.initialDelaySeconds }}
periodSeconds: {{ .startupProbe.periodSeconds }}
timeoutSeconds: {{ .startupProbe.timeoutSeconds }}
successThreshold: {{ .startupProbe.successThreshold }}
failureThreshold: {{ .startupProbe.failureThreshold }}
{{- end }}
ports:
- name: public-api
containerPort: {{ .containerPorts.public_api | default "8080" }}
{{- if .hostNetwork }}
hostPort: {{ .containerPorts.public_api }}
{{- end }}
- name: p2p
containerPort: {{ .containerPorts.p2p | default "5001" }}
{{- if .hostNetwork }}
hostPort: {{ .containerPorts.p2p }}
{{- end }}
{{- if .resources }}
resources: {{ toYaml .resources | nindent 12 }}
{{- end }}

#cloudsql
{{- if .cloudsql }}
- name: {{ .name }}-sql-proxy
args:
{{- if .cloudsql.credentialFile }}
- --credentials-file={{ .cloudsql.credentialFile }}
{{- end }}
{{- if .cloudsql.usePrivateIP }}
- --private-ip
{{- end }}
- --max-sigterm-delay={{ .cloudsql.timeout | default "30s" }}
- "{{ .project }}:{{ .cloudsql.region }}:{{ .cloudsql.db_instance }}"
image: {{ .cloudsql.image }}:{{ .cloudsql.tag }}
imagePullPolicy: IfNotPresent
securityContext:
{{- toYaml .cloudsql.securityContext | nindent 12 }}
resources:
{{- toYaml .cloudsql.resources | nindent 12 }}
{{- end }}
{{- end }}