Skip to content

Commit

Permalink
patch: added template docs and updated kube-virt
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-viles authored Apr 1, 2024
1 parent 5a1b554 commit 312f832
Show file tree
Hide file tree
Showing 20 changed files with 424 additions and 146 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
5 changes: 3 additions & 2 deletions .github/helm-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -euxo pipefail

# renovate: datasource=github-releases depName=norwoodj/helm-docs
HELM_DOCS_VERSION=1.11.3
HELM_DOCS_VERSION=1.12.0

# install helm-docs
curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz
tar -xf /tmp/helm-docs.tar.gz helm-docs

# validate docs
chmod +x ./helm-docs
./helm-docs
echo "If this fails, you need to run `helm-docs .`. See https://github.com/norwoodj/helm-docs"
echo "If this fails, you need to run \`helm-docs .\`. See https://github.com/norwoodj/helm-docs"
git diff --exit-code
4 changes: 2 additions & 2 deletions .github/kubeconform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -euxo pipefail
# renovate: datasource=github-releases depName=yannh/kubeconform
KUBECONFORM_VERSION=0.6.4

#CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | cut -d '/' -f 2 | uniq)"
#CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- apps | cut -d '/' -f 2 | uniq)"
CHART_DIRS=$(ls charts)

# install kubeconform
curl --silent --show-error --fail --location --output /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz"
tar -xf /tmp/kubeconform.tar.gz kubeconform

# validate charts
# validate apps
for CHART_DIR in ${CHART_DIRS}; do
helm template --values charts/"${CHART_DIR}"/ci/test-values.yaml charts/"${CHART_DIR}" | ./kubeconform --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}"
done
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: helm/[email protected]

- name: Run lint
run: ct lint --all --config .github/ct.yaml
run: ct lint --all --validate-maintainers=false --config .github/ct.yaml

lint-docs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,4 +57,4 @@ jobs:
- name: Run kubeconform
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeconform.sh
run: .github/kubeconform.sh
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
- repo: https://github.com/norwoodj/helm-docs.git
rev: v1.13.1
hooks:
- id: helm-docs
args:
- --chart-search-root=charts
- repo: local
hooks:
- id: chart-lint
name: Run Chart Lint Test
language: system
entry: 'ct lint --all --validate-maintainers=false --config .github/ct.yaml'
- repo: https://github.com/drewbernetes/pre-commits.git
rev: v0.1.0
hooks:
- id: trivy
args:
- fs
- .
85 changes: 38 additions & 47 deletions charts/e2e-basic/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# End-2-End-Testing



