From 43db3f4cd7d0329e94db4b0a4a38b48330791d50 Mon Sep 17 00:00:00 2001 From: Andrew Kostka Date: Wed, 28 Oct 2026 12:01:21 +0000 Subject: [PATCH] Add Helm chart for platform-nginx --- charts/platform-nginx/.helmignore | 23 +++++ charts/platform-nginx/Chart.yaml | 8 ++ charts/platform-nginx/templates/_helpers.tpl | 48 ++++++++++ charts/platform-nginx/templates/config.yaml | 11 +++ .../platform-nginx/templates/deployment.yaml | 87 +++++++++++++++++++ charts/platform-nginx/templates/service.yaml | 15 ++++ charts/platform-nginx/values.yaml | 51 +++++++++++ 7 files changed, 243 insertions(+) create mode 100644 charts/platform-nginx/.helmignore create mode 100644 charts/platform-nginx/Chart.yaml create mode 100644 charts/platform-nginx/templates/_helpers.tpl create mode 100644 charts/platform-nginx/templates/config.yaml create mode 100644 charts/platform-nginx/templates/deployment.yaml create mode 100644 charts/platform-nginx/templates/service.yaml create mode 100644 charts/platform-nginx/values.yaml diff --git a/charts/platform-nginx/.helmignore b/charts/platform-nginx/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/platform-nginx/.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/charts/platform-nginx/Chart.yaml b/charts/platform-nginx/Chart.yaml new file mode 100644 index 0000000..370e4c1 --- /dev/null +++ b/charts/platform-nginx/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: platform-nginx +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +maintainers: + - name: WBstack + url: https://github.com/wbstack diff --git a/charts/platform-nginx/templates/_helpers.tpl b/charts/platform-nginx/templates/_helpers.tpl new file mode 100644 index 0000000..926ba7c --- /dev/null +++ b/charts/platform-nginx/templates/_helpers.tpl @@ -0,0 +1,48 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "platform-nginx.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 "platform-nginx.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 "platform-nginx.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "platform-nginx.labels" -}} +helm.sh/chart: {{ include "platform-nginx.chart" . }} +{{ include "platform-nginx.selectorLabels" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "platform-nginx.selectorLabels" -}} +app.kubernetes.io/name: {{ include "platform-nginx.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/platform-nginx/templates/config.yaml b/charts/platform-nginx/templates/config.yaml new file mode 100644 index 0000000..1cc884e --- /dev/null +++ b/charts/platform-nginx/templates/config.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serverBlock }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "platform-nginx.fullname" . }}-server-block + labels: + {{- include "platform-nginx.labels" . | nindent 4 }} +data: + server-block.conf: |- + {{- .Values.serverBlock | nindent 4 }} +{{- end }} diff --git a/charts/platform-nginx/templates/deployment.yaml b/charts/platform-nginx/templates/deployment.yaml new file mode 100644 index 0000000..df3b5b9 --- /dev/null +++ b/charts/platform-nginx/templates/deployment.yaml @@ -0,0 +1,87 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "platform-nginx.fullname" . }} + labels: + {{- include "platform-nginx.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "platform-nginx.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if .Values.serverBlock }} + checksum/server-block: {{ .Values.serverBlock | sha256sum }} + {{- end }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "platform-nginx.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: tmp + mountPath: /tmp + {{- if .Values.serverBlock }} + - name: server-block + mountPath: {{ .Values.serverBlockMountPath }} + readOnly: true + {{- end }} + volumes: + - name: tmp + emptyDir: {} + {{- if .Values.serverBlock }} + - name: server-block + configMap: + name: {{ include "platform-nginx.fullname" . }}-server-block + {{- 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/charts/platform-nginx/templates/service.yaml b/charts/platform-nginx/templates/service.yaml new file mode 100644 index 0000000..d20e1f1 --- /dev/null +++ b/charts/platform-nginx/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "platform-nginx.fullname" . }} + labels: + {{- include "platform-nginx.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "platform-nginx.selectorLabels" . | nindent 4 }} diff --git a/charts/platform-nginx/values.yaml b/charts/platform-nginx/values.yaml new file mode 100644 index 0000000..8c7e934 --- /dev/null +++ b/charts/platform-nginx/values.yaml @@ -0,0 +1,51 @@ +replicaCount: 1 + +image: + repository: nginx/nginx-unprivileged + pullPolicy: IfNotPresent + tag: 1.30.6-alpine-slim + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} +podLabels: {} + +serverBlock: "" +serverBlockMountPath: /etc/nginx/conf.d + +automountServiceAccountToken: false + +podSecurityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + +securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + +service: + type: ClusterIP + port: 8080 + +resources: {} + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +nodeSelector: {} + +tolerations: [] + +affinity: {}