Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add charts for GPP-app and GPP publicatiebank #2

Merged
merged 9 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Charts

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/
*.tgz
.vscode
10 changes: 10 additions & 0 deletions charts/GPP-app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: gpp-app
description: A helm chart for the ICATT GPP app.

type: application

# Chart version
version: 0.1.0
appVersion: 0.0.0

87 changes: 87 additions & 0 deletions charts/GPP-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# gpp-app

![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 app.

## 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-app"` | |
| 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.database.host | string | `""` | |
| settings.database.name | string | `""` | |
| settings.database.password | string | `""` | |
| settings.database.port | int | `5432` | |
| settings.database.sslmode | string | `"prefer"` | |
| settings.database.username | string | `""` | |
| settings.gppPublicatiebank.apiKey | string | `""` | |
| settings.gppPublicatiebank.baseUrl | string | `""` | |
| settings.oidc.adminRole | string | `""` | |
| settings.oidc.authority | string | `""` | |
| settings.oidc.clientId | string | `""` | |
| settings.oidc.clientSecret | string | `""` | |
| settings.oidc.idClaimType | string | `""` | |
| settings.oidc.nameClaimType | string | `""` | |
| settings.oidc.roleClaimType | string | `""` | |
| tolerations | list | `[]` | |

62 changes: 62 additions & 0 deletions charts/GPP-app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gpp-app.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-app.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-app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "gpp-app.labels" -}}
helm.sh/chart: {{ include "gpp-app.chart" . }}
{{ include "gpp-app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "gpp-app.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gpp-app.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "gpp-app.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gpp-app.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
38 changes: 38 additions & 0 deletions charts/GPP-app/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "gpp-app.fullname" . }}
labels:
{{- include "gpp-app.labels" . | nindent 4 }}
data:
POSTGRES_HOST: {{ .Values.global.settings.databaseHost | default .Values.settings.database.host | toString | quote }}
POSTGRES_DB: {{ .Values.settings.database.name | toString | quote }}
POSTGRES_PORT: {{ .Values.settings.database.port | toString | quote }}
POSTGRES_USER: {{ .Values.settings.database.username | toString | quote }}
ODRC_BASE_URL: {{ .Values.settings.gppPublicatiebank.baseUrl | toString | quote }}
OIDC_ADMIN_ROLE: {{ .Values.settings.oidc.adminRole | toString | quote }}
{{- if .Values.settings.oidc.authority }}
OIDC_AUTHORITY: {{ .Values.settings.oidc.authority | toString | quote }}
{{- end }}
{{- if .Values.settings.oidc.clientId }}
OIDC_CLIENT_ID: {{ .Values.settings.oidc.clientId | toString | quote }}
{{- end }}
{{- if .Values.settings.oidc.clientSecret }}
OIDC_CLIENT_SECRET: {{ .Values.settings.oidc.clientSecret | toString | quote }}
{{- end }}
{{- if .Values.settings.oidc.roleClaimType }}
OIDC_ROLE_CLAIM_TYPE: {{ .Values.settings.oidc.roleClaimType | toString | quote }}
{{- end }}
{{- if .Values.settings.oidc.idClaimType }}
OIDC_ID_CLAIM_TYPE: {{ .Values.settings.oidc.idClaimType | toString | quote }}
{{- end }}
{{- if .Values.settings.oidc.nameClaimType }}
OIDC_NAME_CLAIM_TYPE: {{ .Values.settings.oidc.nameClaimType | toString | quote }}
{{- end }}
ASPNETCORE_FORWARDEDHEADERS_ENABLED: {{ .Values.settings.aspnetcore.forwardedHeadersEnabled | toString | quote }}
{{- if .Values.settings.aspnetcore.environment }}
ASPNETCORE_ENVIRONMENT: {{ .Values.settings.aspnetcore.environment | toString | quote }}
{{- end }}
{{- if .Values.settings.aspnetcore.httpPorts }}
ASPNETCORE_HTTP_PORTS: {{ .Values.settings.aspnetcore.httpPorts | toString | quote }}
{{- end }}
81 changes: 81 additions & 0 deletions charts/GPP-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
# Application ODPC
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "gpp-app.fullname" . }}
labels:
{{- include "gpp-app.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "gpp-app.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-app.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "gpp-app.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-app.fullname" .) }}
- configMapRef:
name: {{ include "gpp-app.fullname" . }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: http
httpHeaders:
- name: Host
value: {{ include "gpp-app.fullname" . | quote }}
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
httpGet:
path: /healthz
port: http
httpHeaders:
- name: Host
value: {{ include "gpp-app.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 }}
32 changes: 32 additions & 0 deletions charts/GPP-app/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "gpp-app.fullname" . }}
labels:
{{- include "gpp-app.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "gpp-app.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 }}
Loading