diff --git a/charts/sal/.helmignore b/charts/nebulous-sal/.helmignore similarity index 100% rename from charts/sal/.helmignore rename to charts/nebulous-sal/.helmignore diff --git a/charts/sal/Chart.yaml b/charts/nebulous-sal/Chart.yaml similarity index 96% rename from charts/sal/Chart.yaml rename to charts/nebulous-sal/Chart.yaml index 859294d..d94d450 100644 --- a/charts/sal/Chart.yaml +++ b/charts/nebulous-sal/Chart.yaml @@ -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. @@ -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" diff --git a/charts/sal/templates/_helpers.tpl b/charts/nebulous-sal/templates/_helpers.tpl similarity index 73% rename from charts/sal/templates/_helpers.tpl rename to charts/nebulous-sal/templates/_helpers.tpl index 4c14810..c68b167 100644 --- a/charts/sal/templates/_helpers.tpl +++ b/charts/nebulous-sal/templates/_helpers.tpl @@ -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 }} @@ -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 }} @@ -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 }} @@ -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 }} diff --git a/charts/nebulous-sal/templates/deployment.yaml b/charts/nebulous-sal/templates/deployment.yaml new file mode 100644 index 0000000..08ce764 --- /dev/null +++ b/charts/nebulous-sal/templates/deployment.yaml @@ -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 }} diff --git a/charts/nebulous-sal/templates/secret-mariadb.yaml b/charts/nebulous-sal/templates/secret-mariadb.yaml new file mode 100644 index 0000000..3639a48 --- /dev/null +++ b/charts/nebulous-sal/templates/secret-mariadb.yaml @@ -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 }} diff --git a/charts/nebulous-sal/templates/secret-pws.yaml b/charts/nebulous-sal/templates/secret-pws.yaml new file mode 100644 index 0000000..6b6c57d --- /dev/null +++ b/charts/nebulous-sal/templates/secret-pws.yaml @@ -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 }} diff --git a/charts/nebulous-sal/templates/service-pda.yaml b/charts/nebulous-sal/templates/service-pda.yaml new file mode 100644 index 0000000..14b1e0b --- /dev/null +++ b/charts/nebulous-sal/templates/service-pda.yaml @@ -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 }} diff --git a/charts/nebulous-sal/templates/service.yaml b/charts/nebulous-sal/templates/service.yaml new file mode 100644 index 0000000..a339e19 --- /dev/null +++ b/charts/nebulous-sal/templates/service.yaml @@ -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 }} diff --git a/charts/nebulous-sal/values.yaml b/charts/nebulous-sal/values.yaml new file mode 100644 index 0000000..6012ebf --- /dev/null +++ b/charts/nebulous-sal/values.yaml @@ -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 diff --git a/charts/sal/templates/NOTES.txt b/charts/sal/templates/NOTES.txt deleted file mode 100644 index 9e1218b..0000000 --- a/charts/sal/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -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 }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sal.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 "sal.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sal.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 "sal.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 -{{- end }} diff --git a/charts/sal/templates/deployment.yaml b/charts/sal/templates/deployment.yaml deleted file mode 100644 index a8d2bf9..0000000 --- a/charts/sal/templates/deployment.yaml +++ /dev/null @@ -1,61 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sal-all-flux -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: sal-flux - template: - metadata: - labels: - app: sal-flux - spec: - containers: - - name: mariadb - image: {{ .Values.image.mariadb }} - ports: - - containerPort: 3306 - env: - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: sal-mariadb-root-credentials-flux - key: mysql-root-password - - name: MYSQL_DATABASE - value: {{ .Values.mariadb.database }} - - name: sal - image: {{ .Values.image.sal }} - imagePullPolicy: Always - ports: - - containerPort: 8080 - - containerPort: 9001 - env: - - name: MYSQL_DATABASE - value: {{ .Values.mariadb.database }} - - name: PROPERTIES_FILENAME - value: {{ .Values.sal.propertiesFilename }} - - name: PWS_URL - value: {{ .Values.sal.pwsUrl }} - - name: PWS_USERNAME - value: {{ .Values.sal.pwsUsername }} - - name: PWS_PASSWORD - value: {{ .Values.sal.pwsPassword }} - - name: DB_USERNAME - value: "root" - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: sal-mariadb-root-credentials-flux - key: mysql-root-password - - name: DB_DRIVER_CLASSNAME - value: {{ .Values.sal.dbDriverClassname }} - - name: DB_URL - value: "jdbc:mariadb://localhost:3306/{{ .Values.mariadb.database }}" - - name: DB_PLATFORM - value: {{ .Values.sal.dbPlatform }} - - name: JPDA_ADDRESS - value: {{ .Values.sal.jpdaAddress }} - - name: JPDA_TRANSPORT - value: {{ .Values.sal.jpdaTransport }} diff --git a/charts/sal/templates/secret.yaml b/charts/sal/templates/secret.yaml deleted file mode 100644 index 8013cd2..0000000 --- a/charts/sal/templates/secret.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: sal-mariadb-root-credentials-flux -type: Opaque -data: - mysql-root-password: {{ .Values.mariadb.rootPassword | b64enc | quote }} diff --git a/charts/sal/templates/service-pda.yaml b/charts/sal/templates/service-pda.yaml deleted file mode 100644 index 5c9dbde..0000000 --- a/charts/sal/templates/service-pda.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sal-pda-flux -spec: - type: ClusterIP - ports: - - port: {{ .Values.service.pda.port }} - targetPort: 9001 - selector: - app: sal-flux diff --git a/charts/sal/templates/service.yaml b/charts/sal/templates/service.yaml deleted file mode 100644 index 87c35e4..0000000 --- a/charts/sal/templates/service.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: sal-flux -spec: - type: ClusterIP - ports: - - port: {{ .Values.service.sal.port }} - targetPort: 8080 - selector: - app: sal-flux diff --git a/charts/sal/values.yaml b/charts/sal/values.yaml deleted file mode 100644 index a4782da..0000000 --- a/charts/sal/values.yaml +++ /dev/null @@ -1,96 +0,0 @@ -replicaCount: 1 - -image: - mariadb: mariadb - sal: alijawad/sal:sql-fix - repository: nginx - pullPolicy: IfNotPresent - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - create: false - automount: true - annotations: {} - name: "" - -podAnnotations: {} -podLabels: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - sal: - port: 8080 - pda: - port: 9001 - -ingress: - enabled: false - className: "" - annotations: {} - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - -resources: {} - -livenessProbe: - httpGet: - path: / - port: http - -readinessProbe: - httpGet: - path: / - port: http - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - -volumes: [] - -volumeMounts: [] - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -mariadb: - host: "sal-mariadb-root-credentials-flux" - rootPassword: YWN0aXZlZW9u - database: proactive - -sal: - propertiesFilename: sal - pwsUrl: http://158.39.77.68:8880/ - pwsUsername: admin - pwsPassword: admin - dbUsername: root - dbDriverClassname: org.mariadb.jdbc.Driver - dbUrl: jdbc:mariadb://127.0.0.1:3306/proactive - dbPlatform: org.hibernate.dialect.MariaDB53Dialect - jpdaAddress: "9001" - jpdaTransport: dt_socket