diff --git a/charts/GPP-burgerportaal/Chart.yaml b/charts/GPP-burgerportaal/Chart.yaml new file mode 100644 index 0000000..57c26dd --- /dev/null +++ b/charts/GPP-burgerportaal/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +name: gpp-burgerportaal +description: A helm chart for the ICATT GPP burgerportaal. + +type: application + +# Chart version +version: 0.1.0 +appVersion: 0.0.0 + diff --git a/charts/GPP-burgerportaal/README.md b/charts/GPP-burgerportaal/README.md new file mode 100644 index 0000000..81fae6d --- /dev/null +++ b/charts/GPP-burgerportaal/README.md @@ -0,0 +1,77 @@ +# gpp-burgerportaal + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square) + +A helm chart for the ICATT GPP Burgerportaal. + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| autoscaling.targetMemoryUtilizationPercentage | int | `80` | | +| azureVaultSecret.contentType | string | `""` | | +| azureVaultSecret.objectName | string | `""` | | +| azureVaultSecret.secretName | string | `"{{ .Values.existingSecret }}"` | | +| azureVaultSecret.vaultName | string | `nil` | | +| existingSecret | string | `nil` | | +| extraIngress | list | `[]` | Specify extra ingresses, for example if you have multiple ingress classes | +| fullnameOverride | string | `""` | | +| global.settings.databaseHost | string | `""` | Global databasehost, overrides setting.database.host | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ghcr.io/gpp-woo/gpp-burgerportaal"` | | +| image.tag | string | `""` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts | list | `[]` | ingress hosts | +| ingress.tls | list | `[]` | | +| livenessProbe.failureThreshold | int | `6` | | +| livenessProbe.initialDelaySeconds | int | `60` | | +| livenessProbe.periodSeconds | int | `10` | | +| livenessProbe.successThreshold | int | `1` | | +| livenessProbe.timeoutSeconds | int | `5` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| pdb.create | bool | `false` | | +| pdb.maxUnavailable | string | `""` | | +| pdb.minAvailable | int | `1` | | +| persistence.enabled | bool | `true` | | +| persistence.existingClaim | string | `nil` | | +| persistence.size | string | `"1Gi"` | | +| persistence.storageClassName | string | `""` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| podSecurityContext.fsGroup | int | `1000` | | +| readinessProbe.failureThreshold | int | `6` | | +| readinessProbe.initialDelaySeconds | int | `30` | | +| readinessProbe.periodSeconds | int | `10` | | +| readinessProbe.successThreshold | int | `1` | | +| readinessProbe.timeoutSeconds | int | `5` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext.capabilities.drop[0] | string | `"ALL"` | | +| securityContext.readOnlyRootFilesystem | bool | `false` | | +| securityContext.runAsNonRoot | bool | `true` | | +| securityContext.runAsUser | int | `1000` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.automountServiceAccountToken | bool | `true` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| settings.aspnetcore.environment | string | `""` | | +| settings.aspnetcore.forwardedHeadersEnabled | bool | `true` | | +| settings.aspnetcore.httpPorts | string | `""` | | +| settings.redirectUrl | string | `""` | | +| settings.sitemapCacheDurationHours | int | `nil` | | +| settings.downloadTimeoutMinutes | int | `nil` | | +| settings.gppPublicatiebank.apiKey | string | `""` | | +| settings.gppPublicatiebank.baseUrl | string | `""` | | +| tolerations | list | `[]` | | + diff --git a/charts/GPP-burgerportaal/templates/_helpers.tpl b/charts/GPP-burgerportaal/templates/_helpers.tpl new file mode 100644 index 0000000..9cfe489 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "gpp-burgerportaal.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 "gpp-burgerportaal.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 "gpp-burgerportaal.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "gpp-burgerportaal.labels" -}} +helm.sh/chart: {{ include "gpp-burgerportaal.chart" . }} +{{ include "gpp-burgerportaal.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "gpp-burgerportaal.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gpp-burgerportaal.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "gpp-burgerportaal.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "gpp-burgerportaal.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/GPP-burgerportaal/templates/configmap.yaml b/charts/GPP-burgerportaal/templates/configmap.yaml new file mode 100644 index 0000000..5faf635 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/configmap.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +data: + ODRC_BASE_URL: {{ .Values.settings.gppPublicatiebank.baseUrl | toString | quote }} + REDIRECT_URL: {{ .Values.settings.redirectUrl | toString | quote }} + {{- if .Values.settings.sitemapCacheDurationHours }} + SITEMAP_CACHE_DURATION_HOURS: {{ .Values.settings.sitemapCacheDurationHours }} + {{- end }} + {{- if .Values.settings.downloadTimeoutMinutes }} + DOWNLOAD_TIMEOUT_MINUTES: {{ .Values.settings.downloadTimeoutMinutes }} + {{- end }} \ No newline at end of file diff --git a/charts/GPP-burgerportaal/templates/deployment.yaml b/charts/GPP-burgerportaal/templates/deployment.yaml new file mode 100644 index 0000000..9297e9b --- /dev/null +++ b/charts/GPP-burgerportaal/templates/deployment.yaml @@ -0,0 +1,81 @@ +--- +# Application Burgerportaal +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "gpp-burgerportaal.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "gpp-burgerportaal.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - secretRef: + name: {{ .Values.existingSecret | default (include "gpp-burgerportaal.fullname" .) }} + - configMapRef: + name: {{ include "gpp-burgerportaal.fullname" . }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + httpGet: + path: /healthz + port: http + httpHeaders: + - name: Host + value: {{ include "gpp-burgerportaal.fullname" . | quote }} + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + httpGet: + path: /healthz + port: http + httpHeaders: + - name: Host + value: {{ include "gpp-burgerportaal.fullname" . | quote }} + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/GPP-burgerportaal/templates/hpa.yaml b/charts/GPP-burgerportaal/templates/hpa.yaml new file mode 100644 index 0000000..d52fc13 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "gpp-burgerportaal.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/charts/GPP-burgerportaal/templates/ingress.yaml b/charts/GPP-burgerportaal/templates/ingress.yaml new file mode 100644 index 0000000..a181ac2 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ include "gpp-burgerportaal.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/GPP-burgerportaal/templates/pdb.yaml b/charts/GPP-burgerportaal/templates/pdb.yaml new file mode 100644 index 0000000..8c95e06 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/pdb.yaml @@ -0,0 +1,19 @@ +{{- if .Values.pdb.create }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +spec: + {{- if .Values.pdb.minAvailable }} + minAvailable: {{ .Values.pdb.minAvailable }} + {{- end }} + {{- if .Values.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.pdb.maxUnavailable }} + {{- end }} + selector: + matchLabels: + {{- include "gpp-burgerportaal.selectorLabels" . | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/charts/GPP-burgerportaal/templates/secret.yaml b/charts/GPP-burgerportaal/templates/secret.yaml new file mode 100644 index 0000000..b527257 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/secret.yaml @@ -0,0 +1,10 @@ +{{- if not .Values.existingSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +stringData: + ODRC_API_KEY: {{ .Values.settings.gppPublicatiebank.apiKey | toString | quote }} +{{- end }} diff --git a/charts/GPP-burgerportaal/templates/service.yaml b/charts/GPP-burgerportaal/templates/service.yaml new file mode 100644 index 0000000..9b3fad3 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "gpp-burgerportaal.fullname" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: 8080 + protocol: TCP + name: http + selector: + {{- include "gpp-burgerportaal.selectorLabels" . | nindent 4 }} diff --git a/charts/GPP-burgerportaal/templates/serviceaccount.yaml b/charts/GPP-burgerportaal/templates/serviceaccount.yaml new file mode 100644 index 0000000..44cc430 --- /dev/null +++ b/charts/GPP-burgerportaal/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "gpp-burgerportaal.serviceAccountName" . }} + labels: + {{- include "gpp-burgerportaal.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/GPP-burgerportaal/values.yaml b/charts/GPP-burgerportaal/values.yaml new file mode 100644 index 0000000..1a1d90f --- /dev/null +++ b/charts/GPP-burgerportaal/values.yaml @@ -0,0 +1,158 @@ +global: + settings: + # -- Global databasehost, overrides setting.database.host + databaseHost: "" + +replicaCount: 1 + +image: + repository: "ghcr.io/gpp-woo/gpp-burgerportaal" + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + create: true + annotations: {} + name: "" + automountServiceAccountToken: true + +podAnnotations: {} + +podLabels: {} + +podSecurityContext: + fsGroup: 1000 + +securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: false + runAsNonRoot: true + runAsUser: 1000 + +livenessProbe: + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + className: "" + # -- ingress hosts + hosts: [] + # - host: gpp-burgerportaal.gemeente.nl + # paths: + # - path: / + # pathType: ImplementationSpecific + tls: [] + # - secretName: gpp-burgerportaal-tls + # hosts: + # - gpp-burgerportaal.gemeente.nl + +# -- Specify extra ingresses, for example if you have multiple ingress classes +extraIngress: [] +# e.g: +# extraIngress: +# - name: gpp-burgerportaal-azuregateway +# annotations: +# appgw.ingress.kubernetes.io/ssl-redirect: "true" +# className: azure-application-gateway +# hosts: +# - host: gpp-burgerportaal.gemeente.nl +# paths: +# - path: / +# pathType: ImplementationSpecific +# servicename: gpp-burgerportaal +# portNumber: 8000 +# tls: +# - secretName: gpp-burgerportaal-tls +# hosts: +# - "gpp-burgerportaal.gemeente.nl" + +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: 200m + # memory: 256Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + +pdb: + create: false + minAvailable: 1 + maxUnavailable: "" + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +persistence: + enabled: true + size: 1Gi + storageClassName: "" + existingClaim: null + +# Existing Secret must be defined for AzureVaultSecret to work +existingSecret: null + +# This will create an AzureVaultSecret object in k8s, only Multi Key Value Secret are supported by this chart +# ref: https://akv2k8s.io/tutorials/sync/4-multi-key-value-secret/ https://learn.microsoft.com/en-us/azure/key-vault/secrets/multiline-secrets +# Using this feature requires you to define existingSecret +azureVaultSecret: + # The name of the Azure Key Vault, setting this will create the AzureVaultSecret + vaultName: null + # The name of the Multi Key Value Secret + objectName: "" + # Make sure this matches the content of the secret, can be either 'application/x-json' or 'application/x-yaml' + contentType: "" + # You must set .Values.existingSecret + secretName: "{{ .Values.existingSecret }}" + +settings: + redirectUrl: "" + sitemapCacheDurationHours: null + downloadTimeoutMinutes: null + + gppPublicatiebank: + apiKey: "" + baseUrl: "" + + aspnetcore: + forwardedHeadersEnabled: true + environment: "" + httpPorts: "" +