-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#1): skeleton helm chart with tests
- Loading branch information
1 parent
a6d8f5e
commit ba3192f
Showing
8 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Run Helm Unit-Tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
run-helm-unit-tests: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
run: 'git clone -b "$BRANCH_OR_TAG_NAME" --depth 1 "$FULL_REPO_URL" app' | ||
shell: bash | ||
env: | ||
FULL_REPO_URL: "https://github.com/${{ github.repository }}" | ||
BRANCH_OR_TAG_NAME: ${{ github.ref_name }} | ||
|
||
- name: Docker build and push image | ||
run: > | ||
cd app && | ||
docker run --rm -v ${{ github.workspace }}/app:/apps helmunittest/helm-unittest:3.12.3-0.3.5 . | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.git/ | ||
.gitignore | ||
|
||
*.swp | ||
*.tmp | ||
|
||
.idea/ | ||
.vscode/ | ||
|
||
tests | ||
*.tgz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: eurofurence-regsys | ||
version: 0.0.1 | ||
description: A helm chart that can deploy the Eurofurence Registration System. | ||
type: application | ||
home: https://github.com/eurofurence/reg-helm-chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# reg-helm-chart | ||
|
||
<img src="https://github.com/eurofurence/reg-helm-chart/actions/workflows/helm-unit-tests.yml/badge.svg" alt="test status"/> | ||
|
||
## Overview | ||
|
||
A helm chart that can deploy the Eurofurence Registration System. | ||
|
||
## Installation | ||
|
||
To use, you just need helm in your path. | ||
|
||
To run the unittests, use the [helm-unittest/helm-unittest](https://github.com/helm-unittest/helm-unittest) helm plugin or docker container. | ||
|
||
If you have the plugin installed, `helm unittest .` runs all | ||
unit tests on the command line. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{{- if (.Values.ingress).enable }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: regsys | ||
{{- with .Values.global.namespace }} | ||
namespace: '{{ . }}' | ||
{{- end }} | ||
annotations: | ||
cert-manager.io/cluster-issuer: letsencrypt-live | ||
nginx.ingress.kubernetes.io/proxy-body-size: 100m | ||
nginx.ingress.kubernetes.io/limit-rps: "9" | ||
nginx.ingress.kubernetes.io/limit-rpm: "360" | ||
nginx.ingress.kubernetes.io/limit-burst-multiplier: "5" | ||
nginx.ingress.kubernetes.io/limit-whitelist: "10.200.10.1/24,85.199.154.55/32,2001:1a50:a::/64,31.16.177.200/32" | ||
labels: | ||
name: ef-regsys | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: regsys.test.eurofurence.org | ||
http: | ||
paths: | ||
- pathType: Prefix | ||
path: "/" | ||
backend: | ||
service: | ||
name: regsys | ||
port: | ||
number: 8080 | ||
tls: | ||
- hosts: | ||
- regsys.test.eurofurence.org | ||
secretName: regsys-test-certificate | ||
--- | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
suite: test ingress | ||
templates: | ||
- ingress.yaml | ||
tests: | ||
- it: should not create anything by default | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: should create an ingress if enabled | ||
set: | ||
ingress: | ||
enable: true | ||
asserts: | ||
- isKind: | ||
of: Ingress | ||
- hasDocuments: | ||
count: 1 | ||
- it: should not set namespace if unset | ||
set: | ||
ingress: | ||
enable: true | ||
asserts: | ||
- notExists: | ||
path: metadata.namespace | ||
- equal: | ||
path: spec.rules[0].host | ||
value: regsys.test.eurofurence.org | ||
- it: should set namespace if specified | ||
set: | ||
ingress: | ||
enable: true | ||
global: | ||
namespace: hellospace | ||
asserts: | ||
- equal: | ||
path: metadata.namespace | ||
value: hellospace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"$id": "https://github.com/eurofurence/reg-helm-chart/values.schema.json", | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"additionalProperties": false, | ||
"title": "Values", | ||
"description": "Definition of available values.yaml fields", | ||
"type": "object", | ||
"properties": { | ||
"global": { | ||
"type": "object", | ||
"description": "global properties (can be set by ArgoCD)", | ||
"properties": { | ||
|
||
} | ||
}, | ||
"ingress": { | ||
"type": "object", | ||
"description": "settings for an ingress (optional, off by default)", | ||
"properties": { | ||
"enable": { | ||
"type": "boolean", | ||
"description": "enable creating an ingress", | ||
"default": false | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
global: {} | ||
# set this to supply a namespace with all the resources. | ||
# namespace: my-namespace | ||
|
||
ingress: | ||
enable: false |