Skip to content

chore: Basic kind testing #24

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ debug: true
target-branch: main
check-version-increment: false
validate-maintainers: false
helm-extra-args: -f chart/ci/values.yaml
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ max_line_length = 140

[*.md]
trim_trailing_whitespace = false

[*.yml,*.yaml]
quote_type = single
25 changes: 20 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
- develop

jobs:

chart:
name: 'Build and Test Helm Chart'
runs-on: ubuntu-latest
strategy:
matrix:
k8s_version:
- 1.23.13
- 1.24.7
- 1.25.3

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -24,6 +28,8 @@ jobs:
with:
version: v3.11.2

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- uses: actions/setup-python@v5
with:
python-version: '3.9'
Expand All @@ -32,22 +38,31 @@ jobs:
- name: Helm Chart Testing
uses: helm/[email protected]

- name: Helm Setup
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
changed=$(ct list-changed --config .ct.yaml --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
run: ct lint --config .ct.yaml --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
with:
version: v0.17.0
node_image: kindest/node:v${{ matrix.k8s_version }}
cluster_name: kind-cluster-${{ matrix.k8s_version }}
config: test/integration/kind-cluster.yaml

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
run: ct install --config .ct.yaml --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "--timeout 10m"
38 changes: 32 additions & 6 deletions chart/ci/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
postgresql:
config:
dbName: automatisch
auth:
password: admin
persistence:
enabled: false
volumeSize: 1Gi
replicaCount: 1
app:
credentials:
ENCRYPTION_KEY: "123"
WEBHOOK_SECRET_KEY: "123"
APP_SECRET_KEY: "123"
APP_SECRET_KEY: "123"
postgresql:
persistence:
enabled: false
auth:
dbName: automatisch
password: admin
postgresPassword: admin
primary:
livenessProbe:
enabled: true
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
# on setup only!
failureThreshold: 30
successThreshold: 1
readinessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
# on setup only!
failureThreshold: 20
successThreshold: 1
redis:
persistence:
enabled: false
9 changes: 6 additions & 3 deletions chart/templates/deployment-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ spec:
- name: PORT
value: "3000"
- name: HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
value: "localhost"
{{- include "ah.envValues" . | nindent 12 }}
ports:
- name: ah-tcp
Expand Down Expand Up @@ -101,9 +99,14 @@ spec:
- mountPath: "/automatisch/logs"
name: logs
volumes:
{{- if .Values.persistence.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ include "ah.fullname" . }}
{{- else }}
- name: storage
emptyDir: {}
{{- end }}
- name: cache
emptyDir:
sizeLimit: 100Mi
Expand Down
5 changes: 5 additions & 0 deletions chart/templates/deployment-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ spec:
- mountPath: "/data"
name: storage
volumes:
{{- if .Values.redis.persistence.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ include "ah.fullname" . }}-redis
{{- else }}
- name: storage
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/pvc-postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.postgresql.enabled -}}
{{- if and .Values.postgresql.enabled .Values.postgresql.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/pvc-redis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.redis.enabled -}}
{{- if and .Values.redis.enabled .Values.redis.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
4 changes: 3 additions & 1 deletion chart/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -12,4 +13,5 @@ spec:
- {{ .Values.global.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.volumeSize }}
storage: {{ .Values.persistence.volumeSize }}
{{- end }}
2 changes: 1 addition & 1 deletion chart/templates/secret-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ stringData:
{{ include "ah.camelcase" $k }}: {{ $v | quote }}
{{- end }}
dbHost: "{{ include "ah.fullname" . }}-postgresql"
dbName: "{{ .Values.postgresql.config.dbName }}"
dbName: "{{ .Values.postgresql.auth.database }}"
dbUser: "{{ .Values.postgresql.auth.username }}"
dbPassword: "{{ .Values.postgresql.auth.password }}"
9 changes: 6 additions & 3 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Default values for ah.
# Default values for Automatisch chart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
global:
storageClass:
storageClass: ""
accessMode: ReadWriteOnce
replicaCount: 1
replicaCount: 2
# -- Update policy
updateStrategy: "RollingUpdate"
image:
Expand All @@ -14,6 +14,7 @@ image:
# renovate: datasource=docker depName=automatischio/automatisch
tag: "0.12.0"
persistence:
enabled: true
volumeSize: 3Gi
postgresql:
enabled: true
Expand Down Expand Up @@ -41,6 +42,7 @@ postgresql:
password:
postgresPassword:
persistence:
enabled: true
volumeSize: 5Gi
primary:
persistence:
Expand Down Expand Up @@ -74,6 +76,7 @@ redis:
# @ignore, Configure resource limits
resources: {}
persistence:
enabled: true
volumeSize: 3Gi

imagePullSecrets: []
Expand Down
Loading
Loading