Skip to content

Commit

Permalink
Release nebulous-sal chart
Browse files Browse the repository at this point in the history
Content adapted from [1].
This follows our recommended way of deployment of components in NebulOuS.

Also, drop the old, broken "sal" chart.

[1] https://github.com/eu-nebulous/sal/tree/9dc84c467a9f49459c56edf2c74180f5b176aa05
  • Loading branch information
yoctozepto committed Jul 12, 2024
1 parent 9661a55 commit 06e788c
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 220 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions charts/sal/Chart.yaml → charts/nebulous-sal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: sal
name: nebulous-sal
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
appVersion: "1.0.0"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "sal.name" -}}
{{- define "nebulous-sal.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 "sal.fullname" -}}
{{- define "nebulous-sal.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 "sal.chart" -}}
{{- define "nebulous-sal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "sal.labels" -}}
helm.sh/chart: {{ include "sal.chart" . }}
{{ include "sal.selectorLabels" . }}
{{- define "nebulous-sal.labels" -}}
helm.sh/chart: {{ include "nebulous-sal.chart" . }}
{{ include "nebulous-sal.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 "sal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sal.name" . }}
{{- define "nebulous-sal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nebulous-sal.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "sal.serviceAccountName" -}}
{{- define "nebulous-sal.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "sal.fullname" .) .Values.serviceAccount.name }}
{{- default (include "nebulous-sal.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
148 changes: 148 additions & 0 deletions charts/nebulous-sal/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nebulous-sal.fullname" . }}
labels:
{{- include "nebulous-sal.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "nebulous-sal.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nebulous-sal.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: mariadb
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.mariadb.image.pullPolicy }}
resources:
{{- toYaml .Values.mariadb.resources | nindent 12 }}
ports:
- containerPort: 3306
name: mariadb
protocol: TCP
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "nebulous-sal.fullname" . }}-mariadb-credentials
key: mysql-root-password
- name: MYSQL_DATABASE
value: proactive
args: ["--wait_timeout=31536000"]
livenessProbe:
exec:
command:
- "/bin/sh"
- "-c"
- "mariadb-admin ping -h localhost --password=$MYSQL_ROOT_PASSWORD"
failureThreshold: 5
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
exec:
command:
- "/bin/sh"
- "-c"
- "mariadb-admin ping -h localhost --password=$MYSQL_ROOT_PASSWORD"
failureThreshold: 5
initialDelaySeconds: 30
periodSeconds: 30
- name: sal
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 9001
name: pda
protocol: TCP
env:
- name: MYSQL_DATABASE
value: proactive
- name: PROPERTIES_FILENAME
value: sal
- name: PWS_URL
value: {{ .Values.pws.url }}
- name: PWS_USERNAME
value: {{ .Values.pws.username }}
- name: PWS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "nebulous-sal.fullname" . }}-pws-credentials
key: pws-user-password
- name: DB_USERNAME
value: "root"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "nebulous-sal.fullname" . }}-mariadb-credentials
key: mysql-root-password
- name: DB_DRIVER_CLASSNAME
value: org.mariadb.jdbc.Driver
- name: DB_URL
value: jdbc:mariadb://127.0.0.1:3306/proactive
- name: DB_PLATFORM
value: org.hibernate.dialect.MariaDB53Dialect
- name: JPDA_ADDRESS
value: "9001"
- name: JPDA_TRANSPORT
value: dt_socket
volumeMounts:
- name: script-volume
mountPath: /usr/local/tomcat/scripts/
livenessProbe:
exec:
command:
- /bin/sh
- -c
- nc -z localhost 8080
failureThreshold: 5
initialDelaySeconds: 60
periodSeconds: 30
readinessProbe:
exec:
command:
- /bin/sh
- -c
- nc -z localhost 8080
failureThreshold: 5
initialDelaySeconds: 60
periodSeconds: 10
volumes:
- name: script-volume
configMap:
name: {{ .Values.scriptsConfigMap }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/nebulous-sal/templates/secret-mariadb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "nebulous-sal.fullname" . }}-mariadb-credentials
labels:
{{- include "nebulous-sal.labels" . | nindent 4 }}
type: Opaque
data:
mysql-root-password: {{ .Values.mariadb.rootPassword | b64enc | quote }}
9 changes: 9 additions & 0 deletions charts/nebulous-sal/templates/secret-pws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "nebulous-sal.fullname" . }}-pws-credentials
labels:
{{- include "nebulous-sal.labels" . | nindent 4 }}
type: Opaque
data:
pws-user-password: {{ .Values.pws.password | b64enc | quote }}
15 changes: 15 additions & 0 deletions charts/nebulous-sal/templates/service-pda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "nebulous-sal.fullname" . }}-pda
labels:
{{- include "nebulous-sal.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.pdaPort }}
targetPort: pda
protocol: TCP
name: pda
selector:
{{- include "nebulous-sal.selectorLabels" . | nindent 4 }}
15 changes: 15 additions & 0 deletions charts/nebulous-sal/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "nebulous-sal.fullname" . }}
labels:
{{- include "nebulous-sal.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "nebulous-sal.selectorLabels" . | nindent 4 }}
52 changes: 52 additions & 0 deletions charts/nebulous-sal/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
replicaCount: 1

image:
repository: activeeon/sal
pullPolicy: IfNotPresent
tag: "dev"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 8080
pdaPort: 9001

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

mariadb:
rootPassword: YWN0aXZlZW9u
image:
repository: mariadb
pullPolicy: IfNotPresent
tag: ""
securityContext: {}
resources: {}

# SAL config
pws:
url: ""
username: ""
password: ""
scriptsConfigMap: scripts-configmap
22 changes: 0 additions & 22 deletions charts/sal/templates/NOTES.txt

This file was deleted.

Loading

0 comments on commit 06e788c

Please sign in to comment.