diff --git a/deploy/helm/.helmignore b/deploy/helm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/deploy/helm/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deploy/helm/Chart.yaml b/deploy/helm/Chart.yaml new file mode 100644 index 0000000..9229651 --- /dev/null +++ b/deploy/helm/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: opengist +description: Opengist chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "1.7.3" +maintainers: + - name: thomiceli + url: https://github.com/thomiceli \ No newline at end of file diff --git a/deploy/helm/README.md b/deploy/helm/README.md new file mode 100644 index 0000000..6fe1768 --- /dev/null +++ b/deploy/helm/README.md @@ -0,0 +1,81 @@ +# opengist + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=default) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=default) ![AppVersion: 1.7.3](https://img.shields.io/badge/AppVersion-1.7.3-informational?style=default) + +Opengist chart for Kubernetes + +## Maintainers + +| Name | Url | +| ---- | --- | +| thomiceli | | + +## Values + +| Key | Type | Default | +|-----|------|---------| +| affinity | object | `{}` | +| autoscaling.enabled | bool | `false` | +| autoscaling.maxReplicas | int | `100` | +| autoscaling.minReplicas | int | `1` | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | +| autoscaling.targetMemoryUtilizationPercentage | int | `80` | +| certManager.enabled | bool | `false` | +| certManager.issuer | string | `"letsencrypt-prod"` | +| config | object | `{}` | +| configSecret | object | `{}` | +| env | list | `[]` | +| extraVolumeMounts | list | `[]` | +| image.pullPolicy | string | `"IfNotPresent"` | +| image.repository | string | `"ghcr.io/thomiceli/opengist"` | +| image.tag | string | `""` | +| imagePullSecrets | list | `[]` | +| ingress.annotations | object | `{}` | +| ingress.className | string | `""` | +| ingress.enabled | bool | `false` | +| ingress.hosts[0].host | string | `"demo.opengist.io"` | +| ingress.hosts[0].paths[0].path | string | `"/"` | +| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | +| ingress.tls | list | `[]` | +| livenessProbe.enabled | bool | `true` | +| livenessProbe.failureThreshold | int | `10` | +| livenessProbe.initialDelaySeconds | int | `300` | +| livenessProbe.periodSeconds | int | `30` | +| livenessProbe.successThreshold | int | `1` | +| livenessProbe.timeoutSeconds | int | `3` | +| nodeSelector | object | `{}` | +| persistence.accessMode | string | `"ReadWriteOnce"` | +| persistence.enabled | bool | `true` | +| persistence.filestore_dir | string | `"/opengist"` | +| persistence.size | string | `"10Gi"` | +| podAnnotations | object | `{}` | +| podLabels | object | `{}` | +| podSecurityContext | object | `{}` | +| readinessProbe.enabled | bool | `true` | +| readinessProbe.failureThreshold | int | `2` | +| readinessProbe.initialDelaySeconds | int | `60` | +| readinessProbe.periodSeconds | int | `30` | +| readinessProbe.successThreshold | int | `1` | +| readinessProbe.timeoutSeconds | int | `3` | +| replicaCount | int | `1` | +| resources | object | `{}` | +| securityContext | object | `{}` | +| serviceAccount.annotations | object | `{}` | +| serviceAccount.automount | bool | `true` | +| serviceAccount.create | bool | `true` | +| serviceAccount.name | string | `""` | +| serviceHttp.annotations | object | `{}` | +| serviceHttp.port | int | `6157` | +| serviceHttp.type | string | `"ClusterIP"` | +| serviceSsh.annotations."metallb.universe.tf/allow-shared-ip" | string | `"opengist"` | +| serviceSsh.enabled | bool | `true` | +| serviceSsh.port | int | `2222` | +| serviceSsh.type | string | `"LoadBalancer"` | +| strategy.rollingUpdate.maxSurge | string | `"100%"` | +| strategy.rollingUpdate.maxUnavailable | int | `0` | +| strategy.type | string | `"RollingUpdate"` | +| tolerations | list | `[]` | +| volumes | list | `[]` | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/deploy/helm/templates/NOTES.txt b/deploy/helm/templates/NOTES.txt new file mode 100644 index 0000000..45a9386 --- /dev/null +++ b/deploy/helm/templates/NOTES.txt @@ -0,0 +1,22 @@ +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.serviceHttp.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "opengist.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.serviceHttp.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "opengist.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "opengist.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.serviceHttp.port }} +{{- else if contains "ClusterIP" .Values.serviceHttp.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "opengist.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/deploy/helm/templates/_helpers.tpl b/deploy/helm/templates/_helpers.tpl new file mode 100644 index 0000000..4c9ccc2 --- /dev/null +++ b/deploy/helm/templates/_helpers.tpl @@ -0,0 +1,73 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "opengist.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- 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 "opengist.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .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" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "opengist.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "opengist.labels" -}} +helm.sh/chart: {{ include "opengist.chart" . }} +{{ include "opengist.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "opengist.selectorLabels" -}} +app.kubernetes.io/name: {{ include "opengist.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "opengist.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "opengist.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Create image URI +*/}} +{{- define "opengist.image" -}} +{{- if .Values.image.digest -}} +{{- printf "%s@%s" .Values.image.repository .Values.image.digest -}} +{{- else -}} +{{- printf "%s:%s" .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/deploy/helm/templates/configmap.yaml b/deploy/helm/templates/configmap.yaml new file mode 100644 index 0000000..9079766 --- /dev/null +++ b/deploy/helm/templates/configmap.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "opengist.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: +{{ include "opengist.labels" . | indent 4 }} +data: + config.yml: |- +{{ tpl (.Values.config | toYaml) . | indent 4 }} + replace_secrets.sh: | + #!/bin/sh + set -e + config_file="/tmp/config/config.yml" + output_file="/config/config.yml" + + echo "Starting secret processing" + + # Copy the original config to the output location + cp "$config_file" "$output_file" + + # Process each secret file + for secret_file in /tmp/secrets/*; do + if [ -f "$secret_file" ]; then + key=$(basename "$secret_file") + value=$(cat "$secret_file") + echo "Processing secret: $key" + + if [ -s "$output_file" ] && [ "$(cat "$output_file")" != "null" ]; then + awk -v key="$key" -v value="$value" ' + $0 ~ "^"key":" { found=1; print key": "value; next } + { print } + END { if (!found) print key": "value } + ' "$output_file" > "${output_file}.tmp" && mv "${output_file}.tmp" "$output_file" + else + echo "$key: $value" > "$output_file" + fi + + fi + done + # Ensure the main container can read the config file + chmod 644 "$output_file" + echo "Permissions set on $output_file" diff --git a/deploy/helm/templates/deployment.yaml b/deploy/helm/templates/deployment.yaml new file mode 100644 index 0000000..58b7ee1 --- /dev/null +++ b/deploy/helm/templates/deployment.yaml @@ -0,0 +1,135 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "opengist.fullname" . }} + labels: + {{- include "opengist.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + strategy: + type: {{ .Values.strategy.type }} + {{- if eq .Values.strategy.type "RollingUpdate" }} + rollingUpdate: + maxSurge: {{ .Values.strategy.rollingUpdate.maxSurge }} + maxUnavailable: {{ .Values.strategy.rollingUpdate.maxUnavailable }} + {{- end }} + selector: + matchLabels: + {{- include "opengist.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- if .Values.podAnnotations }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} + labels: + {{- include "opengist.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + initContainers: + - name: init-config + image: busybox + command: [ "/bin/sh", "/scripts/replace_secrets.sh" ] + volumeMounts: + - name: config-template + mountPath: /tmp/config + - name: secret-config + mountPath: /tmp/secrets + readOnly: true + - name: scripts + mountPath: /scripts + - name: config + mountPath: /config + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "opengist.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: {{ include "opengist.image" $ }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.serviceHttp.port }} + protocol: TCP + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + {{- toYaml (omit .Values.livenessProbe "enabled") | nindent 12 }} + httpGet: + port: http + path: /healthcheck + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + {{- toYaml (omit .Values.readinessProbe "enabled") | nindent 12 }} + httpGet: + port: http + path: /healthcheck + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + envFrom: + - configMapRef: + name: {{ include "opengist.fullname" . }} + {{ with .Values.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: opengist-data + mountPath: {{ .Values.persistence.filestore_dir }} + - name: config + mountPath: /config.yml + subPath: config.yml + {{- if .Values.extraVolumeMounts }} + {{- toYaml .Values.extraVolumeMounts | nindent 12 }} + {{- end }} + volumes: + - name: opengist-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default ( include "opengist.fullname" . ) }} + {{- else }} + emptyDir: {} + {{- end }} + - name: config + emptyDir: {} + - name: config-template + configMap: + name: {{ include "opengist.fullname" . }} + - name: secret-config + secret: + secretName: {{ include "opengist.fullname" . }}-secret + - name: scripts + configMap: + name: {{ include "opengist.fullname" . }} + items: + - key: replace_secrets.sh + path: replace_secrets.sh + mode: 0755 + {{- if .Values.volumes }} + {{- toYaml .Values.volumes | nindent 8 }} + {{- end }} + {{- 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/deploy/helm/templates/hpa.yaml b/deploy/helm/templates/hpa.yaml new file mode 100644 index 0000000..3ae3d8a --- /dev/null +++ b/deploy/helm/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "opengist.fullname" . }} + labels: + {{- include "opengist.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "opengist.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/deploy/helm/templates/ingress.yaml b/deploy/helm/templates/ingress.yaml new file mode 100644 index 0000000..3fb7e18 --- /dev/null +++ b/deploy/helm/templates/ingress.yaml @@ -0,0 +1,72 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "opengist.fullname" . -}} +{{- $svcPort := .Values.serviceHttp.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.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 "opengist.labels" . | nindent 4 }} + annotations: + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.certManager.enabled }} + cert-manager.io/issuer: {{ .Values.certManager.issuer | quote }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if or .Values.ingress.tls .Values.certManager.enabled }} + tls: + {{- if .Values.certManager.enabled }} + - hosts: + {{- range .Values.ingress.hosts }} + - {{ .host | quote }} + {{- end }} + secretName: {{ $fullName }}-tls + {{- else }} + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-http + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-http + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/deploy/helm/templates/pvc.yaml b/deploy/helm/templates/pvc.yaml new file mode 100644 index 0000000..d95d94a --- /dev/null +++ b/deploy/helm/templates/pvc.yaml @@ -0,0 +1,22 @@ +{{- if and .Values.persistence.enabled ( not .Values.persistence.existingClaim ) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "opengist.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: +{{ include "opengist.labels" . | indent 4 }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/deploy/helm/templates/secret.yaml b/deploy/helm/templates/secret.yaml new file mode 100644 index 0000000..47d6d46 --- /dev/null +++ b/deploy/helm/templates/secret.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "opengist.fullname" . }}-secret + namespace: {{ .Release.Namespace }} + labels: +{{ include "opengist.labels" . | indent 4 }} +type: Opaque +data: + {{- range $key, $value := .Values.configSecret }} + {{ $key }}: {{ $value | b64enc | quote }} + {{- end }} diff --git a/deploy/helm/templates/service-http.yaml b/deploy/helm/templates/service-http.yaml new file mode 100644 index 0000000..7598c69 --- /dev/null +++ b/deploy/helm/templates/service-http.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "opengist.fullname" . }}-http + labels: + {{- include "opengist.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.serviceHttp.annotations | nindent 4 }} +spec: + type: {{ .Values.serviceHttp.type }} + ports: + - port: {{ .Values.serviceHttp.port }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.serviceHttp.nodePort }} + nodePort: {{ .Values.serviceHttp.nodePort }} + {{- end }} + selector: + {{- include "opengist.selectorLabels" . | nindent 4 }} diff --git a/deploy/helm/templates/service-ssh.yaml b/deploy/helm/templates/service-ssh.yaml new file mode 100644 index 0000000..149b7d7 --- /dev/null +++ b/deploy/helm/templates/service-ssh.yaml @@ -0,0 +1,22 @@ +{{- if .Values.serviceSsh.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "opengist.fullname" . }}-ssh + labels: + {{- include "opengist.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.serviceSsh.annotations | nindent 4 }} +spec: + type: {{ .Values.serviceSsh.type }} + ports: + - port: {{ .Values.serviceSsh.port }} + targetPort: {{ .Values.serviceSsh.port }} + protocol: TCP + name: ssh + {{- if .Values.serviceSsh.nodePort }} + nodePort: {{ .Values.serviceSsh.nodePort }} + {{- end }} + selector: + {{- include "opengist.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/deploy/helm/templates/serviceaccount.yaml b/deploy/helm/templates/serviceaccount.yaml new file mode 100644 index 0000000..a0d16c9 --- /dev/null +++ b/deploy/helm/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "opengist.serviceAccountName" . }} + labels: + {{- include "opengist.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/deploy/helm/templates/tests/test-connection.yaml b/deploy/helm/templates/tests/test-connection.yaml new file mode 100644 index 0000000..f3b03e7 --- /dev/null +++ b/deploy/helm/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "opengist.fullname" . }}-test-connection" + labels: + {{- include "opengist.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "opengist.fullname" . }}:{{ .Values.serviceHttp.port }}'] + restartPolicy: Never diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml new file mode 100644 index 0000000..77d11e6 --- /dev/null +++ b/deploy/helm/values.yaml @@ -0,0 +1,151 @@ +# Default values for opengist. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: ghcr.io/thomiceli/opengist + pullPolicy: IfNotPresent + tag: "" + +## - YAML config of Opengist https://github.com/thomiceli/opengist/blob/master/docs/configuration/cheat-sheet.md - ## +# Uses a ConfigMap for non-sensitive configuration +config: {} + # log-output: stdout + +# Uses a Secret for sensitive configuration +configSecret: {} + # gitea.client-key: + # gitea.secret: + +env: [] + # - name: KEY + # value: VALUE + +replicaCount: 1 + +strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 100% + maxUnavailable: 0 + +imagePullSecrets: [] + +serviceHttp: + type: ClusterIP + port: 6157 + # nodePort: + annotations: {} + +serviceSsh: + enabled: true # enable ssh service + type: LoadBalancer + port: 2222 + # nodePort: + annotations: + metallb.universe.tf/allow-shared-ip: "opengist" # allow shared ip for ssh service + +livenessProbe: + enabled: true + initialDelaySeconds: 300 + timeoutSeconds: 3 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 10 + +readinessProbe: + enabled: true + initialDelaySeconds: 60 + timeoutSeconds: 3 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 2 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: demo.opengist.io + paths: + - path: / + pathType: ImplementationSpecific + tls: [] # leave as it is if cert-manager is enabled + # - secretName: web-ssl + # hosts: + # - demo.opengist.io + +certManager: + enabled: false + issuer: "letsencrypt-prod" + +persistence: + enabled: true + # existingClaim: + # storageClass: + accessMode: ReadWriteOnce + size: 10Gi + filestore_dir: /opengist + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +serviceAccount: + create: true + automount: true + annotations: {} + name: "" + +podAnnotations: {} + +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +extraVolumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + + diff --git a/deploy/README.md b/deploy/kustomize/README.md similarity index 89% rename from deploy/README.md rename to deploy/kustomize/README.md index 4ebb630..769b889 100644 --- a/deploy/README.md +++ b/deploy/kustomize/README.md @@ -11,7 +11,7 @@ metadata: name: opengist resources: - - https://github.com/thomiceli/opengist/deploy/ + - https://github.com/thomiceli/opengist/deploy/kustomize ``` ## Full example @@ -28,7 +28,7 @@ namespace: opengist resources: - namespace.yaml - - https://github.com/thomiceli/opengist/deploy/?ref:v1.7.3 + - https://github.com/thomiceli/opengist/deploy/kustomize?ref:v1.7.3 images: - name: ghcr.io/thomiceli/opengist diff --git a/deploy/deployment.yaml b/deploy/kustomize/deployment.yaml similarity index 100% rename from deploy/deployment.yaml rename to deploy/kustomize/deployment.yaml diff --git a/deploy/ingress.yaml b/deploy/kustomize/ingress.yaml similarity index 100% rename from deploy/ingress.yaml rename to deploy/kustomize/ingress.yaml diff --git a/deploy/kustomization.yaml b/deploy/kustomize/kustomization.yaml similarity index 100% rename from deploy/kustomization.yaml rename to deploy/kustomize/kustomization.yaml diff --git a/deploy/pvc.yaml b/deploy/kustomize/pvc.yaml similarity index 100% rename from deploy/pvc.yaml rename to deploy/kustomize/pvc.yaml diff --git a/deploy/service.yaml b/deploy/kustomize/service.yaml similarity index 100% rename from deploy/service.yaml rename to deploy/kustomize/service.yaml