-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PM-1753 implement web and api deployments for leaderboard (#220)
* PM-1753 implement web and api deployments for leaderboard * PM-1753 quote env variables * PM-1753 configure flask to listen on all interfaces * PM-1753 make swagger url configurable * PM-1753 move ingress paths to a helm chart
- Loading branch information
Showing
8 changed files
with
394 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
delegation-program-leaderboard/templates/deployment-api.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "delegation-program-leaderboard.fullname" . }}-api | ||
labels: | ||
{{- include "delegation-program-leaderboard.labels" . | nindent 4 }}-api | ||
spec: | ||
{{- with .Values.leaderboardApi }} | ||
replicas: {{ .replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "delegation-program-leaderboard.selectorLabels" $ | nindent 6 }}-api | ||
template: | ||
metadata: | ||
{{- with .podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "delegation-program-leaderboard.selectorLabels" $ | nindent 8 }}-api | ||
spec: | ||
{{- with .imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "delegation-program-leaderboard.serviceAccountName" $ }} | ||
securityContext: | ||
{{- toYaml .podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: leaderboard-api | ||
securityContext: | ||
{{- toYaml .securityContext | nindent 12 }} | ||
image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}" | ||
imagePullPolicy: {{ .image.pullPolicy }} | ||
env: | ||
- name: SNARK_HOST | ||
value: {{ $.Values.delegationProgramDB.host | quote }} | ||
- name: SNARK_PORT | ||
value: {{ $.Values.delegationProgramDB.port | quote }} | ||
- name: SNARK_USER | ||
value: {{ $.Values.delegationProgramDB.user | quote }} | ||
- name: SNARK_PASSWORD | ||
value: {{ $.Values.delegationProgramDB.password | quote }} | ||
- name: SNARK_DB | ||
value: {{ $.Values.delegationProgramDB.name | quote }} | ||
- name: API_HOST | ||
value: 0.0.0.0 | ||
- name: API_PORT | ||
value: {{ .service.port | quote }} | ||
- name: CACHE_TIMEOUT | ||
value: {{ .cacheTimeout | quote }} | ||
- name: LOGGING_LOCATION | ||
value: {{ .logFile }} | ||
- name: SWAGGER_HOST | ||
value: {{ .swaggerUrl | quote }} | ||
{{- if .extraEnvVars }} | ||
{{- toYaml .extraEnvVars | nindent 12 }} | ||
{{- end }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /apidocs | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: /apidocs | ||
port: http | ||
resources: | ||
{{- toYaml .resources | nindent 12 }} | ||
{{- with .nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
{{- if .Values.autoscaling.enabled }} | ||
{{- if .Values.leaderboardWeb.autoscaling.enabled }} | ||
apiVersion: autoscaling/v2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ include "delegation-program-leaderboard.fullname" . }} | ||
name: {{ include "delegation-program-leaderboard.fullname" . }}-web | ||
labels: | ||
{{- include "delegation-program-leaderboard.labels" . | nindent 4 }} | ||
{{- include "delegation-program-leaderboard.labels" . | nindent 4 }}-web | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ include "delegation-program-leaderboard.fullname" . }} | ||
minReplicas: {{ .Values.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||
name: {{ include "delegation-program-leaderboard.fullname" . }}-web | ||
minReplicas: {{ .Values.leaderboardWeb.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.leaderboardWeb.autoscaling.maxReplicas }} | ||
metrics: | ||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
{{- if .Values.leaderboardWeb.autoscaling.targetCPUUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
averageUtilization: {{ .Values.leaderboardWeb.autoscaling.targetCPUUtilizationPercentage }} | ||
{{- end }} | ||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
{{- if .Values.leaderboardWeb.autoscaling.targetMemoryUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: memory | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
averageUtilization: {{ .Values.leaderboardWeb.autoscaling.targetMemoryUtilizationPercentage }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...rogram-leaderboard/templates/service.yaml → ...am-leaderboard/templates/service-api.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "delegation-program-leaderboard.fullname" . }} | ||
name: {{ include "delegation-program-leaderboard.fullname" . }}-api | ||
labels: | ||
{{- include "delegation-program-leaderboard.labels" . | nindent 4 }} | ||
{{- include "delegation-program-leaderboard.labels" . | nindent 4 }}-api | ||
spec: | ||
type: {{ .Values.service.type }} | ||
type: {{ .Values.leaderboardApi.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
- port: {{ .Values.leaderboardApi.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "delegation-program-leaderboard.selectorLabels" . | nindent 4 }} | ||
{{- include "delegation-program-leaderboard.selectorLabels" . | nindent 4 }}-api |
Oops, something went wrong.