Skip to content

Commit

Permalink
Continue rename from code.org => dashboard for the service
Browse files Browse the repository at this point in the history
  • Loading branch information
snickell committed Sep 6, 2023
1 parent d831dd4 commit ee2e813
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
20 changes: 10 additions & 10 deletions k8s/code.org/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "code.org.name" -}}
{{- define "dashboard.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "code.org.fullname" -}}
{{- define "dashboard.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "code.org.chart" -}}
{{- define "dashboard.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "code.org.labels" -}}
helm.sh/chart: {{ include "code.org.chart" . }}
{{ include "code.org.selectorLabels" . }}
{{- define "dashboard.labels" -}}
helm.sh/chart: {{ include "dashboard.chart" . }}
{{ include "dashboard.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "code.org.selectorLabels" -}}
app.kubernetes.io/name: {{ include "code.org.name" . }}
{{- define "dashboard.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "code.org.serviceAccountName" -}}
{{- define "dashboard.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "code.org.fullname" .) .Values.serviceAccount.name }}
{{- default (include "dashboard.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions k8s/code.org/helm/templates/autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "code.org.fullname" . }}
name: {{ include "dashboard.fullname" . }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "code.org.fullname" . }}
name: {{ include "dashboard.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
Expand Down
20 changes: 10 additions & 10 deletions k8s/code.org/helm/templates/dashboard.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "code.org.fullname" . }}
name: {{ include "dashboard.fullname" . }}
labels:
{{- include "code.org.labels" . | nindent 4 }}
{{- include "dashboard.labels" . | nindent 4 }}
spec:
selector:
{{- include "code.org.selectorLabels" . | nindent 4 }}
{{- include "dashboard.selectorLabels" . | nindent 4 }}
ports:
- protocol: TCP
port: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "code.org.fullname" . }}
name: {{ include "dashboard.fullname" . }}
labels:
{{- include "code.org.labels" . | nindent 4 }}
{{- include "dashboard.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "code.org.selectorLabels" . | nindent 6 }}
{{- include "dashboard.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "code.org.selectorLabels" . | nindent 8 }}
{{- include "dashboard.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: dashboard
Expand All @@ -45,7 +45,7 @@ spec:
name: aws-google
subPath: gcloud
- mountPath: /code-dot-org/locals.yml
name: dashboard
name: dashboard-locals
subPath: locals.yml
# FIXME: THIS IS FOR DEBUGGING PURPOSES
- mountPath: /mnt/aws-google
Expand Down Expand Up @@ -74,9 +74,9 @@ spec:
- name: aws-config
secret:
secretName: aws-config
- name: dashboard
- name: dashboard-locals
configMap:
name: dashboard
name: dashboard-locals

securityContext:
# these should match the UID/GID defined in code.org.dockerfile
Expand Down
4 changes: 3 additions & 1 deletion k8s/code.org/helm/templates/locals.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dashboard
name: {{ include "dashboard.fullname" . }}-locals
labels:
{{- include "dashboard.labels" . | nindent 4 }}
data:
locals.yml: |
# db_credential_admin: {"username":"code.org", "password":"FIXME_WITH_REAL_PASSWORD"}
Expand Down

0 comments on commit ee2e813

Please sign in to comment.