-
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.
Update from dscc-admin-ch/lomas@284686c
- Loading branch information
dscc-admin-ch
committed
Jun 5, 2024
1 parent
71d7b4c
commit 4f6808e
Showing
22 changed files
with
838 additions
and
395 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
The Lomas service was successfully deployed! | ||
|
||
1. From within your namespace, the server is available at | ||
|
||
{{ include "lomas.server.fullname" . -}}:{{- .Values.server.service.port}} | ||
|
||
{{- if .Values.server.ingress.enabled }} | ||
|
||
Since server ingress was enabled, the application is also reachable from the internet at: | ||
|
||
http{{ if $.Values.server.ingress.tls }}s{{ end }}://{{ .Values.server.ingress.hostname }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "lomas_server.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "lomas_server.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "lomas_server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "lomas_server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
|
||
|
||
{{- if .Values.dashboard.create }} | ||
|
||
2. From within your namespace, the admin dashboard is available at | ||
|
||
{{ include "lomas.dashboard.fullname" . -}}:{{- .Values.dashboard.service.port}} | ||
|
||
{{- if .Values.dashboard.ingress.enabled }} | ||
|
||
Since dashboard ingress was enabled, the administration dashboard is also reachable from the internet at | ||
|
||
http{{ if $.Values.dashboard.ingress.tls }}s{{ end }}://{{ .Values.dashboard.ingress.hostname }}/about | ||
{{- 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "lomas.dashboard.name" -}} | ||
dashboard | ||
{{- end }} | ||
|
||
{{/* | ||
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 "lomas.dashboard.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- printf "%s-dashboard" .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s-dashboard" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "lomas.dashboard.labels" -}} | ||
helm.sh/chart: {{ include "lomas.chart" . }} | ||
{{ include "lomas.dashboard.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "lomas.dashboard.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "lomas.dashboard.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "lomas.dashboard.serviceAccountName" -}} | ||
{{- if .Values.dashboard.serviceAccount.create }} | ||
{{- default (include "lomas.dashboard.fullname" .) .Values.dashboard.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.dashboard.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/lomas_server/templates/dashboard/dashboard_configmap.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,14 @@ | ||
{{- if .Values.dashboard.create -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
{{- $fullname := include "lomas.dashboard.fullname" . }} | ||
name: {{ printf "%s-dashboard-config" $fullname }} | ||
labels: | ||
{{- include "lomas.dashboard.labels" . | nindent 4 }} | ||
data: | ||
{{- $service_name := include "lomas.server.fullname" . }} | ||
dashboard.yaml: | | ||
server_url: {{ .Values.server.ingress.hostname }} | ||
server_service: "http://{{- $service_name -}}:{{- .Values.server.service.port }}" | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/lomas_server/templates/dashboard/dashboard_server_configmap.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,14 @@ | ||
{{- if .Values.dashboard.create -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
{{- $fullname := include "lomas.dashboard.fullname" . }} | ||
name: {{ printf "%s-server-config" $fullname }} | ||
labels: | ||
{{- include "lomas.dashboard.labels" . | nindent 4 }} | ||
data: | ||
config.toml: | | ||
[server] | ||
address="{{ .Values.dashboard.serverConfig.address }}" | ||
port="{{ .Values.dashboard.serverConfig.port }}" | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{{- if .Values.dashboard.create -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "lomas.dashboard.fullname" . }} | ||
labels: | ||
{{- include "lomas.dashboard.labels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "lomas.dashboard.selectorLabels" . | nindent 6 }} | ||
replicas: 1 | ||
template: | ||
metadata: | ||
{{- with .Values.dashboard.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "lomas.dashboard.selectorLabels" . | nindent 8 }} | ||
spec: | ||
serviceAccountName: {{ include "lomas.dashboard.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.dashboard.podSecurityContext | nindent 8 }} | ||
|
||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.dashboard.securityContext | nindent 12 }} | ||
image: "{{ .Values.dashboard.image.repository }}:{{ .Values.dashboard.image.tag }}" | ||
imagePullPolicy: {{ .Values.dashboard.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.dashboard.serverConfig.port }} | ||
protocol: TCP | ||
volumeMounts: | ||
- name: server-config-and-secrets | ||
readOnly: True | ||
mountPath: "/usr/lomas_server/" | ||
- name: dashboard-config | ||
readOnly: True | ||
mountPath: "/usr/lomas_dashboard/" | ||
- name: dashboard-server-config | ||
readOnly: True | ||
mountPath: "/code/.streamlit/" | ||
resources: | ||
{{- toYaml .Values.dashboard.resources | nindent 12 }} | ||
volumes: | ||
- name: server-config-and-secrets | ||
projected: | ||
sources: | ||
- secret: | ||
name: {{ include "lomas.server.fullname" . }} | ||
- configMap: | ||
name: {{ include "lomas.server.fullname" . }} | ||
{{- $fullname := include "lomas.dashboard.fullname" . }} | ||
- name: dashboard-config | ||
projected: | ||
sources: | ||
- configMap: | ||
name: {{ printf "%s-dashboard-config" $fullname }} | ||
- name: dashboard-server-config | ||
projected: | ||
sources: | ||
- configMap: | ||
name: {{ printf "%s-server-config" $fullname }} | ||
{{- with .Values.dashboard.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.dashboard.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.dashboard.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{{- if .Values.dashboard.create -}} | ||
{{- if .Values.dashboard.ingress.enabled -}} | ||
{{/* | ||
These two are defined as such because calling . within a range loop | ||
is shortcut for path (see https://stackoverflow.com/questions/72484286/ingress-variables-syntax-from-values-yaml) | ||
*/}} | ||
{{ "\n" }} | ||
{{- $fullName := include "lomas.dashboard.fullname" . -}} | ||
{{- $svcPort := .Values.dashboard.service.port -}} | ||
{{- if and .Values.dashboard.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
{{- if not (hasKey .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class") }} | ||
{{- $_ := set .Values.dashboard.ingress.annotations "kubernetes.io/ingress.class" .Values.dashboard.ingress.className}} | ||
{{- end }} | ||
{{- end }} | ||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1 | ||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "lomas.dashboard.labels" . | nindent 4 }} | ||
{{- with .Values.dashboard.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.dashboard.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.dashboard.ingress.className }} | ||
{{- end }} | ||
{{- if .Values.dashboard.ingress.tls }} | ||
tls: | ||
- hosts: | ||
- {{ .Values.dashboard.ingress.hostname | quote }} | ||
{{- end }} | ||
rules: | ||
- host: {{ .Values.dashboard.ingress.hostname | quote }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- else }} | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $svcPort }} | ||
{{- end }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if .Values.dashboard.create -}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "lomas.dashboard.fullname" . }} | ||
labels: | ||
{{- include "lomas.dashboard.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.dashboard.service.type }} | ||
ports: | ||
- port: {{ .Values.dashboard.service.port}} | ||
targetPort: {{ .Values.dashboard.serverConfig.port }} | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "lomas.dashboard.selectorLabels" . | nindent 4 }} | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/lomas_server/templates/dashboard/serviceaccount.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,14 @@ | ||
{{- if .Values.dashboard.create -}} | ||
{{- if .Values.dashboard.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "lomas_admin_dashboard.serviceAccountName" . }} | ||
labels: | ||
{{- include "lomas_admin_dashboard.labels" . | nindent 4 }} | ||
{{- with .Values.dashboard.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.