![Version: 0.0.6](https://img.shields.io/badge/Version-0.0.6-informational?style=flat-square) ![AppVersion: 0.0.6](https://img.shields.io/badge/AppVersion-0.0.6-informational?style=flat-square)

# Generic End-2-End testing

![Version: 0.0.6](https://img.shields.io/badge/Version-0.0.6-informational?style=flat-square) ![AppVersion: 0.0.6](https://img.shields.io/badge/AppVersion-0.0.6-informational?style=flat-square)

This setup will deploy a multi-replica deployment with a
web frontend and a database backend.
They are in reality not linked and do not have a valid application
but the test is to ensure we can spin things up
using affinity and ant-affinity, volumes and more.

## Features
### Features
* Affinity/anti-affinity to attempt to evenly split workloads
* Multiple replicas of nginx and Postgresql
* Volume creation and mounting in Postgresql container
Expand All @@ -24,13 +20,13 @@ using affinity and ant-affinity, volumes and more.
* PDB to ensure pods stay online at all times
* Scripts to deploy, delete and test

# Tests
## Ingress Testing
## Tests
### Ingress Testing

This workload will spin up an example deployment with an ingress
and certificate combo to confirm that ingress is working with TLS.

## Affinity/Anti-Affinity Testing
### Affinity/Anti-Affinity Testing

This workload will spin up an example deployment to test affinity
and anti-affinity.
Expand All @@ -50,49 +46,44 @@ assigned to the nodes in any sort of order due to affinity settings ***
| `Nginx` | `Nginx` | `Nginx` |
| `Postgres` | `Postgres` | `Postgres` |

## Storage Testing
### Storage Testing
The storage testing simply applies a PVC to the nginx pod
allowing for storage class testing.

## PDB Testing
### PDB Testing
The PDB ensures a pod is always online to ensure no downtime during upgrades

## Automated Testing:
### Automated Testing:
Check out [E2E Tester](https://github.com/drew-viles/k8s-e2e-tester)
for an automated tester which will fire tests against this chart.




## Installation

### Add Helm repository

```shell
helm repo add drew-viles https://drew-viles.github.io/helm-charts
helm repo update
```

## Install chart

Using config from a file:

```bash
helm upgrade --install End-2-End-Testing . --values ./values.yaml
```

## Updating the Chart
Make sure you've run and resolved any issues using the following as failures of these will cause the pipeline/actions to fail.
```
yamllint charts/End-2-End-Testing/values.yaml --config-file .github/ct.yaml
helm-docs .
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.


## Add Helm Repository

```shell
helm repo add drew-viles https://drew-viles.github.io/helm-charts
helm repo update
```

## Install Chart

Using config from a file:

```bash
helm upgrade --install End-2-End-Testing . --values ./values.yaml
```

## Updating the Chart
Make sure you've run and resolved any issues using the following as failures of these will cause the pipeline/actions to fail.
```
ct lint charts/End-2-End-Testing/values.yaml --validate-maintainers=false --config .github/ct.yaml
helm-docs .
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

## Values

| Key | Type | Default | Description |
Expand All @@ -117,4 +108,4 @@ The following table lists the configurable parameters of the chart and the defau
| postgres.statefulset.env.postgresUser | string | `"e2e-user"` | |
| postgres.statefulset.persistentData.className | string | `"fast-disks"` | |
| postgres.statefulset.persistentData.enabled | bool | `true` | |
| postgres.statefulset.persistentData.size | string | `"10Gi"` | |
| postgres.statefulset.persistentData.size | string | `"10Gi"` | |
127 changes: 88 additions & 39 deletions charts/e2e-basic/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -1,39 +1,88 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

## Installation

### Add Helm repository

```shell
helm repo add drew-viles https://drew-viles.github.io/helm-charts
helm repo update
```

## Install chart

Using config from a file:

```bash
helm upgrade --install {{ template "chart.name" . }} . --values ./values.yaml
```

## Updating the Chart
Make sure you've run and resolved any issues using the following as failures of these will cause the pipeline/actions to fail.
```
yamllint charts/{{ template "chart.name" . }}/values.yaml --config-file .github/ct.yaml

helm-docs .
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

{{ template "chart.valuesSection" . }}
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}

This setup will deploy a multi-replica deployment with a
web frontend and a database backend.
They are in reality not linked and do not have a valid application
but the test is to ensure we can spin things up
using affinity and ant-affinity, volumes and more.

### Features
* Affinity/anti-affinity to attempt to evenly split workloads
* Multiple replicas of nginx and Postgresql
* Volume creation and mounting in Postgresql container
* Configmap mounting for Nginx Index.php for querying the Postgres sts
- confirms cluster dns works
* SQL seeding for populating DB on Post start lifecycle
- confirms cluster dns works
* Public and Private Ingress
* PDB to ensure pods stay online at all times
* Scripts to deploy, delete and test

## Tests
### Ingress Testing

This workload will spin up an example deployment with an ingress
and certificate combo to confirm that ingress is working with TLS.

### Affinity/Anti-Affinity Testing

This workload will spin up an example deployment to test affinity
and anti-affinity.
An Nginx and Postgres workload will be added to the cluster.

The Nginx pods should sit on different nodes to one another as
should the Postgres pods.
However, the Nginx pods should share a node with the Postgres and vice versa.

Once deployed, confirm that the pods are arranged as such onn each node.

*** Node X is just a random node in the EKS cluster, the pods are not
assigned to the nodes in any sort of order due to affinity settings ***

| **Node A** | **Node B** | **Node C** |
|:------------|:--------------|:------------|
| `Nginx` | `Nginx` | `Nginx` |
| `Postgres` | `Postgres` | `Postgres` |

### Storage Testing
The storage testing simply applies a PVC to the nginx pod
allowing for storage class testing.

### PDB Testing
The PDB ensures a pod is always online to ensure no downtime during upgrades

### Automated Testing:
Check out [E2E Tester](https://github.com/drew-viles/k8s-e2e-tester)
for an automated tester which will fire tests against this chart.

## Add Helm Repository

```shell
helm repo add drew-viles https://drew-viles.github.io/helm-charts
helm repo update
```

## Install Chart

Using config from a file:

```bash
helm upgrade --install {{ template "chart.name" . }} . --values ./values.yaml
```

## Updating the Chart
Make sure you've run and resolved any issues using the following as failures of these will cause the pipeline/actions to fail.
```
ct lint charts/{{ template "chart.name" . }}/values.yaml --validate-maintainers=false --config .github/ct.yaml

helm-docs .
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

{{ template "chart.valuesSection" . }}
2 changes: 1 addition & 1 deletion charts/jellyfin/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: jellyfin
description: A Helm chart for Kubernetes
description: Deploys Jellyfin onto Kubernetes
type: application
version: 0.1.0
appVersion: "10.18.3"
Expand Down
34 changes: 26 additions & 8 deletions charts/jellyfin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@

![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: 10.18.3](https://img.shields.io/badge/AppVersion-10.18.3-informational?style=flat-square)

A Helm chart for Kubernetes
The Jellyfin helm chart simply exists for deploying the Jellyfin media server onto Kubernetes.

## Maintainers
## Add Helm Repository

| Name | Email | Url |
| ---- | ------ | --- |
| Drew | <[email protected]> | |
```shell
helm repo add drew-viles https://drew-viles.github.io/helm-charts
helm repo update
```

## Install Chart

Using config from a file:

```bash
helm upgrade --install jellyfin . --values ./values.yaml
```

## Updating the Chart
Make sure you've run and resolved any issues using the following as failures of these will cause the pipeline/actions to fail.
```
ct lint charts/jellyfin/values.yaml --validate-maintainers=false --config .github/ct.yaml
helm-docs .
```

## Configuration

The following table lists the configurable parameters of the chart and the default values.

## Values

Expand Down Expand Up @@ -50,6 +71,3 @@ A Helm chart for Kubernetes
| serviceAccount.name | string | `""` | |
| storageClassName | string | `""` | |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
Loading

0 comments on commit 312f832

Please sign in to comment.