Compare commits
43
Commits
ab24bcd9a5
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d68d44894
|
||
|
|
27db0d26b0
|
||
|
|
1b82a15b7f
|
||
|
|
eeacda2a25
|
||
|
|
fef4190a74
|
||
|
|
bb3b59f1ee
|
||
|
|
7c18b18a47
|
||
|
|
6821e792b2
|
||
|
|
9f7064724e
|
||
|
|
49a221008a
|
||
|
|
93a576ca11
|
||
|
|
c96e5d4132
|
||
|
|
ccd470557f
|
||
|
|
c93a96c23d
|
||
|
|
61d04282c8
|
||
|
|
4d1440331d
|
||
|
|
64c2f1a9cc
|
||
|
|
6025d82333
|
||
|
|
4631d42156 | ||
|
|
92c761c9ba | ||
|
|
ccea2082c3
|
||
|
|
4016c5396d
|
||
|
|
d35177ec71
|
||
|
|
e97f3b3bba
|
||
|
|
70a033d519
|
||
|
|
010256397a
|
||
|
|
552fe8c56e
|
||
|
|
0a237ba2c1
|
||
|
|
dfe087c0c1
|
||
|
|
761921faed
|
||
|
|
69b546d1cd
|
||
|
|
b2af7400b5
|
||
|
|
0e15d3bd74
|
||
|
|
3fb036befe
|
||
|
|
05bdc2b521
|
||
|
|
c510e06609
|
||
|
|
dee7e1f0f6
|
||
|
|
e17a4e7a7b
|
||
|
|
41dcb48564
|
||
|
|
6deb39df15
|
||
|
|
cc99cada4d
|
||
|
|
e8f3a058ce
|
||
|
|
c409e201b3
|
No files matched your search
@@ -0,0 +1,29 @@
|
|||||||
|
name: Bash
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bash-unittest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- env:
|
||||||
|
TERM: xterm
|
||||||
|
name: Run bash unittests
|
||||||
|
run: make bash/unittest
|
||||||
|
|
||||||
|
shellcheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
- uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
name: commitlint
|
name: Commit Linter
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [ "*" ]
|
||||||
- "*"
|
types: [ "opened", "edited" ]
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- edited
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-and-test:
|
check-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: docker.io/commitlint/commitlint:21.2.1
|
container: docker.io/commitlint/commitlint:21.2.1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7.0.0
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
- name: check PR title
|
- name: Verify PR title
|
||||||
run: |
|
run: |
|
||||||
echo "${{ gitea.event.pull_request.title }}" | commitlint --config .commitlintrc.json
|
echo "${{ gitea.event.pull_request.title }}" | commitlint --config .commitlintrc.json
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
name: Helm
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
helm-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||||
|
with:
|
||||||
|
version: v4.3.0 # renovate: datasource=github-releases depName=helm/helm
|
||||||
|
- name: Update helm dependencies
|
||||||
|
run: helm dependency update
|
||||||
|
- name: Lint helm files
|
||||||
|
run: |
|
||||||
|
helm lint --values values.yaml .
|
||||||
|
|
||||||
|
helm-unittest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||||
|
with:
|
||||||
|
version: v4.3.0 # renovate: datasource=github-releases depName=helm/helm
|
||||||
|
- env:
|
||||||
|
HELM_UNITTEST_VERSION: v1.0.0 #renovate: datasource=github-releases depName=helm-unittest/helm-unittest
|
||||||
|
name: Install helm-unittest
|
||||||
|
run: helm plugin install --verify=false --version "${HELM_UNITTEST_VERSION}" https://github.com/helm-unittest/helm-unittest
|
||||||
|
- name: Update helm dependencies
|
||||||
|
run: helm dependency update
|
||||||
|
- name: Execute helm unittests
|
||||||
|
run: helm unittest --strict --file 'unittests/**/*.yaml' .
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
name: Markdown linter
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths: [ "**/*.md" ]
|
||||||
|
types: [ "opened", "reopened", "synchronize" ]
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
paths: [ "**/*.md" ]
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
markdown-link-checker:
|
||||||
|
container:
|
||||||
|
image: docker.io/library/node:26.8.2-alpine
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install tooling
|
||||||
|
run: |
|
||||||
|
apk update
|
||||||
|
apk add git npm
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
- name: Verify links in markdown files
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run readme:link
|
||||||
|
|
||||||
|
markdown-lint:
|
||||||
|
container:
|
||||||
|
image: docker.io/library/node:26.8.2-alpine
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install tooling
|
||||||
|
run: |
|
||||||
|
apk update
|
||||||
|
apk add git
|
||||||
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
|
- name: Lint markdown files
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run readme:lint
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
name: check-and-test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
# renovate: datasource=github-releases depName=helm-unittest/helm-unittest
|
|
||||||
HELM_UNITTEST_VERSION: "v1.1.1"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-and-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: docker.io/alpine/helm:4.2.3
|
|
||||||
steps:
|
|
||||||
- name: install tools
|
|
||||||
run: |
|
|
||||||
apk update
|
|
||||||
apk add --update bash make nodejs npm yamllint ncurses
|
|
||||||
- uses: actions/checkout@v7.0.0
|
|
||||||
- name: define helm repositories
|
|
||||||
run: |
|
|
||||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
||||||
helm repo add valkey https://valkey.io/valkey-helm
|
|
||||||
helm repo update
|
|
||||||
- name: install chart dependencies
|
|
||||||
run: helm dependency build
|
|
||||||
- name: lint
|
|
||||||
run: helm lint .
|
|
||||||
- name: template
|
|
||||||
run: helm template --debug gitea-helm .
|
|
||||||
- name: prepare unit test environment
|
|
||||||
run: |
|
|
||||||
helm plugin install --verify=false --version ${{ env.HELM_UNITTEST_VERSION }} https://github.com/helm-unittest/helm-unittest
|
|
||||||
git submodule update --init --recursive
|
|
||||||
- name: unit tests
|
|
||||||
env:
|
|
||||||
TERM: xterm
|
|
||||||
run: |
|
|
||||||
make unittests
|
|
||||||
- name: verify readme
|
|
||||||
run: |
|
|
||||||
make readme
|
|
||||||
git diff --exit-code --name-only README.md
|
|
||||||
- name: yaml lint
|
|
||||||
uses: https://github.com/ibiqlik/action-yamllint@v3
|
|
||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
Kubernetes Helm chart for deploying [Gitea](https://gitea.com). Uses Go/Helm templating (`templates/`), YAML values (`values.yaml`), and includes sub-charts for PostgreSQL, PostgreSQL-HA, Valkey, and Valkey-cluster.
|
Kubernetes Helm chart for deploying [Gitea](https://gitea.com). Uses Go/Helm templating (`templates/`), YAML values (`values.yaml`), and includes a sub-chart for Valkey. The database is provisioned as a CloudNativePG `Cluster` resource, the operator itself is not part of the chart.
|
||||||
|
|
||||||
## Build & Test
|
## Build & Test
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make readme # Regenerate README.md parameter table + lint
|
make missing-dot # Check if the @param annotations are missing a trailing dot.
|
||||||
make unittests-helm # Run Helm unit tests (helm-unittest plugin required)
|
make readme # Regenerate README.md parameter table + lint + link checker
|
||||||
make unittests-bash # Run bash/bats script tests (requires git submodule init)
|
make helm/unittest # Run Helm unit tests (helm-unittest plugin required)
|
||||||
make unittests # Both of the above
|
make bash/unittest # Run bash/bats script tests (requires git submodule init)
|
||||||
```
|
```
|
||||||
|
|
||||||
Always run `make readme` after changing `values.yaml` `@param` annotations.
|
Always run `make readme` after changing `values.yaml` `@param` annotations.
|
||||||
Always run `make unittests-helm` after changing templates or unit tests.
|
Always run `make helm/unittest` after changing templates or unit tests.
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
@@ -34,20 +34,33 @@ image:
|
|||||||
|
|
||||||
### Templates
|
### Templates
|
||||||
|
|
||||||
- Helm templates live in `templates/gitea/`. Helpers live in `templates/_helpers.tpl`.
|
- Helm templates live in `templates/`. Helpers live in `templates/_helpers.tpl`.
|
||||||
- Use camelCase for all files and variables (e.g `httpRoute`, `backendTLSPolicy`, `gatewayAPI`, `statefulSet`).
|
- Use camelCase for all files and variables (e.g `httpRoute`, `backendTLSPolicy`, `gatewayAPI`, `statefulSet`).
|
||||||
- Use `include "gitea.fullname"` for naming resources.
|
- Use `include "gitea.fullname"` for naming resources.
|
||||||
- Use `fail` for required-value validation with clear error messages referencing the full values path.
|
- Use `fail` for required-value validation with clear error messages referencing the full values path.
|
||||||
- Ensure, that the attributes `annotations`, `labels`, `name` and `namespace` are alphabetically sorted.
|
- Ensure, that the attributes `annotations`, `labels`, `name` and `namespace` are alphabetically sorted.
|
||||||
- Render all attributes, even if they are empty, to prevent drift in Argo CD. For example, `labels` must be rendered, while `annotations` are defined as `yaml:"annotations,omitempty"`.
|
- Render all attributes, even if they are empty, to prevent drift in Argo CD. For example, `labels` must be rendered, while `annotations` are defined as `yaml:"annotations,omitempty"`.
|
||||||
- Use plural for `*.tpl` files, because they may contain functions for multiple resources of the same kind (e.g. `_services.tpl` for `httpService.yaml` or `sshService.yaml`, `_backendTLSPolicies.tpl` for `backendTLSPolicy.yaml`).
|
- Use plural for `*.tpl` files, because they may contain functions for multiple resources of the same kind (e.g. `_services.tpl` for `httpService.yaml` or `sshService.yaml`, `_backendTLSPolicies.tpl` for `backendTLSPolicy.yaml`).
|
||||||
|
- Use as prefix of YAML files the resource kind (e.g., `deployment.yaml` for `Deployment` resources). If there are multiple resources of the same kind, use a descriptive suffix (e.g., `deployment_metrics.yaml` for a `Deployment` related to metrics).
|
||||||
|
- Short names like `pvc` for Persistent Volume Claims or `svc` for Services are not allowed in file names or key names.
|
||||||
|
- Render `Secret` payloads as base64 `data` and never as `stringData`. The API server drops `stringData` and persists everything under `data`, so Helm's three-way merge cannot prune a key that was removed from the values — the stale key survives every upgrade. For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
data:
|
||||||
|
app.ini: {{ $config | b64enc }}
|
||||||
|
```
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
- Helm unit tests live in `unittests/helm/` mirroring the template structure.
|
- Helm unit tests live in `unittests/helm/` mirroring the template structure. A suite belongs into the directory of the template it asserts on, never into the directory of a template it only renders as a side effect.
|
||||||
- Test files are YAML using the [helm-unittest](https://github.com/helm-unittest/helm-unittest) format.
|
- Test files are YAML using the [helm-unittest](https://github.com/helm-unittest/helm-unittest) format.
|
||||||
|
- Name test files in camelCase after the scenario they cover (e.g. `signingEnabled.yaml`), use `basics.yaml` for the default scenario and do not repeat the directory name in the file name. The `make helm/unittest` glob only matches one directory level, so every suite must live in a subdirectory.
|
||||||
- Each test must set all required values explicitly — do not rely on cross-test state.
|
- Each test must set all required values explicitly — do not rely on cross-test state.
|
||||||
- The `values.yaml` file must pass `yamllint`. The configuration is in `.yamllint`. Use `make yamllint` to run the linter.
|
- The `values.yaml` file must pass `yamllint`. The configuration is in `.yamllint.yaml`. Use `make yamllint` to run the linter.
|
||||||
|
- The title of the unit test should clearly describe the scenario being tested. As title must be use a short sentence starting with a capital letter and ending without a period.
|
||||||
|
- The `suite` title follows the pattern `Test <subject> <scenario>` (e.g. `Test deployment probes`). It must be unique across all suites, because `helm unittest` identifies a failing suite by this title.
|
||||||
|
- Each unit test must explicitly set a custom namespace and release name, rather than relying on defaults.
|
||||||
|
- Assert `Secret` content via `data.*` with `decodeBase64: true` and add a `notExists` assertion for `stringData`.
|
||||||
|
|
||||||
### Commits & PRs
|
### Commits & PRs
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -36,6 +36,6 @@ unittests/
|
|||||||
.prettierignore
|
.prettierignore
|
||||||
.yamllint
|
.yamllint
|
||||||
CODEOWNERS
|
CODEOWNERS
|
||||||
renovate.json5
|
renovate.json
|
||||||
.commitlintrc.json
|
.commitlintrc.json
|
||||||
.gitsv/
|
.gitsv/
|
||||||
Vendored
+1
-2
@@ -4,8 +4,7 @@
|
|||||||
"/unittests/**/*.yaml"
|
"/unittests/**/*.yaml"
|
||||||
],
|
],
|
||||||
"https://docs.renovatebot.com/renovate-schema.json":[
|
"https://docs.renovatebot.com/renovate-schema.json":[
|
||||||
"renovate.json",
|
"renovate.json"
|
||||||
"renovate.json5"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"yaml.schemaStore.enable": true,
|
"yaml.schemaStore.enable": true,
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
---
|
---
|
||||||
extends: default
|
extends: default
|
||||||
|
|
||||||
ignore: |
|
ignore: |
|
||||||
|
charts
|
||||||
.yamllint
|
.yamllint
|
||||||
node_modules
|
node_modules
|
||||||
templates
|
templates
|
||||||
unittests/bash
|
unittests/bash
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
truthy:
|
|
||||||
allowed-values: ['true', 'false']
|
|
||||||
check-keys: False
|
|
||||||
level: error
|
|
||||||
line-length: disable
|
|
||||||
document-start: disable
|
|
||||||
comments:
|
|
||||||
min-spaces-from-content: 1
|
|
||||||
braces:
|
braces:
|
||||||
max-spaces-inside: 2
|
max-spaces-inside: 2
|
||||||
|
comments:
|
||||||
|
min-spaces-from-content: 1
|
||||||
|
comments-indentation: disable
|
||||||
|
document-start: disable
|
||||||
|
line-length: disable
|
||||||
|
truthy:
|
||||||
|
allowed-values: ['true', 'false']
|
||||||
|
check-keys: false
|
||||||
|
level: error
|
||||||
+5
-6
@@ -37,15 +37,14 @@ For local development and testing of pull requests, the following workflow can
|
|||||||
be used:
|
be used:
|
||||||
|
|
||||||
1. Install `minikube` and `helm`.
|
1. Install `minikube` and `helm`.
|
||||||
1. Start a `minikube` cluster via `minikube start`.
|
2. Start a `minikube` cluster via `minikube start`.
|
||||||
1. From the `gitea/helm-gitea` directory execute the following command.
|
3. From the `gitea/helm-gitea` directory execute the following command.
|
||||||
This will install the dependencies listed in `Chart.yml` and deploy the current state of the helm chart found locally.
|
This will install the dependencies listed in `Chart.yml` and deploy the current state of the helm chart found locally.
|
||||||
If you want to test a branch, make sure to switch to the respective branch first.
|
If you want to test a branch, make sure to switch to the respective branch first.
|
||||||
`helm install --dependency-update gitea . -f values.yaml`.
|
`helm install --dependency-update gitea . -f values.yaml`.
|
||||||
1. Gitea is now deployed in `minikube`.
|
4. Gitea is now deployed in `minikube`. To access it, it's port needs to be forwarded first from `minikube` to localhost
|
||||||
To access it, it's port needs to be forwarded first from `minikube` to localhost first via `kubectl --namespace
|
first via `kubectl --namespace default port-forward svc/gitea-http 3000:3000`. Now Gitea is accessible at
|
||||||
default port-forward svc/gitea-http 3000:3000`.
|
`localhost:3000`.
|
||||||
Now Gitea is accessible at [http://localhost:3000](http://localhost:3000).
|
|
||||||
|
|
||||||
### Unit tests
|
### Unit tests
|
||||||
|
|
||||||
|
|||||||
+2
-8
@@ -1,12 +1,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: postgresql
|
|
||||||
repository: oci://registry-1.docker.io/bitnamicharts
|
|
||||||
version: 16.7.27
|
|
||||||
- name: postgresql-ha
|
|
||||||
repository: oci://registry-1.docker.io/bitnamicharts
|
|
||||||
version: 16.3.2
|
|
||||||
- name: valkey
|
- name: valkey
|
||||||
repository: https://valkey.io/valkey-helm
|
repository: https://valkey.io/valkey-helm
|
||||||
version: 0.10.0
|
version: 0.10.0
|
||||||
digest: sha256:1afecbf0d4fc9f48e31417573d4bed7e0ac7848040b9e0c5f3989ada9d1f944f
|
digest: sha256:c3deb43d02228f143e1c9525f5ce06dc6a78646e763c7a73c5ec8ea0101ed2f5
|
||||||
generated: "2026-07-20T19:52:11.548874634+02:00"
|
generated: "2026-10-04T00:24:11.331968211+02:00"
|
||||||
+1
-11
@@ -3,7 +3,7 @@ name: gitea
|
|||||||
description: Gitea Helm chart for Kubernetes
|
description: Gitea Helm chart for Kubernetes
|
||||||
type: application
|
type: application
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
appVersion: 1.27.3
|
appVersion: 28.0.0
|
||||||
icon: https://gitea.com/assets/img/logo.svg
|
icon: https://gitea.com/assets/img/logo.svg
|
||||||
|
|
||||||
annotations:
|
annotations:
|
||||||
@@ -36,16 +36,6 @@ maintainers:
|
|||||||
email: christopher.homberger@web.de
|
email: christopher.homberger@web.de
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
# https://github.com/bitnami/charts/blob/main/bitnami/postgresql
|
|
||||||
- name: postgresql
|
|
||||||
repository: oci://registry-1.docker.io/bitnamicharts
|
|
||||||
version: 16.7.27
|
|
||||||
condition: postgresql.enabled
|
|
||||||
# https://github.com/bitnami/charts/blob/main/bitnami/postgresql-ha/Chart.yaml
|
|
||||||
- name: postgresql-ha
|
|
||||||
repository: oci://registry-1.docker.io/bitnamicharts
|
|
||||||
version: 16.3.2
|
|
||||||
condition: postgresql-ha.enabled
|
|
||||||
# https://github.com/bitnami/charts/blob/main/bitnami/valkey/Chart.yaml
|
# https://github.com/bitnami/charts/blob/main/bitnami/valkey/Chart.yaml
|
||||||
- name: valkey
|
- name: valkey
|
||||||
repository: https://valkey.io/valkey-helm
|
repository: https://valkey.io/valkey-helm
|
||||||
|
|||||||
@@ -1,29 +1,67 @@
|
|||||||
SHELL := /usr/bin/env bash -O globstar
|
SHELL := /usr/bin/env bash -O globstar
|
||||||
|
|
||||||
.PHONY: prepare-environment
|
# CLEAN
|
||||||
prepare-environment:
|
# ==============================================================================
|
||||||
npm install
|
PHONY+=clean
|
||||||
|
clean:
|
||||||
|
-rm -rf charts *.tar.gz *.tar.gz.sig node_modules
|
||||||
|
|
||||||
.PHONY: readme
|
# MISSING DOT
|
||||||
readme: prepare-environment
|
# ==============================================================================
|
||||||
npm run readme:parameters
|
PHONY+=missing-dot
|
||||||
npm run readme:lint
|
missing-dot:
|
||||||
|
grep --perl-regexp '## @(param|skip).*[^.]$$' values.yaml
|
||||||
|
|
||||||
.PHONY: unittests
|
# README
|
||||||
unittests: unittests-helm unittests-bash
|
# ==============================================================================
|
||||||
|
PHONY+=readme
|
||||||
|
readme: readme/link readme/lint readme/parameters
|
||||||
|
|
||||||
.PHONY: unittests-helm
|
PHONY+=readme/link
|
||||||
unittests-helm:
|
readme/link:
|
||||||
helm unittest --strict -f 'unittests/helm/**/*.yaml' -f 'unittests/helm/values-conflicting-checks.yaml' ./
|
npm install && npm run readme:link
|
||||||
|
|
||||||
.PHONY: unittests-bash
|
PHONY+=readme/lint
|
||||||
unittests-bash:
|
readme/lint:
|
||||||
./unittests/bash/bats/bin/bats --pretty ./unittests/bash/tests/**/*.bats
|
npm install && npm run readme:lint
|
||||||
|
|
||||||
.PHONY: update-helm-dependencies
|
PHONY+=readme/parameters
|
||||||
update-helm-dependencies:
|
readme/parameters:
|
||||||
|
npm install && npm run readme:parameters
|
||||||
|
|
||||||
|
# HELM DEPENDENCIES
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=helm/dependency-update
|
||||||
|
helm/dependency-update:
|
||||||
helm dependency update
|
helm dependency update
|
||||||
|
|
||||||
.PHONY: yamllint
|
# HELM UNITTESTS
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=helm/unittest
|
||||||
|
helm/unittest:
|
||||||
|
helm unittest --strict --file 'unittests/helm/**/*.yaml' ./
|
||||||
|
|
||||||
|
# BASH PREPARE
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=bash/prepare
|
||||||
|
bash/prepare:
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
# BASH UNITTESTS
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=bash/unittest
|
||||||
|
bash/unittest:
|
||||||
|
./unittests/bash/bats/bin/bats --pretty ./unittests/bash/tests/**/*.bats
|
||||||
|
|
||||||
|
# YAML LINT
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=yamllint
|
||||||
yamllint:
|
yamllint:
|
||||||
yamllint -c .yamllint .
|
yamllint -c .yamllint.yaml .
|
||||||
|
|
||||||
|
# PHONY
|
||||||
|
# ==============================================================================
|
||||||
|
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||||
|
# in a variable so we can use it in if_changed.
|
||||||
|
.PHONY: ${PHONY}
|
||||||
+24
-8
@@ -28,8 +28,8 @@ In addition, the following components are required for full HA-readiness:
|
|||||||
- A HA-ready cache (`valkey-cluster`)
|
- A HA-ready cache (`valkey-cluster`)
|
||||||
- A HA-ready DB
|
- A HA-ready DB
|
||||||
|
|
||||||
`postgres.enabled`, which default to `true`, must be set to `false` for a HA setup.
|
`cloudnativePG.enabled`, which defaults to `false`, must be enabled for a HA setup.
|
||||||
The default `postgres` chart dependency is not HA-ready (there's a dedicated `postgres-ha` chart).
|
It requires the CloudNativePG operator to be installed cluster-wide beforehand.
|
||||||
|
|
||||||
The following sections discuss each of the components in more detail.
|
The following sections discuss each of the components in more detail.
|
||||||
Note that for each component discussed, the shown configurations only provides a (working) starting point, not necessarily the most optimal setup.
|
Note that for each component discussed, the shown configurations only provides a (working) starting point, not necessarily the most optimal setup.
|
||||||
@@ -153,15 +153,31 @@ persistence:
|
|||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
If you do not have an HA-ready DB, using a managed database service in the cloud might be the easiest and most robust solution.
|
By enabling `cloudnativePG`, the chart renders a [CloudNativePG](https://cloudnative-pg.io/) `Cluster`, which provides a HA-ready PostgreSQL via streaming replication.
|
||||||
Remember: disable the built-in `postgres` dependency and configure the database connection manually via `gitea.config.database`:
|
The CloudNativePG operator itself is not part of this chart and has to be [installed cluster-wide](https://cloudnative-pg.io/documentation/current/installation_upgrade/) beforehand.
|
||||||
|
For that reason the option is disabled by default.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
instances: 3
|
||||||
|
storage:
|
||||||
|
size: 10Gi
|
||||||
|
storageClass: <storage class>
|
||||||
|
walStorage:
|
||||||
|
enabled: true
|
||||||
|
size: 2Gi
|
||||||
|
storageClass: <storage class>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you do not want to run the operator, using a managed database service in the cloud might be the easiest and most robust solution.
|
||||||
|
Remember: keep `cloudnativePG` disabled and configure the database connection manually via `gitea.config.database`:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
gitea:
|
gitea:
|
||||||
database:
|
|
||||||
builtIn:
|
|
||||||
postgresql:
|
|
||||||
enabled: false
|
|
||||||
config:
|
config:
|
||||||
database:
|
database:
|
||||||
DB_TYPE: postgres
|
DB_TYPE: postgres
|
||||||
|
|||||||
Generated
+908
File diff suppressed because it is too large.
Load diff
@@ -9,11 +9,13 @@
|
|||||||
"npm": ">=8.0.0"
|
"npm": ">=8.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"readme:link": "markdown-link-check *.md",
|
||||||
"readme:lint": "markdownlint *.md -f",
|
"readme:lint": "markdownlint *.md -f",
|
||||||
"readme:parameters": "readme-generator -v values.yaml -r README.md"
|
"readme:parameters": "readme-generator -v values.yaml -r README.md"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bitnami/readme-generator-for-helm": "^2.5.0",
|
"@bitnami/readme-generator-for-helm": "^2.5.0",
|
||||||
|
"markdown-link-check": "^3.13.6",
|
||||||
"markdownlint-cli": "^0.49.0"
|
"markdownlint-cli": "^0.49.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"gitea>gitea/renovate-config",
|
||||||
|
"helpers:pinGitHubActionDigests",
|
||||||
|
":automergeMinor",
|
||||||
|
"schedule:automergeDaily",
|
||||||
|
"schedule:weekends"
|
||||||
|
],
|
||||||
|
"labels": [
|
||||||
|
"kind/dependency"
|
||||||
|
],
|
||||||
|
"digest": {
|
||||||
|
"automerge": true
|
||||||
|
},
|
||||||
|
"automergeStrategy": "squash",
|
||||||
|
"git-submodules": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"customManagers": [
|
||||||
|
{
|
||||||
|
"description": "Gitea-version of https://docs.renovatebot.com/presets-regexManagers/#regexmanagersgithubactionsversions",
|
||||||
|
"customType": "regex",
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/.gitea/workflows/.+\\.ya?ml$/"
|
||||||
|
],
|
||||||
|
"matchStrings": [
|
||||||
|
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (?:lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s+[A-Za-z0-9_]+?_VERSION\\s*:\\s*[\"']?(?<currentValue>.+?)[\"']?\\s"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Detect helm-unittest yaml schema file",
|
||||||
|
"customType": "regex",
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/.vscode/settings\\.json$/"
|
||||||
|
],
|
||||||
|
"matchStrings": [
|
||||||
|
"https:\\/\\/raw\\.githubusercontent\\.com\\/(?<depName>[^\\s]+?)\\/(?<currentValue>v[0-9.]+?)\\/schema\\/helm-testsuite\\.json"
|
||||||
|
],
|
||||||
|
"datasourceTemplate": "github-releases"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Automatically detect new Gitea releases",
|
||||||
|
"customType": "regex",
|
||||||
|
"datasourceTemplate": "github-releases",
|
||||||
|
"depNameTemplate": "gitea/gitea",
|
||||||
|
"extractVersionTemplate": "^v(?<version>.*)$",
|
||||||
|
"managerFilePatterns": [
|
||||||
|
"/(^|/)Chart\\.ya?ml$/"
|
||||||
|
],
|
||||||
|
"matchStrings": [
|
||||||
|
"^appVersion:\\s+[\"']?(?<currentVersion>\\S+)[\"']?$"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lockFileMaintenance": {
|
||||||
|
"enabled": true,
|
||||||
|
"commitMessageAction": "update",
|
||||||
|
"commitMessageTopic": "lockfiles",
|
||||||
|
"schedule": [
|
||||||
|
"at any time"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"groupName": "subcharts (minor & patch)",
|
||||||
|
"matchManagers": [
|
||||||
|
"helmv3"
|
||||||
|
],
|
||||||
|
"matchUpdateTypes": [
|
||||||
|
"minor",
|
||||||
|
"patch",
|
||||||
|
"digest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupName": "bats testing framework",
|
||||||
|
"matchManagers": [
|
||||||
|
"git-submodules"
|
||||||
|
],
|
||||||
|
"matchUpdateTypes": [
|
||||||
|
"minor",
|
||||||
|
"patch",
|
||||||
|
"digest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupName": "workflow dependencies (minor & patch)",
|
||||||
|
"matchManagers": [
|
||||||
|
"github-actions",
|
||||||
|
"npm",
|
||||||
|
"custom.regex"
|
||||||
|
],
|
||||||
|
"matchUpdateTypes": [
|
||||||
|
"minor",
|
||||||
|
"patch",
|
||||||
|
"digest"
|
||||||
|
],
|
||||||
|
"matchFileNames": [
|
||||||
|
"!Chart.yaml"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Update README.md on changes in values.yaml",
|
||||||
|
"matchManagers": [
|
||||||
|
"helm-values"
|
||||||
|
],
|
||||||
|
"postUpgradeTasks": {
|
||||||
|
"commands": [
|
||||||
|
"install-tool node",
|
||||||
|
"make readme"
|
||||||
|
],
|
||||||
|
"fileFilters": [
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"executionMode": "update"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Override changelog url for Helm image, to have release notes in our PRs",
|
||||||
|
"matchDepNames": [
|
||||||
|
"alpine/helm"
|
||||||
|
],
|
||||||
|
"changelogUrl": "https://github.com/helm/helm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Bump Gitea as fast as possible - not only on weekends",
|
||||||
|
"matchDepNames": [
|
||||||
|
"go-gitea/gitea"
|
||||||
|
],
|
||||||
|
"schedule": [
|
||||||
|
"at any time"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
-136
@@ -1,136 +0,0 @@
|
|||||||
{
|
|
||||||
$schema: "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
extends: [
|
|
||||||
"gitea>gitea/renovate-config",
|
|
||||||
"helpers:pinGitHubActionDigests",
|
|
||||||
":automergeMinor",
|
|
||||||
"schedule:automergeDaily",
|
|
||||||
"schedule:weekends",
|
|
||||||
],
|
|
||||||
labels: [
|
|
||||||
"kind/dependency",
|
|
||||||
],
|
|
||||||
digest: {
|
|
||||||
automerge: true,
|
|
||||||
},
|
|
||||||
automergeStrategy: "squash",
|
|
||||||
"git-submodules": {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
customManagers: [
|
|
||||||
{
|
|
||||||
description: "Gitea-version of https://docs.renovatebot.com/presets-regexManagers/#regexmanagersgithubactionsversions",
|
|
||||||
customType: "regex",
|
|
||||||
managerFilePatterns: [
|
|
||||||
"/.gitea/workflows/.+\\.ya?ml$/",
|
|
||||||
],
|
|
||||||
matchStrings: [
|
|
||||||
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (?:lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[a-z-0-9]+?))?\\s+[A-Za-z0-9_]+?_VERSION\\s*:\\s*[\"']?(?<currentValue>.+?)[\"']?\\s",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "Detect helm-unittest yaml schema file",
|
|
||||||
customType: "regex",
|
|
||||||
managerFilePatterns: [
|
|
||||||
"/.vscode/settings\\.json$/",
|
|
||||||
],
|
|
||||||
matchStrings: [
|
|
||||||
"https:\\/\\/raw\\.githubusercontent\\.com\\/(?<depName>[^\\s]+?)\\/(?<currentValue>v[0-9.]+?)\\/schema\\/helm-testsuite\\.json",
|
|
||||||
],
|
|
||||||
datasourceTemplate: "github-releases",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "Automatically detect new Gitea releases",
|
|
||||||
customType: "regex",
|
|
||||||
datasourceTemplate: "github-releases",
|
|
||||||
depNameTemplate: "gitea/gitea",
|
|
||||||
extractVersionTemplate: "^v(?<version>.*)$",
|
|
||||||
managerFilePatterns: [
|
|
||||||
"/(^|/)Chart\\.ya?ml$/",
|
|
||||||
],
|
|
||||||
matchStrings: [
|
|
||||||
"^appVersion:\\s+[\"']?(?<currentVersion>\\S+)[\"']?$",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
lockFileMaintenance: {
|
|
||||||
"enabled": true,
|
|
||||||
"commitMessageAction": "update",
|
|
||||||
"commitMessageTopic": "lockfiles",
|
|
||||||
schedule: [
|
|
||||||
"at any time",
|
|
||||||
]
|
|
||||||
},
|
|
||||||
packageRules: [
|
|
||||||
{
|
|
||||||
groupName: "subcharts (minor & patch)",
|
|
||||||
matchManagers: [
|
|
||||||
"helmv3",
|
|
||||||
],
|
|
||||||
matchUpdateTypes: [
|
|
||||||
"minor",
|
|
||||||
"patch",
|
|
||||||
"digest",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
groupName: "bats testing framework",
|
|
||||||
matchManagers: [
|
|
||||||
"git-submodules",
|
|
||||||
],
|
|
||||||
matchUpdateTypes: [
|
|
||||||
"minor",
|
|
||||||
"patch",
|
|
||||||
"digest",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
groupName: "workflow dependencies (minor & patch)",
|
|
||||||
matchManagers: [
|
|
||||||
"github-actions",
|
|
||||||
"npm",
|
|
||||||
"custom.regex",
|
|
||||||
],
|
|
||||||
matchUpdateTypes: [
|
|
||||||
"minor",
|
|
||||||
"patch",
|
|
||||||
"digest",
|
|
||||||
],
|
|
||||||
matchFileNames: [
|
|
||||||
"!Chart.yaml",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "Update README.md on changes in values.yaml",
|
|
||||||
matchManagers: [
|
|
||||||
"helm-values",
|
|
||||||
],
|
|
||||||
postUpgradeTasks: {
|
|
||||||
commands: [
|
|
||||||
"install-tool node",
|
|
||||||
"make readme",
|
|
||||||
],
|
|
||||||
fileFilters: [
|
|
||||||
"README.md",
|
|
||||||
],
|
|
||||||
executionMode: "update",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "Override changelog url for Helm image, to have release notes in our PRs",
|
|
||||||
matchDepNames: [
|
|
||||||
"alpine/helm",
|
|
||||||
],
|
|
||||||
changelogUrl: "https://github.com/helm/helm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
description: "Bump Gitea as fast as possible - not only on weekends",
|
|
||||||
matchDepNames: [
|
|
||||||
"go-gitea/gitea",
|
|
||||||
],
|
|
||||||
schedule: [
|
|
||||||
"at any time",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
timeout_delay=15
|
|
||||||
|
|
||||||
check_token() {
|
|
||||||
set +e
|
|
||||||
|
|
||||||
echo "Checking for existing token..."
|
|
||||||
token="$(kubectl get secret "$SECRET_NAME" -o jsonpath="{.data['token']}" 2> /dev/null)"
|
|
||||||
[ $? -ne 0 ] && return 1
|
|
||||||
[ -z "$token" ] && return 2
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
create_token() {
|
|
||||||
echo "Waiting for new token to be generated..."
|
|
||||||
begin=$(date +%s)
|
|
||||||
end=$((begin + timeout_delay))
|
|
||||||
while true; do
|
|
||||||
[ -f /data/actions/token ] && return 0
|
|
||||||
[ "$(date +%s)" -gt $end ] && return 1
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
store_token() {
|
|
||||||
echo "Storing the token in Kubernetes secret..."
|
|
||||||
kubectl patch secret "$SECRET_NAME" -p "{\"data\":{\"token\":\"$(base64 /data/actions/token | tr -d '\n')\"}}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if check_token; then
|
|
||||||
echo "Key already in place, exiting."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! create_token; then
|
|
||||||
echo "Checking for an existing act runner token in secret $SECRET_NAME timed out after $timeout_delay"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
store_token
|
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
function env2ini::log() {
|
function env2ini::log() {
|
||||||
printf "${1}\n"
|
# '%b' expands the \n escapes of the callers without treating the message itself as a format string
|
||||||
|
printf '%b\n' "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function env2ini::read_config_to_env() {
|
function env2ini::read_config_to_env() {
|
||||||
@@ -15,7 +16,8 @@ function env2ini::read_config_to_env() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 'xargs echo -n' trims all leading/trailing whitespaces and a trailing new line
|
# 'xargs echo -n' trims all leading/trailing whitespaces and a trailing new line
|
||||||
local setting="$(awk -F '=' '{print $1}' <<< "${line}" | xargs echo -n)"
|
local setting
|
||||||
|
setting="$(awk -F '=' '{print $1}' <<< "${line}" | xargs echo -n)"
|
||||||
|
|
||||||
if [[ -z "${setting}" ]]; then
|
if [[ -z "${setting}" ]]; then
|
||||||
env2ini::log ' ! invalid setting'
|
env2ini::log ' ! invalid setting'
|
||||||
@@ -54,7 +56,8 @@ function env2ini::reload_preset_envs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 'xargs echo -n' trims all leading/trailing whitespaces and a trailing new line
|
# 'xargs echo -n' trims all leading/trailing whitespaces and a trailing new line
|
||||||
local setting="$(awk -F '=' '{print $1}' <<< "${line}" | xargs echo -n)"
|
local setting
|
||||||
|
setting="$(awk -F '=' '{print $1}' <<< "${line}" | xargs echo -n)"
|
||||||
|
|
||||||
if [[ -z "${setting}" ]]; then
|
if [[ -z "${setting}" ]]; then
|
||||||
env2ini::log ' ! invalid setting'
|
env2ini::log ' ! invalid setting'
|
||||||
@@ -75,12 +78,13 @@ function env2ini::reload_preset_envs() {
|
|||||||
export "${setting^^}=${value}" # '^^' makes the variable content uppercase
|
export "${setting^^}=${value}" # '^^' makes the variable content uppercase
|
||||||
done < "$TMP_EXISTING_ENVS_FILE"
|
done < "$TMP_EXISTING_ENVS_FILE"
|
||||||
|
|
||||||
rm $TMP_EXISTING_ENVS_FILE
|
rm "$TMP_EXISTING_ENVS_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
function env2ini::process_config_file() {
|
function env2ini::process_config_file() {
|
||||||
local config_file="${1}"
|
local config_file="${1}"
|
||||||
local section="$(basename "${config_file}")"
|
local section
|
||||||
|
section="$(basename "${config_file}")"
|
||||||
|
|
||||||
if [[ $section == '_generals_' ]]; then
|
if [[ $section == '_generals_' ]]; then
|
||||||
env2ini::log " [ini root]"
|
env2ini::log " [ini root]"
|
||||||
@@ -100,7 +104,7 @@ function env2ini::load_config_sources() {
|
|||||||
if [[ -d "${path}" ]]; then
|
if [[ -d "${path}" ]]; then
|
||||||
env2ini::log "Processing $(basename "${path}")..."
|
env2ini::log "Processing $(basename "${path}")..."
|
||||||
|
|
||||||
while read -d '' configFile; do
|
while read -r -d '' configFile; do
|
||||||
env2ini::process_config_file "${configFile}"
|
env2ini::process_config_file "${configFile}"
|
||||||
done < <(find "${path}" -type l -not -name '..data' -print0)
|
done < <(find "${path}" -type l -not -name '..data' -print0)
|
||||||
|
|
||||||
@@ -114,16 +118,20 @@ function env2ini::generate_initial_secrets() {
|
|||||||
# - initially used to set up Gitea
|
# - initially used to set up Gitea
|
||||||
# Anyway, they won't harm existing app.ini files
|
# Anyway, they won't harm existing app.ini files
|
||||||
|
|
||||||
export GITEA__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN)
|
GITEA__SECURITY__INTERNAL_TOKEN="$(gitea generate secret INTERNAL_TOKEN)"
|
||||||
export GITEA__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY)
|
GITEA__SECURITY__SECRET_KEY="$(gitea generate secret SECRET_KEY)"
|
||||||
export GITEA__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET)
|
GITEA__OAUTH2__JWT_SECRET="$(gitea generate secret JWT_SECRET)"
|
||||||
export GITEA__SERVER__LFS_JWT_SECRET=$(gitea generate secret LFS_JWT_SECRET)
|
GITEA__SERVER__LFS_JWT_SECRET="$(gitea generate secret LFS_JWT_SECRET)"
|
||||||
|
export GITEA__SECURITY__INTERNAL_TOKEN \
|
||||||
|
GITEA__SECURITY__SECRET_KEY \
|
||||||
|
GITEA__OAUTH2__JWT_SECRET \
|
||||||
|
GITEA__SERVER__LFS_JWT_SECRET
|
||||||
|
|
||||||
env2ini::log "...Initial secrets generated\n"
|
env2ini::log "...Initial secrets generated\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# save existing envs prior to script execution. Necessary to keep order of preexisting and custom envs
|
# save existing envs prior to script execution. Necessary to keep order of preexisting and custom envs
|
||||||
env | (grep -e '^GITEA__' || [[ $? == 1 ]]) > $TMP_EXISTING_ENVS_FILE
|
env | (grep -e '^GITEA__' || [[ $? == 1 ]]) > "$TMP_EXISTING_ENVS_FILE"
|
||||||
|
|
||||||
# MUST BE CALLED BEFORE OTHER CONFIGURATION
|
# MUST BE CALLED BEFORE OTHER CONFIGURATION
|
||||||
env2ini::generate_initial_secrets
|
env2ini::generate_initial_secrets
|
||||||
@@ -137,7 +145,7 @@ env2ini::reload_preset_envs
|
|||||||
env2ini::log "=== All configuration sources loaded ===\n"
|
env2ini::log "=== All configuration sources loaded ===\n"
|
||||||
|
|
||||||
# safety to prevent rewrite of secret keys if an app.ini already exists
|
# safety to prevent rewrite of secret keys if an app.ini already exists
|
||||||
if [ -f ${GITEA_APP_INI} ]; then
|
if [ -f "${GITEA_APP_INI}" ]; then
|
||||||
env2ini::log 'An app.ini file already exists. To prevent overwriting secret keys, these settings are dropped and remain unchanged:'
|
env2ini::log 'An app.ini file already exists. To prevent overwriting secret keys, these settings are dropped and remain unchanged:'
|
||||||
env2ini::log ' - security.INTERNAL_TOKEN'
|
env2ini::log ' - security.INTERNAL_TOKEN'
|
||||||
env2ini::log ' - security.SECRET_KEY'
|
env2ini::log ' - security.SECRET_KEY'
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,24 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.cluster.cloudnativePG.annotations" -}}
|
||||||
|
{{- with .Values.cloudnativePG.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "gitea.cluster.cloudnativePG.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.cloudnativePG.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* names */}}
|
||||||
|
|
||||||
|
{{- define "gitea.cluster.cloudnativePG.name" -}}
|
||||||
|
{{ include "gitea.fullname" . }}-postgresql
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.deployment.annotations" -}}
|
||||||
|
{{- with .Values.deployment.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* initContainers */}}
|
||||||
|
|
||||||
|
{{- define "gitea.deployment.initContainers" -}}
|
||||||
|
{{- $links := list "initAppIni" "initConfigureGPG" "initConfigureGitea" "initDirectories" }}
|
||||||
|
{{- range $index, $entry := .Values.deployment.initContainers }}
|
||||||
|
{{- if and (hasKey $entry "container") (hasKey $entry "link") }}
|
||||||
|
{{- fail (printf "deployment.initContainers[%d]: `container` and `link` are mutually exclusive" $index) }}
|
||||||
|
{{- else if hasKey $entry "container" }}
|
||||||
|
{{- list $entry.container | toYaml | nindent 0 }}
|
||||||
|
{{- else if hasKey $entry "link" }}
|
||||||
|
{{- if not (has $entry.link $links) }}
|
||||||
|
{{- fail (printf "deployment.initContainers[%d]: unknown link `%s`, expected one of: %s" $index $entry.link (join ", " $links)) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with include (printf "gitea.initContainer.%s" $entry.link) $ }}
|
||||||
|
{{- nindent 0 . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- fail (printf "deployment.initContainers[%d]: either `container` or `link` must be set" $index) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "gitea.deployment.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.deployment.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
+28
-76
@@ -43,15 +43,25 @@ Create chart name and version as used by the chart label.
|
|||||||
Create image name and tag used by the deployment.
|
Create image name and tag used by the deployment.
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "gitea.image" -}}
|
{{- define "gitea.image" -}}
|
||||||
{{- $fullOverride := .Values.deployment.gitea.image.fullOverride | default "" -}}
|
{{- include "gitea.image.name" (list . .Values.deployment.gitea.image) -}}
|
||||||
{{- $registry := .Values.global.imageRegistry | default .Values.deployment.gitea.image.registry -}}
|
{{- end -}}
|
||||||
{{- $repository := .Values.deployment.gitea.image.repository -}}
|
|
||||||
|
{{/*
|
||||||
|
Create image name and tag from an arbitrary `image` dict.
|
||||||
|
Arguments: (list $root $image)
|
||||||
|
*/}}
|
||||||
|
{{- define "gitea.image.name" -}}
|
||||||
|
{{- $root := index . 0 -}}
|
||||||
|
{{- $image := index . 1 -}}
|
||||||
|
{{- $fullOverride := $image.fullOverride | default "" -}}
|
||||||
|
{{- $registry := $root.Values.global.imageRegistry | default $image.registry -}}
|
||||||
|
{{- $repository := $image.repository -}}
|
||||||
{{- $separator := ":" -}}
|
{{- $separator := ":" -}}
|
||||||
{{- $tag := .Values.deployment.gitea.image.tag | default .Chart.AppVersion | toString -}}
|
{{- $tag := $image.tag | default $root.Chart.AppVersion | toString -}}
|
||||||
{{- $rootless := ternary "-rootless" "" (.Values.deployment.gitea.image.rootless) -}}
|
{{- $rootless := ternary "-rootless" "" ($image.rootless) -}}
|
||||||
{{- $digest := "" -}}
|
{{- $digest := "" -}}
|
||||||
{{- if .Values.deployment.gitea.image.digest }}
|
{{- if $image.digest }}
|
||||||
{{- $digest = (printf "@%s" (.Values.deployment.gitea.image.digest | toString)) -}}
|
{{- $digest = (printf "@%s" ($image.digest | toString)) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if $fullOverride }}
|
{{- if $fullOverride }}
|
||||||
{{- printf "%s" $fullOverride -}}
|
{{- printf "%s" $fullOverride -}}
|
||||||
@@ -91,13 +101,11 @@ false
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Return the pod's hostUsers setting when OpenShift compatibility is enabled.
|
Return the pod's hostUsers setting. Renders nothing unless explicitly set to a boolean.
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "gitea.hostUsers" -}}
|
{{- define "gitea.hostUsers" -}}
|
||||||
{{- if eq (include "gitea.openshift.enabled" . | trim) "true" -}}
|
{{- if kindIs "bool" .Values.deployment.hostUsers -}}
|
||||||
{{- if kindIs "bool" .Values.openshift.hostUsers -}}
|
{{ ternary "true" "false" .Values.deployment.hostUsers }}
|
||||||
{{ ternary "true" "false" .Values.openshift.hostUsers }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@@ -146,17 +154,6 @@ These default to runAsUser 1000 outside OpenShift to preserve existing behavior.
|
|||||||
{{- include "gitea.containerSecurityContext" (list $root $containerSecurityContext) -}}
|
{{- include "gitea.containerSecurityContext" (list $root $containerSecurityContext) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
{{/*
|
|
||||||
Storage Class
|
|
||||||
*/}}
|
|
||||||
{{- define "gitea.persistence.storageClass" -}}
|
|
||||||
{{- $storageClass := (tpl ( default "" .Values.persistence.storageClass) .) | default (tpl ( default "" .Values.global.storageClass) .) }}
|
|
||||||
{{- if $storageClass }}
|
|
||||||
storageClassName: {{ $storageClass | quote }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Common labels
|
Common labels
|
||||||
*/}}
|
*/}}
|
||||||
@@ -169,15 +166,6 @@ version: {{ .Values.deployment.gitea.image.tag | default .Chart.AppVersion | quo
|
|||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "gitea.labels.actRunner" -}}
|
|
||||||
helm.sh/chart: {{ include "gitea.chart" . }}
|
|
||||||
app: {{ include "gitea.name" . }}-act-runner
|
|
||||||
{{ include "gitea.selectorLabels.actRunner" . }}
|
|
||||||
app.kubernetes.io/version: {{ .Values.deployment.gitea.image.tag | default .Chart.AppVersion | quote }}
|
|
||||||
version: {{ .Values.deployment.gitea.image.tag | default .Chart.AppVersion | quote }}
|
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Selector labels
|
Selector labels
|
||||||
*/}}
|
*/}}
|
||||||
@@ -186,20 +174,9 @@ app.kubernetes.io/name: {{ include "gitea.name" . }}
|
|||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "gitea.selectorLabels.actRunner" -}}
|
{{- define "cloudnativePG.dns" -}}
|
||||||
app.kubernetes.io/name: {{ include "gitea.name" . }}-act-runner
|
{{- if .Values.cloudnativePG.enabled -}}
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
{{- printf "%s-rw.%s.svc.%s:5432" (include "gitea.cluster.cloudnativePG.name" .) (.Values.namespace | default .Release.Namespace) .Values.clusterDomain -}}
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "postgresql-ha.dns" -}}
|
|
||||||
{{- if (index .Values "postgresql-ha").enabled -}}
|
|
||||||
{{- printf "%s-postgresql-ha-pgpool.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "postgresql-ha" "service" "ports" "postgresql") -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "postgresql.dns" -}}
|
|
||||||
{{- if (index .Values "postgresql").enabled -}}
|
|
||||||
{{- printf "%s-postgresql.%s.svc.%s:%g" .Release.Name .Release.Namespace .Values.clusterDomain .Values.postgresql.global.postgresql.service.ports.postgresql -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@@ -458,48 +435,23 @@ https
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "gitea.inline_configuration.defaults.database" -}}
|
{{- define "gitea.inline_configuration.defaults.database" -}}
|
||||||
{{- if (index .Values "postgresql-ha" "enabled") -}}
|
{{- if .Values.cloudnativePG.enabled -}}
|
||||||
|
{{/* PASSWD is injected as an env-to-ini variable from the credentials Secret. */}}
|
||||||
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
|
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
|
||||||
{{- if not (.Values.gitea.config.database.HOST) -}}
|
{{- if not (.Values.gitea.config.database.HOST) -}}
|
||||||
{{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql-ha.dns" .) -}}
|
{{- $_ := set .Values.gitea.config.database "HOST" (include "cloudnativePG.dns" .) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $_ := set .Values.gitea.config.database "NAME" (index .Values "postgresql-ha" "global" "postgresql" "database") -}}
|
{{- $_ := set .Values.gitea.config.database "NAME" .Values.cloudnativePG.credentials.database -}}
|
||||||
{{- $_ := set .Values.gitea.config.database "USER" (index .Values "postgresql-ha" "global" "postgresql" "username") -}}
|
{{- $_ := set .Values.gitea.config.database "USER" .Values.cloudnativePG.credentials.username -}}
|
||||||
{{- $_ := set .Values.gitea.config.database "PASSWD" (index .Values "postgresql-ha" "global" "postgresql" "password") -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- if (index .Values "postgresql" "enabled") -}}
|
|
||||||
{{- $_ := set .Values.gitea.config.database "DB_TYPE" "postgres" -}}
|
|
||||||
{{- if not (.Values.gitea.config.database.HOST) -}}
|
|
||||||
{{- $_ := set .Values.gitea.config.database "HOST" (include "postgresql.dns" .) -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- $_ := set .Values.gitea.config.database "NAME" .Values.postgresql.global.postgresql.auth.database -}}
|
|
||||||
{{- $_ := set .Values.gitea.config.database "USER" .Values.postgresql.global.postgresql.auth.username -}}
|
|
||||||
{{- $_ := set .Values.gitea.config.database "PASSWD" .Values.postgresql.global.postgresql.auth.password -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "gitea.init-additional-mounts" -}}
|
|
||||||
{{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}}
|
|
||||||
{{- if gt (len .Values.extraInitVolumeMounts) 0 -}}
|
|
||||||
{{- toYaml .Values.extraInitVolumeMounts -}}
|
|
||||||
{{- else if gt (len .Values.extraVolumeMounts) 0 -}}
|
|
||||||
{{- toYaml .Values.extraVolumeMounts -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "gitea.container-additional-mounts" -}}
|
{{- define "gitea.container-additional-mounts" -}}
|
||||||
{{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}}
|
|
||||||
{{- if gt (len .Values.deployment.gitea.volumeMounts) 0 -}}
|
{{- if gt (len .Values.deployment.gitea.volumeMounts) 0 -}}
|
||||||
{{- toYaml .Values.deployment.gitea.volumeMounts -}}
|
{{- toYaml .Values.deployment.gitea.volumeMounts -}}
|
||||||
{{- else if gt (len .Values.extraVolumeMounts) 0 -}}
|
|
||||||
{{- toYaml .Values.extraVolumeMounts -}}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "gitea.serviceAccountName" -}}
|
|
||||||
{{ .Values.serviceAccount.name | default (include "gitea.fullname" .) }}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "ingress.annotations" -}}
|
{{- define "ingress.annotations" -}}
|
||||||
{{- if .Values.ingress.annotations }}
|
{{- if .Values.ingress.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1,32 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.ingress.annotations" -}}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.ingress.enabled" -}}
|
||||||
|
{{- if and .Values.ingress.enabled .Values.service.http.enabled -}}
|
||||||
|
true
|
||||||
|
{{- else -}}
|
||||||
|
false
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "gitea.ingress.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.ingress.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* name */}}
|
||||||
|
|
||||||
|
{{- define "gitea.ingress.name" -}}
|
||||||
|
{{ include "gitea.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,305 @@
|
|||||||
|
{{/* initDirectories */}}
|
||||||
|
|
||||||
|
{{- define "gitea.initContainer.initDirectories" -}}
|
||||||
|
{{- $config := .Values.deployment.initDirectories -}}
|
||||||
|
- name: init-directories
|
||||||
|
image: "{{ include "gitea.image.name" (list . $config.image) }}"
|
||||||
|
imagePullPolicy: {{ $config.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/init_directory_structure.sh"
|
||||||
|
env:
|
||||||
|
- name: GITEA_APP_INI
|
||||||
|
value: /data/gitea/conf/app.ini
|
||||||
|
- name: GITEA_CUSTOM
|
||||||
|
value: /data/gitea
|
||||||
|
- name: GITEA_WORK_DIR
|
||||||
|
value: /data
|
||||||
|
- name: GITEA_TEMP
|
||||||
|
value: /tmp/gitea
|
||||||
|
{{- if .Values.deployment.gitea.env }}
|
||||||
|
{{- toYaml .Values.deployment.gitea.env | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.secrets.gpg.enabled }}
|
||||||
|
- name: GNUPGHOME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "gitea.secret.gpg.name" . }}
|
||||||
|
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.env }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: init
|
||||||
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
|
- name: temp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.persistence.new.subPath }}
|
||||||
|
subPath: {{ .Values.persistence.new.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (include "gitea.containerSecurityContext" (list . (deepCopy ($config.securityContext | default .Values.deployment.gitea.securityContext))) | trim) }}
|
||||||
|
securityContext:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml ($config.resources | default .Values.initContainers.resources) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* initAppIni */}}
|
||||||
|
|
||||||
|
{{- define "gitea.initContainer.initAppIni" -}}
|
||||||
|
{{- $config := .Values.deployment.initAppIni -}}
|
||||||
|
- name: init-app-ini
|
||||||
|
image: "{{ include "gitea.image.name" (list . $config.image) }}"
|
||||||
|
imagePullPolicy: {{ $config.image.pullPolicy }}
|
||||||
|
{{- if .Values.gitea.extraEnvSourceFile }}
|
||||||
|
command:
|
||||||
|
- "/bin/bash"
|
||||||
|
- "-c"
|
||||||
|
args:
|
||||||
|
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/config_environment.sh"
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/config_environment.sh"
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: GITEA_APP_INI
|
||||||
|
value: /data/gitea/conf/app.ini
|
||||||
|
- name: GITEA_CUSTOM
|
||||||
|
value: /data/gitea
|
||||||
|
- name: GITEA_WORK_DIR
|
||||||
|
value: /data
|
||||||
|
- name: GITEA_TEMP
|
||||||
|
value: /tmp/gitea
|
||||||
|
- name: TMP_EXISTING_ENVS_FILE
|
||||||
|
value: /tmp/existing-envs
|
||||||
|
- name: ENV_TO_INI_MOUNT_POINT
|
||||||
|
value: /env-to-ini-mounts
|
||||||
|
{{- if .Values.cloudnativePG.enabled }}
|
||||||
|
- name: GITEA__database__PASSWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: {{ include "gitea.secret.cloudnativePG.passwordKey" . }}
|
||||||
|
name: {{ include "gitea.secret.cloudnativePG.name" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.gitea.env }}
|
||||||
|
{{- toYaml .Values.deployment.gitea.env | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.additionalConfigFromEnvs }}
|
||||||
|
{{- tpl (toYaml .Values.gitea.additionalConfigFromEnvs) $ | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.env }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
|
- name: temp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.persistence.new.subPath }}
|
||||||
|
subPath: {{ .Values.persistence.new.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
- name: inline-config-sources
|
||||||
|
mountPath: /env-to-ini-mounts/inlines/
|
||||||
|
{{- range $idx, $value := .Values.gitea.additionalConfigSources }}
|
||||||
|
- name: additional-config-sources-{{ $idx }}
|
||||||
|
mountPath: "/env-to-ini-mounts/additionals/{{ $idx }}/"
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (include "gitea.containerSecurityContext" (list . (deepCopy ($config.securityContext | default .Values.deployment.gitea.securityContext))) | trim) }}
|
||||||
|
securityContext:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml ($config.resources | default .Values.initContainers.resources) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* initConfigureGPG */}}
|
||||||
|
|
||||||
|
{{- define "gitea.initContainer.initConfigureGPG" -}}
|
||||||
|
{{- $config := .Values.deployment.initConfigureGPG -}}
|
||||||
|
{{- if .Values.secrets.gpg.enabled -}}
|
||||||
|
- name: configure-gpg
|
||||||
|
image: "{{ include "gitea.image.name" (list . $config.image) }}"
|
||||||
|
{{- if .Values.gitea.extraEnvSourceFile }}
|
||||||
|
command:
|
||||||
|
- "/bin/bash"
|
||||||
|
- "-c"
|
||||||
|
args:
|
||||||
|
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/configure_gpg_environment.sh"
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gpg_environment.sh"
|
||||||
|
{{- end }}
|
||||||
|
imagePullPolicy: {{ $config.image.pullPolicy }}
|
||||||
|
{{- with (include "gitea.commandInitContainerSecurityContext" (list . (deepCopy ($config.securityContext | default .Values.deployment.gitea.securityContext))) | trim) }}
|
||||||
|
securityContext:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: GNUPGHOME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "gitea.secret.gpg.name" . }}
|
||||||
|
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
||||||
|
- name: TMP_RAW_GPG_KEY
|
||||||
|
value: /raw/private.asc
|
||||||
|
{{- with $config.env }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: init
|
||||||
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.persistence.new.subPath }}
|
||||||
|
subPath: {{ .Values.persistence.new.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
- name: gpg-private-key
|
||||||
|
mountPath: /raw
|
||||||
|
readOnly: true
|
||||||
|
{{- with $config.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml ($config.resources | default .Values.initContainers.resources) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* initConfigureGitea */}}
|
||||||
|
|
||||||
|
{{- define "gitea.initContainer.initConfigureGitea" -}}
|
||||||
|
{{- $config := .Values.deployment.initConfigureGitea -}}
|
||||||
|
- name: configure-gitea
|
||||||
|
image: "{{ include "gitea.image.name" (list . $config.image) }}"
|
||||||
|
{{- if .Values.gitea.extraEnvSourceFile }}
|
||||||
|
command:
|
||||||
|
- "/bin/bash"
|
||||||
|
- "-c"
|
||||||
|
args:
|
||||||
|
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/configure_gitea.sh"
|
||||||
|
{{- else }}
|
||||||
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gitea.sh"
|
||||||
|
{{- end }}
|
||||||
|
imagePullPolicy: {{ $config.image.pullPolicy }}
|
||||||
|
{{- with (include "gitea.commandInitContainerSecurityContext" (list . (deepCopy ($config.securityContext | default .Values.deployment.gitea.securityContext))) | trim) }}
|
||||||
|
securityContext:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: GITEA_APP_INI
|
||||||
|
value: /data/gitea/conf/app.ini
|
||||||
|
- name: GITEA_CUSTOM
|
||||||
|
value: /data/gitea
|
||||||
|
- name: GITEA_WORK_DIR
|
||||||
|
value: /data
|
||||||
|
- name: GITEA_TEMP
|
||||||
|
value: /tmp/gitea
|
||||||
|
{{- if $config.image.rootless }}
|
||||||
|
- name: HOME
|
||||||
|
value: /data/gitea/git
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.ldap }}
|
||||||
|
{{- range $idx, $value := .Values.gitea.ldap }}
|
||||||
|
{{- if $value.existingSecret }}
|
||||||
|
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: bindDn
|
||||||
|
name: {{ $value.existingSecret }}
|
||||||
|
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: bindPassword
|
||||||
|
name: {{ $value.existingSecret }}
|
||||||
|
{{- else }}
|
||||||
|
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
||||||
|
value: {{ $value.bindDn | quote }}
|
||||||
|
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
||||||
|
value: {{ $value.bindPassword | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.oauth }}
|
||||||
|
{{- range $idx, $value := .Values.gitea.oauth }}
|
||||||
|
{{- if $value.existingSecret }}
|
||||||
|
- name: GITEA_OAUTH_KEY_{{ $idx }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: key
|
||||||
|
name: {{ $value.existingSecret }}
|
||||||
|
- name: GITEA_OAUTH_SECRET_{{ $idx }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: secret
|
||||||
|
name: {{ $value.existingSecret }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.secrets.admin.enabled }}
|
||||||
|
- name: GITEA_ADMIN_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: {{ include "gitea.secret.admin.usernameKey" . }}
|
||||||
|
name: {{ include "gitea.secret.admin.name" . }}
|
||||||
|
- name: GITEA_ADMIN_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: {{ include "gitea.secret.admin.passwordKey" . }}
|
||||||
|
name: {{ include "gitea.secret.admin.name" . }}
|
||||||
|
- name: GITEA_ADMIN_EMAIL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: {{ include "gitea.secret.admin.emailKey" . }}
|
||||||
|
name: {{ include "gitea.secret.admin.name" . }}
|
||||||
|
- name: GITEA_ADMIN_PASSWORD_MODE
|
||||||
|
value: {{ include "gitea.secret.admin.passwordMode" $ }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.gitea.env }}
|
||||||
|
{{- toYaml .Values.deployment.gitea.env | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.env }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: init
|
||||||
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
|
- name: temp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.persistence.new.subPath }}
|
||||||
|
subPath: {{ .Values.persistence.new.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $config.volumeMounts }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml ($config.resources | default .Values.initContainers.resources) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.persistentVolumeClaim.annotations" -}}
|
||||||
|
{{- with .Values.persistence.new.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* enabled */}}
|
||||||
|
|
||||||
|
{{- define "gitea.persistentVolumeClaim.enabled" -}}
|
||||||
|
{{- if and .Values.persistence.enabled (not .Values.persistence.existingPersistentVolumeClaim.enabled) -}}
|
||||||
|
true
|
||||||
|
{{- else -}}
|
||||||
|
false
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "gitea.persistentVolumeClaim.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.persistence.new.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* name */}}
|
||||||
|
|
||||||
|
{{- define "gitea.persistentVolumeClaim.name" -}}
|
||||||
|
{{- if .Values.persistence.existingPersistentVolumeClaim.enabled -}}
|
||||||
|
{{ required "persistence.existingPersistentVolumeClaim.persistentVolumeClaimName is required when persistence.existingPersistentVolumeClaim.enabled is true" .Values.persistence.existingPersistentVolumeClaim.persistentVolumeClaimName }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ include "gitea.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.pod.annotations" -}}
|
||||||
|
|
||||||
|
{{/* secret - admin */}}
|
||||||
|
{{- if and .Values.secrets.admin.enabled .Values.secrets.admin.addSHASumAnnotation }}
|
||||||
|
checksum/admin: {{ include "gitea.secret.checksum" (list . "admin") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - cloudnativePG */}}
|
||||||
|
{{- if and .Values.cloudnativePG.enabled .Values.cloudnativePG.credentials.addSHASumAnnotation }}
|
||||||
|
checksum/cloudnativePG: {{ include "gitea.secret.checksum" (list . "cloudnativePG") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - config */}}
|
||||||
|
{{- if and .Values.secrets.config.enabled .Values.secrets.config.addSHASumAnnotation }}
|
||||||
|
checksum/config: {{ include "gitea.secret.checksum" (list . "config") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - gpg */}}
|
||||||
|
{{- if and .Values.secrets.gpg.enabled .Values.secrets.gpg.addSHASumAnnotation }}
|
||||||
|
checksum/gpg: {{ include "gitea.secret.checksum" (list . "gpg") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - init */}}
|
||||||
|
{{- if and .Values.secrets.init.enabled .Values.secrets.init.addSHASumAnnotation }}
|
||||||
|
checksum/init: {{ include "gitea.secret.checksum" (list . "init") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - inlineConfig */}}
|
||||||
|
{{- if and .Values.secrets.inlineConfig.enabled .Values.secrets.inlineConfig.addSHASumAnnotation }}
|
||||||
|
checksum/inlineConfig: {{ include "gitea.secret.checksum" (list . "inlineConfig") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - metrics */}}
|
||||||
|
{{- if and .Values.secrets.metrics.enabled .Values.secrets.metrics.addSHASumAnnotation }}
|
||||||
|
checksum/metrics: {{ include "gitea.secret.checksum" (list . "metrics") }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - ldap */}}
|
||||||
|
{{- range $idx, $value := .Values.gitea.ldap }}
|
||||||
|
checksum/ldap_{{ $idx }}: {{ include "gitea.ldap_settings" (list $idx $value) | sha256sum }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* secret - oauth */}}
|
||||||
|
{{- range $idx, $value := .Values.gitea.oauth }}
|
||||||
|
checksum/oauth_{{ $idx }}: {{ include "gitea.oauth_settings" (list $idx $value) | sha256sum }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* custom pod annotations */}}
|
||||||
|
{{- with .Values.gitea.podAnnotations }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
@@ -8,6 +8,12 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.secret.cloudnativePG.annotations" -}}
|
||||||
|
{{- with .Values.cloudnativePG.credentials.new.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "gitea.secret.config.annotations" -}}
|
{{- define "gitea.secret.config.annotations" -}}
|
||||||
{{- with .Values.secrets.config.new.annotations }}
|
{{- with .Values.secrets.config.new.annotations }}
|
||||||
{{- toYaml . -}}
|
{{- toYaml . -}}
|
||||||
@@ -38,6 +44,31 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* checksums */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
SHA sum of a Secret, used to trigger a rollout whenever its content changes.
|
||||||
|
User-provided Secrets are looked up in the cluster, chart-managed ones are rendered, because the
|
||||||
|
cluster still holds their pre-upgrade state.
|
||||||
|
Arguments: (list $root $key)
|
||||||
|
*/}}
|
||||||
|
{{- define "gitea.secret.checksum" -}}
|
||||||
|
{{- $root := index . 0 -}}
|
||||||
|
{{- $key := index . 1 -}}
|
||||||
|
{{- $config := index $root.Values.secrets $key -}}
|
||||||
|
{{- if eq $key "cloudnativePG" -}}
|
||||||
|
{{- $config = $root.Values.cloudnativePG.credentials -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if $config.existingSecret.enabled -}}
|
||||||
|
{{- $namespace := $root.Values.namespace | default $root.Release.Namespace -}}
|
||||||
|
{{- $name := include (printf "gitea.secret.%s.name" $key) $root -}}
|
||||||
|
{{- lookup "v1" "Secret" $namespace $name | toYaml | sha256sum -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- include (printf "%s/secret_%s.yaml" $root.Template.BasePath $key) $root | sha256sum -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
{{/* labels */}}
|
{{/* labels */}}
|
||||||
|
|
||||||
{{- define "gitea.secret.admin.labels" -}}
|
{{- define "gitea.secret.admin.labels" -}}
|
||||||
@@ -47,6 +78,13 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.secret.cloudnativePG.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.cloudnativePG.credentials.new.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "gitea.secret.config.labels" -}}
|
{{- define "gitea.secret.config.labels" -}}
|
||||||
{{ include "gitea.labels" . }}
|
{{ include "gitea.labels" . }}
|
||||||
{{- with .Values.secrets.config.new.labels }}
|
{{- with .Values.secrets.config.new.labels }}
|
||||||
@@ -92,6 +130,14 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.secret.cloudnativePG.name" -}}
|
||||||
|
{{- if .Values.cloudnativePG.credentials.existingSecret.enabled -}}
|
||||||
|
{{ required "`cloudnativePG.credentials.existingSecret.secretName` must be set when `cloudnativePG.credentials.existingSecret.enabled` is enabled" .Values.cloudnativePG.credentials.existingSecret.secretName }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ include "gitea.cluster.cloudnativePG.name" . }}-app
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "gitea.secret.config.name" -}}
|
{{- define "gitea.secret.config.name" -}}
|
||||||
{{- if .Values.secrets.config.existingSecret.enabled -}}
|
{{- if .Values.secrets.config.existingSecret.enabled -}}
|
||||||
{{ required "`secrets.config.existingSecret.secretName` must be set when `secrets.config.existingSecret.enabled` is enabled" .Values.secrets.config.existingSecret.secretName }}
|
{{ required "`secrets.config.existingSecret.secretName` must be set when `secrets.config.existingSecret.enabled` is enabled" .Values.secrets.config.existingSecret.secretName }}
|
||||||
@@ -158,6 +204,14 @@ username
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.secret.cloudnativePG.passwordKey" -}}
|
||||||
|
{{- if .Values.cloudnativePG.credentials.existingSecret.enabled -}}
|
||||||
|
{{ .Values.cloudnativePG.credentials.existingSecret.passwordKey }}
|
||||||
|
{{- else -}}
|
||||||
|
password
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "gitea.secret.gpg.gpgHomeKey" -}}
|
{{- define "gitea.secret.gpg.gpgHomeKey" -}}
|
||||||
{{- if .Values.secrets.gpg.existingSecret.enabled -}}
|
{{- if .Values.secrets.gpg.existingSecret.enabled -}}
|
||||||
{{ .Values.secrets.gpg.existingSecret.gpgHomeKey }}
|
{{ .Values.secrets.gpg.existingSecret.gpgHomeKey }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/* annotations */}}
|
||||||
|
|
||||||
|
{{- define "gitea.serviceAccount.annotations" -}}
|
||||||
|
{{- with .Values.serviceAccount.new.annotations }}
|
||||||
|
{{- toYaml . -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* enabled */}}
|
||||||
|
|
||||||
|
{{- define "gitea.serviceAccount.enabled" -}}
|
||||||
|
{{- if and .Values.serviceAccount.enabled (not .Values.serviceAccount.existingServiceAccount.enabled) -}}
|
||||||
|
true
|
||||||
|
{{- else -}}
|
||||||
|
false
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* labels */}}
|
||||||
|
|
||||||
|
{{- define "gitea.serviceAccount.labels" -}}
|
||||||
|
{{ include "gitea.labels" . }}
|
||||||
|
{{- with .Values.serviceAccount.new.labels }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/* name */}}
|
||||||
|
|
||||||
|
{{- define "gitea.serviceAccount.name" -}}
|
||||||
|
{{- if .Values.serviceAccount.existingServiceAccount.enabled -}}
|
||||||
|
{{ required "serviceAccount.existingServiceAccount.existingServiceAccountName is required when serviceAccount.existingServiceAccount.enabled is true" .Values.serviceAccount.existingServiceAccount.existingServiceAccountName }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ include "gitea.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,51 @@
|
|||||||
|
{{- if .Values.cloudnativePG.enabled -}}
|
||||||
|
{{- $registry := .Values.global.imageRegistry | default .Values.cloudnativePG.image.registry -}}
|
||||||
|
apiVersion: postgresql.cnpg.io/v1
|
||||||
|
kind: Cluster
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.cluster.cloudnativePG.annotations" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.cluster.cloudnativePG.labels" . | nindent 4 }}
|
||||||
|
name: {{ include "gitea.cluster.cloudnativePG.name" . }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.cloudnativePG.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
bootstrap:
|
||||||
|
initdb:
|
||||||
|
database: {{ .Values.cloudnativePG.credentials.database | quote }}
|
||||||
|
owner: {{ .Values.cloudnativePG.credentials.username | quote }}
|
||||||
|
secret:
|
||||||
|
name: {{ include "gitea.secret.cloudnativePG.name" . }}
|
||||||
|
imageName: {{ printf "%s/%s:%s" $registry .Values.cloudnativePG.image.repository (.Values.cloudnativePG.image.tag | toString) | quote }}
|
||||||
|
instances: {{ .Values.cloudnativePG.instances }}
|
||||||
|
monitoring:
|
||||||
|
enablePodMonitor: {{ .Values.cloudnativePG.monitoring.enablePodMonitor }}
|
||||||
|
postgresql:
|
||||||
|
parameters:
|
||||||
|
{{- toYaml .Values.cloudnativePG.postgresql.parameters | nindent 6 }}
|
||||||
|
priorityClassName: {{ .Values.cloudnativePG.priorityClassName | quote }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.cloudnativePG.resources | nindent 4 }}
|
||||||
|
storage:
|
||||||
|
size: {{ .Values.cloudnativePG.storage.size | quote }}
|
||||||
|
{{- with .Values.cloudnativePG.storage.storageClass }}
|
||||||
|
storageClass: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cloudnativePG.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cloudnativePG.walStorage.enabled }}
|
||||||
|
walStorage:
|
||||||
|
size: {{ .Values.cloudnativePG.walStorage.size | quote }}
|
||||||
|
{{- with .Values.cloudnativePG.walStorage.storageClass }}
|
||||||
|
storageClass: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
{{- if .Values.deployment.enabled -}}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.deployment.annotations" . | fromYaml) }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (include "gitea.deployment.labels" . | fromYaml) }}
|
||||||
|
labels:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ include "gitea.fullname" . }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.deployment.replicas }}
|
||||||
|
strategy:
|
||||||
|
type: {{ .Values.deployment.strategy.type }}
|
||||||
|
{{- if eq .Values.deployment.strategy.type "RollingUpdate" }}
|
||||||
|
rollingUpdate:
|
||||||
|
maxUnavailable: {{ .Values.deployment.strategy.rollingUpdate.maxUnavailable }}
|
||||||
|
maxSurge: {{ .Values.deployment.strategy.rollingUpdate.maxSurge }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.pod.annotations" . | fromYaml) }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.labels" . | nindent 8 }}
|
||||||
|
{{- if .Values.deployment.labels }}
|
||||||
|
{{- toYaml .Values.deployment.labels | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- $hostUsers := include "gitea.hostUsers" . | trim }}
|
||||||
|
{{- $securityContext := include "gitea.deployment.securityContext" . | trim }}
|
||||||
|
{{- $containerSecurityContext := include "gitea.containerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }}
|
||||||
|
{{- if .Values.deployment.schedulerName }}
|
||||||
|
schedulerName: "{{ .Values.deployment.schedulerName }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.serviceAccount.enabled }}
|
||||||
|
serviceAccountName: {{ include "gitea.serviceAccount.name" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.priorityClassName }}
|
||||||
|
priorityClassName: "{{ .Values.deployment.priorityClassName }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- if $hostUsers }}
|
||||||
|
hostUsers: {{ $hostUsers }}
|
||||||
|
{{- end }}
|
||||||
|
{{- include "gitea.images.pullSecrets" . | nindent 6 }}
|
||||||
|
{{- if $securityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- $securityContext | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
initContainers:
|
||||||
|
{{- include "gitea.deployment.initContainers" . | trim | nindent 8 }}
|
||||||
|
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
image: "{{ include "gitea.image" . }}"
|
||||||
|
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
||||||
|
env:
|
||||||
|
# SSH Port values have to be set here as well for openssh configuration
|
||||||
|
- name: SSH_LISTEN_PORT
|
||||||
|
value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }}
|
||||||
|
- name: SSH_PORT
|
||||||
|
value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
|
||||||
|
{{- if not .Values.deployment.gitea.image.rootless }}
|
||||||
|
- name: SSH_LOG_LEVEL
|
||||||
|
value: {{ .Values.gitea.ssh.logLevel | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: GITEA_APP_INI
|
||||||
|
value: /data/gitea/conf/app.ini
|
||||||
|
- name: GITEA_CUSTOM
|
||||||
|
value: /data/gitea
|
||||||
|
- name: GITEA_WORK_DIR
|
||||||
|
value: /data
|
||||||
|
- name: GITEA_TEMP
|
||||||
|
value: /tmp/gitea
|
||||||
|
{{- with .Values.deployment.gitea.resources }}
|
||||||
|
{{- if and (hasKey . "limits") (hasKey (.limits | default dict) "cpu") }}
|
||||||
|
- name: GOMAXPROCS
|
||||||
|
valueFrom:
|
||||||
|
resourceFieldRef:
|
||||||
|
divisor: "1"
|
||||||
|
resource: limits.cpu
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: TMPDIR
|
||||||
|
value: /tmp/gitea
|
||||||
|
{{- if .Values.deployment.gitea.image.rootless }}
|
||||||
|
- name: HOME
|
||||||
|
value: /data/gitea/git
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.secrets.gpg.enabled }}
|
||||||
|
- name: GNUPGHOME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "gitea.secret.gpg.name" . }}
|
||||||
|
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.gitea.env }}
|
||||||
|
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.gitea.envFrom }}
|
||||||
|
envFrom:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: ssh
|
||||||
|
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
||||||
|
{{- if .Values.service.ssh.hostPort }}
|
||||||
|
hostPort: {{ .Values.service.ssh.hostPort }}
|
||||||
|
{{- end }}
|
||||||
|
- name: http
|
||||||
|
containerPort: {{ .Values.gitea.config.server.HTTP_PORT }}
|
||||||
|
{{- if .Values.gitea.config.server.ENABLE_PPROF }}
|
||||||
|
- name: profiler
|
||||||
|
containerPort: 6060
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.livenessProbe.enabled }}
|
||||||
|
livenessProbe:
|
||||||
|
{{- include "gitea.deployment.probe" .Values.gitea.livenessProbe | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.readinessProbe.enabled }}
|
||||||
|
readinessProbe:
|
||||||
|
{{- include "gitea.deployment.probe" .Values.gitea.readinessProbe | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.gitea.startupProbe.enabled }}
|
||||||
|
startupProbe:
|
||||||
|
{{- include "gitea.deployment.probe" .Values.gitea.startupProbe | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml (.Values.deployment.gitea.resources | default dict) | nindent 12 }}
|
||||||
|
{{- if $containerSecurityContext }}
|
||||||
|
securityContext:
|
||||||
|
{{- $containerSecurityContext | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: temp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if .Values.persistence.new.subPath }}
|
||||||
|
subPath: {{ .Values.persistence.new.subPath }}
|
||||||
|
{{- end }}
|
||||||
|
{{- include "gitea.container-additional-mounts" . | nindent 12 }}
|
||||||
|
{{- if .Values.extraContainers }}
|
||||||
|
{{- toYaml .Values.extraContainers | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.global.hostAliases }}
|
||||||
|
hostAliases:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.dnsConfig }}
|
||||||
|
dnsConfig:
|
||||||
|
{{- toYaml .Values.deployment.dnsConfig | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.deployment.resources }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
- name: init
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "gitea.secret.init.name" . }}
|
||||||
|
defaultMode: 110
|
||||||
|
- name: config
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "gitea.secret.config.name" . }}
|
||||||
|
defaultMode: 110
|
||||||
|
{{- if gt (len .Values.deployment.volumes) 0 }}
|
||||||
|
{{- toYaml .Values.deployment.volumes | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: inline-config-sources
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "gitea.secret.inlineConfig.name" . }}
|
||||||
|
{{- range $idx, $value := .Values.gitea.additionalConfigSources }}
|
||||||
|
- name: additional-config-sources-{{ $idx }}
|
||||||
|
{{- toYaml $value | nindent 10 }}
|
||||||
|
{{- end }}
|
||||||
|
- name: temp
|
||||||
|
emptyDir: {}
|
||||||
|
{{- if .Values.secrets.gpg.enabled }}
|
||||||
|
- name: gpg-private-key
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "gitea.secret.gpg.name" . }}
|
||||||
|
items:
|
||||||
|
- key: {{ include "gitea.secret.gpg.privateKeyKey" . }}
|
||||||
|
path: private.asc
|
||||||
|
defaultMode: 0100
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.persistence.enabled }}
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: {{ include "gitea.persistentVolumeClaim.name" . }}
|
||||||
|
{{- else }}
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -65,16 +65,46 @@
|
|||||||
{{- fail "`extraContainerVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` instead." -}}
|
{{- fail "`extraContainerVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* EXTRA INIT VOLUME MOUNTS */}}
|
||||||
|
{{- if .Values.extraInitVolumeMounts -}}
|
||||||
|
{{- fail "`extraInitVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.<initContainer>.volumeMounts` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* EXTRA VOLUME MOUNTS */}}
|
||||||
|
{{- if .Values.extraVolumeMounts -}}
|
||||||
|
{{- fail "`extraVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` and `deployment.<initContainer>.volumeMounts` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* EXTRA VOLUMES */}}
|
{{/* EXTRA VOLUMES */}}
|
||||||
{{- if .Values.extraVolumes -}}
|
{{- if .Values.extraVolumes -}}
|
||||||
{{- fail "`extraVolumes` does no longer exist. Please refer to the changelog and configure `deployment.volumes` instead." -}}
|
{{- fail "`extraVolumes` does no longer exist. Please refer to the changelog and configure `deployment.volumes` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* INGRESS CLASS NAME */}}
|
||||||
|
{{- if hasKey .Values.ingress "className" -}}
|
||||||
|
{{- fail "`ingress.className` does no longer exist. Please refer to the changelog and configure `ingress.ingressClassName` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* NODE SELECTOR */}}
|
{{/* NODE SELECTOR */}}
|
||||||
{{- if .Values.nodeSelector -}}
|
{{- if .Values.nodeSelector -}}
|
||||||
{{- fail "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." -}}
|
{{- fail "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* OPENSHIFT HOST USERS */}}
|
||||||
|
{{- if hasKey .Values.openshift "hostUsers" -}}
|
||||||
|
{{- fail "`openshift.hostUsers` does no longer exist. Please refer to the changelog and configure `deployment.hostUsers` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* POSTGRESQL */}}
|
||||||
|
{{- if index .Values "postgresql" -}}
|
||||||
|
{{- fail "`postgresql` does no longer exist. Please refer to the changelog and configure `cloudnativePG` instead, which requires the CloudNativePG operator to be installed in the cluster." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* POSTGRESQL HA */}}
|
||||||
|
{{- if index .Values "postgresql-ha" -}}
|
||||||
|
{{- fail "`postgresql-ha` does no longer exist. Please refer to the changelog and configure `cloudnativePG` instead, which requires the CloudNativePG operator to be installed in the cluster." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* PRIORITY CLASS NAME */}}
|
{{/* PRIORITY CLASS NAME */}}
|
||||||
{{- if .Values.priorityClassName -}}
|
{{- if .Values.priorityClassName -}}
|
||||||
{{- fail "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead." -}}
|
{{- fail "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead." -}}
|
||||||
@@ -85,6 +115,16 @@
|
|||||||
{{- fail "`podSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` instead." -}}
|
{{- fail "`podSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* POST EXTRA INIT CONTAINERS */}}
|
||||||
|
{{- if .Values.postExtraInitContainers -}}
|
||||||
|
{{- fail "`postExtraInitContainers` does no longer exist. Please refer to the changelog and append an entry with a `container` key to `deployment.initContainers` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* PRE EXTRA INIT CONTAINERS */}}
|
||||||
|
{{- if .Values.preExtraInitContainers -}}
|
||||||
|
{{- fail "`preExtraInitContainers` does no longer exist. Please refer to the changelog and prepend an entry with a `container` key to `deployment.initContainers` instead." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* RESOURCES */}}
|
{{/* RESOURCES */}}
|
||||||
{{- if .Values.resources -}}
|
{{- if .Values.resources -}}
|
||||||
{{- fail "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead." -}}
|
{{- fail "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead." -}}
|
||||||
@@ -110,6 +150,11 @@
|
|||||||
{{- fail "`strategy` does no longer exist. Please refer to the changelog and configure `deployment.strategy` instead." -}}
|
{{- fail "`strategy` does no longer exist. Please refer to the changelog and configure `deployment.strategy` instead." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* TEST */}}
|
||||||
|
{{- if .Values.test -}}
|
||||||
|
{{- fail "`test` does no longer exist. Please refer to the changelog. The `helm test` connection Pod has been removed without replacement." -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* TOLERATIONS */}}
|
{{/* TOLERATIONS */}}
|
||||||
{{- if .Values.tolerations -}}
|
{{- if .Values.tolerations -}}
|
||||||
{{- fail "`tolerations` does no longer exist. Please refer to the changelog and configure `deployment.tolerations` instead." -}}
|
{{- fail "`tolerations` does no longer exist. Please refer to the changelog and configure `deployment.tolerations` instead." -}}
|
||||||
File renamed without changes.
@@ -1,491 +0,0 @@
|
|||||||
{{- if .Values.deployment.enabled -}}
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: {{ include "gitea.fullname" . }}
|
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
annotations:
|
|
||||||
{{- if .Values.deployment.annotations }}
|
|
||||||
{{- toYaml .Values.deployment.annotations | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
{{- include "gitea.labels" . | nindent 4 }}
|
|
||||||
{{- if .Values.deployment.labels }}
|
|
||||||
{{- toYaml .Values.deployment.labels | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
replicas: {{ .Values.deployment.replicas }}
|
|
||||||
strategy:
|
|
||||||
type: {{ .Values.deployment.strategy.type }}
|
|
||||||
{{- if eq .Values.deployment.strategy.type "RollingUpdate" }}
|
|
||||||
rollingUpdate:
|
|
||||||
maxUnavailable: {{ .Values.deployment.strategy.rollingUpdate.maxUnavailable }}
|
|
||||||
maxSurge: {{ .Values.deployment.strategy.rollingUpdate.maxSurge }}
|
|
||||||
{{- end }}
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
{{- include "gitea.selectorLabels" . | nindent 6 }}
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
annotations:
|
|
||||||
{{- if and .Values.secrets.admin.addSHASumAnnotation (not .Values.secrets.admin.existingSecret.enabled) }}
|
|
||||||
checksum/admin: {{ include (print $.Template.BasePath "/gitea/secret_admin.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.secrets.config.addSHASumAnnotation (not .Values.secrets.config.existingSecret.enabled) }}
|
|
||||||
checksum/config: {{ include (print $.Template.BasePath "/gitea/secret_config.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.secrets.gpg.addSHASumAnnotation (not .Values.secrets.gpg.existingSecret.enabled) }}
|
|
||||||
checksum/gpg: {{ include (print $.Template.BasePath "/gitea/secret_gpg.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.secrets.init.addSHASumAnnotation (not .Values.secrets.init.existingSecret.enabled) }}
|
|
||||||
checksum/init: {{ include (print $.Template.BasePath "/gitea/secret_init.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.secrets.inlineConfig.addSHASumAnnotation (not .Values.secrets.inlineConfig.existingSecret.enabled) }}
|
|
||||||
checksum/inlineConfig: {{ include (print $.Template.BasePath "/gitea/secret_inlineConfig.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if and .Values.secrets.metrics.addSHASumAnnotation (not .Values.secrets.metrics.existingSecret.enabled) }}
|
|
||||||
checksum/metrics: {{ include (print $.Template.BasePath "/gitea/secret_metrics.yaml") . | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.ldap }}
|
|
||||||
checksum/ldap_{{ $idx }}: {{ include "gitea.ldap_settings" (list $idx $value) | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.oauth }}
|
|
||||||
checksum/oauth_{{ $idx }}: {{ include "gitea.oauth_settings" (list $idx $value) | sha256sum }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.gitea.podAnnotations }}
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
{{- include "gitea.labels" . | nindent 8 }}
|
|
||||||
{{- if .Values.deployment.labels }}
|
|
||||||
{{- toYaml .Values.deployment.labels | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
{{- $hostUsers := include "gitea.hostUsers" . | trim }}
|
|
||||||
{{- $securityContext := include "gitea.deployment.securityContext" . | trim }}
|
|
||||||
{{- $containerSecurityContext := include "gitea.containerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }}
|
|
||||||
{{- $commandInitContainerSecurityContext := include "gitea.commandInitContainerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }}
|
|
||||||
{{- if .Values.deployment.schedulerName }}
|
|
||||||
schedulerName: "{{ .Values.deployment.schedulerName }}"
|
|
||||||
{{- end }}
|
|
||||||
{{- if (or .Values.serviceAccount.create .Values.serviceAccount.name) }}
|
|
||||||
serviceAccountName: {{ include "gitea.serviceAccountName" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.deployment.priorityClassName }}
|
|
||||||
priorityClassName: "{{ .Values.deployment.priorityClassName }}"
|
|
||||||
{{- end }}
|
|
||||||
{{- if $hostUsers }}
|
|
||||||
hostUsers: {{ $hostUsers }}
|
|
||||||
{{- end }}
|
|
||||||
{{- include "gitea.images.pullSecrets" . | nindent 6 }}
|
|
||||||
{{- if $securityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $securityContext | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
initContainers:
|
|
||||||
{{- if .Values.preExtraInitContainers }}
|
|
||||||
{{- toYaml .Values.preExtraInitContainers | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
- name: init-directories
|
|
||||||
image: "{{ include "gitea.image" . }}"
|
|
||||||
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
||||||
command:
|
|
||||||
- "{{ .Values.initContainersScriptsVolumeMountPath }}/init_directory_structure.sh"
|
|
||||||
env:
|
|
||||||
- name: GITEA_APP_INI
|
|
||||||
value: /data/gitea/conf/app.ini
|
|
||||||
- name: GITEA_CUSTOM
|
|
||||||
value: /data/gitea
|
|
||||||
- name: GITEA_WORK_DIR
|
|
||||||
value: /data
|
|
||||||
- name: GITEA_TEMP
|
|
||||||
value: /tmp/gitea
|
|
||||||
{{- if .Values.deployment.gitea.env }}
|
|
||||||
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.secrets.gpg.enabled }}
|
|
||||||
- name: GNUPGHOME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ include "gitea.secret.gpg.name" . }}
|
|
||||||
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: init
|
|
||||||
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
|
||||||
- name: temp
|
|
||||||
mountPath: /tmp
|
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
{{- if .Values.persistence.subPath }}
|
|
||||||
subPath: {{ .Values.persistence.subPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- include "gitea.init-additional-mounts" . | nindent 12 }}
|
|
||||||
{{- if $containerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $containerSecurityContext | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml .Values.initContainers.resources | nindent 12 }}
|
|
||||||
- name: init-app-ini
|
|
||||||
image: "{{ include "gitea.image" . }}"
|
|
||||||
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
||||||
{{- if .Values.gitea.extraEnvSourceFile }}
|
|
||||||
command:
|
|
||||||
- "/bin/bash"
|
|
||||||
- "-c"
|
|
||||||
args:
|
|
||||||
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/config_environment.sh"
|
|
||||||
{{- else }}
|
|
||||||
command:
|
|
||||||
- "{{ .Values.initContainersScriptsVolumeMountPath }}/config_environment.sh"
|
|
||||||
{{- end }}
|
|
||||||
env:
|
|
||||||
- name: GITEA_APP_INI
|
|
||||||
value: /data/gitea/conf/app.ini
|
|
||||||
- name: GITEA_CUSTOM
|
|
||||||
value: /data/gitea
|
|
||||||
- name: GITEA_WORK_DIR
|
|
||||||
value: /data
|
|
||||||
- name: GITEA_TEMP
|
|
||||||
value: /tmp/gitea
|
|
||||||
- name: TMP_EXISTING_ENVS_FILE
|
|
||||||
value: /tmp/existing-envs
|
|
||||||
- name: ENV_TO_INI_MOUNT_POINT
|
|
||||||
value: /env-to-ini-mounts
|
|
||||||
{{- if .Values.deployment.gitea.env }}
|
|
||||||
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.additionalConfigFromEnvs }}
|
|
||||||
{{- tpl (toYaml .Values.gitea.additionalConfigFromEnvs) $ | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: config
|
|
||||||
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
|
||||||
- name: temp
|
|
||||||
mountPath: /tmp
|
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
{{- if .Values.persistence.subPath }}
|
|
||||||
subPath: {{ .Values.persistence.subPath }}
|
|
||||||
{{- end }}
|
|
||||||
- name: inline-config-sources
|
|
||||||
mountPath: /env-to-ini-mounts/inlines/
|
|
||||||
{{- range $idx, $value := .Values.gitea.additionalConfigSources }}
|
|
||||||
- name: additional-config-sources-{{ $idx }}
|
|
||||||
mountPath: "/env-to-ini-mounts/additionals/{{ $idx }}/"
|
|
||||||
{{- end }}
|
|
||||||
{{- include "gitea.init-additional-mounts" . | nindent 12 }}
|
|
||||||
{{- if $containerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $containerSecurityContext | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml .Values.initContainers.resources | nindent 12 }}
|
|
||||||
{{- if .Values.secrets.gpg.enabled }}
|
|
||||||
- name: configure-gpg
|
|
||||||
image: "{{ include "gitea.image" . }}"
|
|
||||||
{{- if .Values.gitea.extraEnvSourceFile }}
|
|
||||||
command:
|
|
||||||
- "/bin/bash"
|
|
||||||
- "-c"
|
|
||||||
args:
|
|
||||||
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/configure_gpg_environment.sh"
|
|
||||||
{{- else }}
|
|
||||||
command:
|
|
||||||
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gpg_environment.sh"
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
||||||
{{- if $commandInitContainerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $commandInitContainerSecurityContext | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
env:
|
|
||||||
- name: GNUPGHOME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ include "gitea.secret.gpg.name" . }}
|
|
||||||
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
|
||||||
- name: TMP_RAW_GPG_KEY
|
|
||||||
value: /raw/private.asc
|
|
||||||
volumeMounts:
|
|
||||||
- name: init
|
|
||||||
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
{{- if .Values.persistence.subPath }}
|
|
||||||
subPath: {{ .Values.persistence.subPath }}
|
|
||||||
{{- end }}
|
|
||||||
- name: gpg-private-key
|
|
||||||
mountPath: /raw
|
|
||||||
readOnly: true
|
|
||||||
{{- if .Values.extraVolumeMounts }}
|
|
||||||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml .Values.initContainers.resources | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
- name: configure-gitea
|
|
||||||
image: "{{ include "gitea.image" . }}"
|
|
||||||
{{- if .Values.gitea.extraEnvSourceFile }}
|
|
||||||
command:
|
|
||||||
- "/bin/bash"
|
|
||||||
- "-c"
|
|
||||||
args:
|
|
||||||
- "test -f {{ .Values.gitea.extraEnvSourceFile }} && source {{ .Values.gitea.extraEnvSourceFile }} || { echo 'ERROR: Failed to source {{ .Values.gitea.extraEnvSourceFile }}'; exit 1; } && {{ .Values.initContainersScriptsVolumeMountPath }}/configure_gitea.sh"
|
|
||||||
{{- else }}
|
|
||||||
command:
|
|
||||||
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gitea.sh"
|
|
||||||
{{- end }}
|
|
||||||
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
||||||
{{- if $commandInitContainerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $commandInitContainerSecurityContext | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
env:
|
|
||||||
- name: GITEA_APP_INI
|
|
||||||
value: /data/gitea/conf/app.ini
|
|
||||||
- name: GITEA_CUSTOM
|
|
||||||
value: /data/gitea
|
|
||||||
- name: GITEA_WORK_DIR
|
|
||||||
value: /data
|
|
||||||
- name: GITEA_TEMP
|
|
||||||
value: /tmp/gitea
|
|
||||||
{{- if .Values.deployment.gitea.image.rootless }}
|
|
||||||
- name: HOME
|
|
||||||
value: /data/gitea/git
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.ldap }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.ldap }}
|
|
||||||
{{- if $value.existingSecret }}
|
|
||||||
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: bindDn
|
|
||||||
name: {{ $value.existingSecret }}
|
|
||||||
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: bindPassword
|
|
||||||
name: {{ $value.existingSecret }}
|
|
||||||
{{- else }}
|
|
||||||
- name: GITEA_LDAP_BIND_DN_{{ $idx }}
|
|
||||||
value: {{ $value.bindDn | quote }}
|
|
||||||
- name: GITEA_LDAP_PASSWORD_{{ $idx }}
|
|
||||||
value: {{ $value.bindPassword | quote }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.oauth }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.oauth }}
|
|
||||||
{{- if $value.existingSecret }}
|
|
||||||
- name: GITEA_OAUTH_KEY_{{ $idx }}
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: key
|
|
||||||
name: {{ $value.existingSecret }}
|
|
||||||
- name: GITEA_OAUTH_SECRET_{{ $idx }}
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: secret
|
|
||||||
name: {{ $value.existingSecret }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.secrets.admin.enabled }}
|
|
||||||
- name: GITEA_ADMIN_USERNAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: {{ include "gitea.secret.admin.usernameKey" . }}
|
|
||||||
name: {{ include "gitea.secret.admin.name" . }}
|
|
||||||
- name: GITEA_ADMIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: {{ include "gitea.secret.admin.passwordKey" . }}
|
|
||||||
name: {{ include "gitea.secret.admin.name" . }}
|
|
||||||
- name: GITEA_ADMIN_EMAIL
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: {{ include "gitea.secret.admin.emailKey" . }}
|
|
||||||
name: {{ include "gitea.secret.admin.name" . }}
|
|
||||||
- name: GITEA_ADMIN_PASSWORD_MODE
|
|
||||||
value: {{ include "gitea.secret.admin.passwordMode" $ }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.deployment.gitea.env }}
|
|
||||||
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: init
|
|
||||||
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
|
||||||
- name: temp
|
|
||||||
mountPath: /tmp
|
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
{{- if .Values.persistence.subPath }}
|
|
||||||
subPath: {{ .Values.persistence.subPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- include "gitea.init-additional-mounts" . | nindent 12 }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml .Values.initContainers.resources | nindent 12 }}
|
|
||||||
{{- if .Values.postExtraInitContainers }}
|
|
||||||
{{- toYaml .Values.postExtraInitContainers | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
|
|
||||||
containers:
|
|
||||||
- name: {{ .Chart.Name }}
|
|
||||||
image: "{{ include "gitea.image" . }}"
|
|
||||||
imagePullPolicy: {{ .Values.deployment.gitea.image.pullPolicy }}
|
|
||||||
env:
|
|
||||||
# SSH Port values have to be set here as well for openssh configuration
|
|
||||||
- name: SSH_LISTEN_PORT
|
|
||||||
value: {{ .Values.gitea.config.server.SSH_LISTEN_PORT | quote }}
|
|
||||||
- name: SSH_PORT
|
|
||||||
value: {{ .Values.gitea.config.server.SSH_PORT | quote }}
|
|
||||||
{{- if not .Values.deployment.gitea.image.rootless }}
|
|
||||||
- name: SSH_LOG_LEVEL
|
|
||||||
value: {{ .Values.gitea.ssh.logLevel | quote }}
|
|
||||||
{{- end }}
|
|
||||||
- name: GITEA_APP_INI
|
|
||||||
value: /data/gitea/conf/app.ini
|
|
||||||
- name: GITEA_CUSTOM
|
|
||||||
value: /data/gitea
|
|
||||||
- name: GITEA_WORK_DIR
|
|
||||||
value: /data
|
|
||||||
- name: GITEA_TEMP
|
|
||||||
value: /tmp/gitea
|
|
||||||
{{- with .Values.deployment.gitea.resources }}
|
|
||||||
{{- if and (hasKey . "limits") (hasKey (.limits | default dict) "cpu") }}
|
|
||||||
- name: GOMAXPROCS
|
|
||||||
valueFrom:
|
|
||||||
resourceFieldRef:
|
|
||||||
divisor: "1"
|
|
||||||
resource: limits.cpu
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
- name: TMPDIR
|
|
||||||
value: /tmp/gitea
|
|
||||||
{{- if .Values.deployment.gitea.image.rootless }}
|
|
||||||
- name: HOME
|
|
||||||
value: /data/gitea/git
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.secrets.gpg.enabled }}
|
|
||||||
- name: GNUPGHOME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ include "gitea.secret.gpg.name" . }}
|
|
||||||
key: {{ include "gitea.secret.gpg.gpgHomeKey" . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.deployment.gitea.env }}
|
|
||||||
{{- toYaml .Values.deployment.gitea.env | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
ports:
|
|
||||||
- name: ssh
|
|
||||||
containerPort: {{ .Values.gitea.config.server.SSH_LISTEN_PORT }}
|
|
||||||
{{- if .Values.service.ssh.hostPort }}
|
|
||||||
hostPort: {{ .Values.service.ssh.hostPort }}
|
|
||||||
{{- end }}
|
|
||||||
- name: http
|
|
||||||
containerPort: {{ .Values.gitea.config.server.HTTP_PORT }}
|
|
||||||
{{- if .Values.gitea.config.server.ENABLE_PPROF }}
|
|
||||||
- name: profiler
|
|
||||||
containerPort: 6060
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.livenessProbe.enabled }}
|
|
||||||
livenessProbe:
|
|
||||||
{{- include "gitea.deployment.probe" .Values.gitea.livenessProbe | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.readinessProbe.enabled }}
|
|
||||||
readinessProbe:
|
|
||||||
{{- include "gitea.deployment.probe" .Values.gitea.readinessProbe | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.gitea.startupProbe.enabled }}
|
|
||||||
startupProbe:
|
|
||||||
{{- include "gitea.deployment.probe" .Values.gitea.startupProbe | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml (.Values.deployment.gitea.resources | default dict) | nindent 12 }}
|
|
||||||
{{- if $containerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $containerSecurityContext | nindent 12 }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMounts:
|
|
||||||
- name: temp
|
|
||||||
mountPath: /tmp
|
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
{{- if .Values.persistence.subPath }}
|
|
||||||
subPath: {{ .Values.persistence.subPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- include "gitea.container-additional-mounts" . | nindent 12 }}
|
|
||||||
{{- if .Values.extraContainers }}
|
|
||||||
{{- toYaml .Values.extraContainers | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.global.hostAliases }}
|
|
||||||
hostAliases:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.deployment.nodeSelector }}
|
|
||||||
nodeSelector:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.deployment.affinity }}
|
|
||||||
affinity:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.deployment.topologySpreadConstraints }}
|
|
||||||
topologySpreadConstraints:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.deployment.tolerations }}
|
|
||||||
tolerations:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.deployment.dnsConfig }}
|
|
||||||
dnsConfig:
|
|
||||||
{{- toYaml .Values.deployment.dnsConfig | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.deployment.resources }}
|
|
||||||
resources:
|
|
||||||
{{- toYaml . | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
volumes:
|
|
||||||
- name: init
|
|
||||||
secret:
|
|
||||||
secretName: {{ include "gitea.secret.init.name" . }}
|
|
||||||
defaultMode: 110
|
|
||||||
- name: config
|
|
||||||
secret:
|
|
||||||
secretName: {{ include "gitea.secret.config.name" . }}
|
|
||||||
defaultMode: 110
|
|
||||||
{{- if gt (len .Values.deployment.volumes) 0 }}
|
|
||||||
{{- toYaml .Values.deployment.volumes | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
- name: inline-config-sources
|
|
||||||
secret:
|
|
||||||
secretName: {{ include "gitea.secret.inlineConfig.name" . }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.additionalConfigSources }}
|
|
||||||
- name: additional-config-sources-{{ $idx }}
|
|
||||||
{{- toYaml $value | nindent 10 }}
|
|
||||||
{{- end }}
|
|
||||||
- name: temp
|
|
||||||
emptyDir: {}
|
|
||||||
{{- if .Values.secrets.gpg.enabled }}
|
|
||||||
- name: gpg-private-key
|
|
||||||
secret:
|
|
||||||
secretName: {{ include "gitea.secret.gpg.name" . }}
|
|
||||||
items:
|
|
||||||
- key: {{ include "gitea.secret.gpg.privateKeyKey" . }}
|
|
||||||
path: private.asc
|
|
||||||
defaultMode: 0100
|
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.persistence.enabled }}
|
|
||||||
{{- if .Values.persistence.mount }}
|
|
||||||
- name: data
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: {{ .Values.persistence.claimName }}
|
|
||||||
{{- end }}
|
|
||||||
{{- else if not .Values.persistence.enabled }}
|
|
||||||
- name: data
|
|
||||||
emptyDir: {}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{{- if and .Values.persistence.enabled .Values.persistence.create }}
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
apiVersion: v1
|
|
||||||
metadata:
|
|
||||||
name: {{ .Values.persistence.claimName }}
|
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
annotations:
|
|
||||||
{{ .Values.persistence.annotations | toYaml | indent 4}}
|
|
||||||
labels:
|
|
||||||
{{ .Values.persistence.labels | toYaml | indent 4}}
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
{{- if gt (.Values.deployment.replicas | int) 1 }}
|
|
||||||
- ReadWriteMany
|
|
||||||
{{- else }}
|
|
||||||
{{- .Values.persistence.accessModes | toYaml | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMode: Filesystem
|
|
||||||
{{- include "gitea.persistence.storageClass" . | nindent 2 }}
|
|
||||||
{{- with .Values.persistence.volumeName }}
|
|
||||||
volumeName: {{ . }}
|
|
||||||
{{- end }}
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: {{ .Values.persistence.size }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
{{- if not .Values.secrets.init.existingSecret.enabled -}}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Secret
|
|
||||||
metadata:
|
|
||||||
{{- with (include "gitea.secret.init.annotations" .) }}
|
|
||||||
annotations:
|
|
||||||
{{- . | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
{{- include "gitea.secret.init.labels" . | nindent 4 }}
|
|
||||||
name: {{ include "gitea.secret.init.name" . }}
|
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
type: Opaque
|
|
||||||
stringData:
|
|
||||||
{{ (.Files.Glob "scripts/init-containers/init/*.sh").AsConfig | indent 2 }}
|
|
||||||
init_directory_structure.sh: |-
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
{{- if .Values.initPreScript }}
|
|
||||||
# BEGIN: initPreScript
|
|
||||||
{{- with .Values.initPreScript -}}
|
|
||||||
{{ . | nindent 4}}
|
|
||||||
{{- end -}}
|
|
||||||
# END: initPreScript
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .Values.deployment.gitea.image.rootless }}
|
|
||||||
chown -v 1000:1000 /data
|
|
||||||
{{- end }}
|
|
||||||
mkdir -pv /data/git/.ssh
|
|
||||||
chmod -Rv 700 /data/git/.ssh
|
|
||||||
[ ! -d /data/gitea/conf ] && mkdir -pv /data/gitea/conf
|
|
||||||
|
|
||||||
# prepare temp directory structure
|
|
||||||
mkdir -pv "${GITEA_TEMP}"
|
|
||||||
{{- if not .Values.deployment.gitea.image.rootless }}
|
|
||||||
chown -v 1000:1000 "${GITEA_TEMP}"
|
|
||||||
{{- end }}
|
|
||||||
chmod -v ug+rwx "${GITEA_TEMP}"
|
|
||||||
|
|
||||||
{{ if .Values.secrets.gpg.enabled -}}
|
|
||||||
if [ ! -d "${GNUPGHOME}" ]; then
|
|
||||||
mkdir -pv "${GNUPGHOME}"
|
|
||||||
chmod -v 700 "${GNUPGHOME}"
|
|
||||||
chown -v 1000:1000 "${GNUPGHOME}"
|
|
||||||
fi
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
configure_gitea.sh: |-
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
echo '==== BEGIN GITEA CONFIGURATION ===='
|
|
||||||
|
|
||||||
{ # try
|
|
||||||
gitea migrate
|
|
||||||
} || { # catch
|
|
||||||
echo "Gitea migrate might fail due to database connection...This init-container will try again in a few seconds"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
{{- if include "valkey.servicename" . }}
|
|
||||||
function test_valkey_connection() {
|
|
||||||
local RETRY=0
|
|
||||||
local MAX=30
|
|
||||||
|
|
||||||
echo 'Wait for valkey to become avialable...'
|
|
||||||
until [ "${RETRY}" -ge "${MAX}" ]; do
|
|
||||||
RES_OPTIONS="ndots:0" nc -vz -w2 {{ include "valkey.servicename" . }} {{ include "valkey.port" . }} && break
|
|
||||||
RETRY=$[${RETRY}+1]
|
|
||||||
echo "...not ready yet (${RETRY}/${MAX})"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${RETRY}" -ge "${MAX}" ]; then
|
|
||||||
echo "Valkey not reachable after '${MAX}' attempts!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
test_valkey_connection
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
|
|
||||||
{{- if .Values.secrets.admin.enabled }}
|
|
||||||
function configure_admin_user() {
|
|
||||||
local full_admin_list=$(gitea admin user list --admin)
|
|
||||||
local actual_user_table=''
|
|
||||||
|
|
||||||
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
|
||||||
local regex="(.*)(ID\s+Username\s+Email\s+IsActive.*)"
|
|
||||||
if [[ "${full_admin_list}" =~ $regex ]]; then
|
|
||||||
actual_user_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
|
||||||
else
|
|
||||||
# This code block should never be reached, as long as the output table header remains the same.
|
|
||||||
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
|
||||||
|
|
||||||
echo "ERROR: 'configure_admin_user' was not able to determine the current list of admin users."
|
|
||||||
echo " Please review the output of 'gitea admin user list --admin' shown below."
|
|
||||||
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
|
||||||
echo "DEBUG: Output of 'gitea admin user list --admin'"
|
|
||||||
echo "--"
|
|
||||||
echo "${full_admin_list}"
|
|
||||||
echo "--"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local ACCOUNT_ID=$(echo "${actual_user_table}" | grep -E "\s+${GITEA_ADMIN_USERNAME}\s+" | awk -F " " "{printf \$1}")
|
|
||||||
if [[ -z "${ACCOUNT_ID}" ]]; then
|
|
||||||
local -a create_args
|
|
||||||
create_args=(--admin --username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}" --email "${GITEA_ADMIN_EMAIL}")
|
|
||||||
if [[ "${GITEA_ADMIN_PASSWORD_MODE}" = initialOnlyRequireReset ]]; then
|
|
||||||
create_args+=(--must-change-password=true)
|
|
||||||
else
|
|
||||||
create_args+=(--must-change-password=false)
|
|
||||||
fi
|
|
||||||
echo "No admin user '${GITEA_ADMIN_USERNAME}' found. Creating now..."
|
|
||||||
gitea admin user create "${create_args[@]}"
|
|
||||||
echo '...created.'
|
|
||||||
else
|
|
||||||
if [[ "${GITEA_ADMIN_PASSWORD_MODE}" = keepUpdated ]]; then
|
|
||||||
echo "Admin account '${GITEA_ADMIN_USERNAME}' already exist. Running update to sync password..."
|
|
||||||
# See https://gitea.com/gitea/helm-gitea/issues/673
|
|
||||||
# --must-change-password argument was added to change-password, defaulting to true, counter to the previous behavior
|
|
||||||
# which acted as if it were provided with =false. If the argument is present in this version of gitea, then we
|
|
||||||
# should add it to prevent requiring frequent admin password resets.
|
|
||||||
local -a change_args
|
|
||||||
change_args=(--username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}")
|
|
||||||
if gitea admin user change-password --help | grep -F -- '--must-change-password' >/dev/null; then
|
|
||||||
change_args+=(--must-change-password=false)
|
|
||||||
fi
|
|
||||||
gitea admin user change-password "${change_args[@]}"
|
|
||||||
echo '...password sync done.'
|
|
||||||
else
|
|
||||||
echo "Admin account '${GITEA_ADMIN_USERNAME}' already exist, but update mode is set to '${GITEA_ADMIN_PASSWORD_MODE}'. Skipping."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_admin_user
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
function configure_ldap() {
|
|
||||||
{{- if .Values.gitea.ldap }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.ldap }}
|
|
||||||
local LDAP_NAME={{ (printf "%s" $value.name) | squote }}
|
|
||||||
local full_auth_list=$(gitea admin auth list --vertical-bars)
|
|
||||||
local actual_auth_table=''
|
|
||||||
|
|
||||||
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
|
||||||
local regex="(.*)(ID\s+\|Name\s+\|Type\s+\|Enabled.*)"
|
|
||||||
if [[ "${full_auth_list}" =~ $regex ]]; then
|
|
||||||
actual_auth_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
|
||||||
else
|
|
||||||
# This code block should never be reached, as long as the output table header remains the same.
|
|
||||||
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
|
||||||
|
|
||||||
echo "ERROR: 'configure_ldap' was not able to determine the current list of authentication sources."
|
|
||||||
echo " Please review the output of 'gitea admin auth list --vertical-bars' shown below."
|
|
||||||
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
|
||||||
echo "DEBUG: Output of 'gitea admin auth list --vertical-bars'"
|
|
||||||
echo "--"
|
|
||||||
echo "${full_auth_list}"
|
|
||||||
echo "--"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local GITEA_AUTH_ID=$(echo "${actual_auth_table}" | grep -E "\|${LDAP_NAME}\s+\|" | grep -iE '\|LDAP \(via BindDN\)\s+\|' | awk -F " " "{print \$1}")
|
|
||||||
|
|
||||||
if [[ -z "${GITEA_AUTH_ID}" ]]; then
|
|
||||||
echo "No ldap configuration found with name '${LDAP_NAME}'. Installing it now..."
|
|
||||||
gitea admin auth add-ldap {{- include "gitea.ldap_settings" (list $idx $value) | indent 1 }}
|
|
||||||
echo '...installed.'
|
|
||||||
else
|
|
||||||
echo "Existing ldap configuration with name '${LDAP_NAME}': '${GITEA_AUTH_ID}'. Running update to sync settings..."
|
|
||||||
gitea admin auth update-ldap --id "${GITEA_AUTH_ID}" {{- include "gitea.ldap_settings" (list $idx $value) | indent 1 }}
|
|
||||||
echo '...sync settings done.'
|
|
||||||
fi
|
|
||||||
{{- end }}
|
|
||||||
{{- else }}
|
|
||||||
echo 'no ldap configuration... skipping.'
|
|
||||||
{{- end }}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_ldap
|
|
||||||
|
|
||||||
function configure_oauth() {
|
|
||||||
{{- if .Values.gitea.oauth }}
|
|
||||||
{{- range $idx, $value := .Values.gitea.oauth }}
|
|
||||||
local OAUTH_NAME={{ (printf "%s" $value.name) | squote }}
|
|
||||||
local full_auth_list=$(gitea admin auth list --vertical-bars)
|
|
||||||
local actual_auth_table=''
|
|
||||||
|
|
||||||
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
|
||||||
local regex="(.*)(ID\s+\|Name\s+\|Type\s+\|Enabled.*)"
|
|
||||||
if [[ "${full_auth_list}" =~ $regex ]]; then
|
|
||||||
actual_auth_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
|
||||||
else
|
|
||||||
# This code block should never be reached, as long as the output table header remains the same.
|
|
||||||
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
|
||||||
|
|
||||||
echo "ERROR: 'configure_oauth' was not able to determine the current list of authentication sources."
|
|
||||||
echo " Please review the output of 'gitea admin auth list --vertical-bars' shown below."
|
|
||||||
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
|
||||||
echo "DEBUG: Output of 'gitea admin auth list --vertical-bars'"
|
|
||||||
echo "--"
|
|
||||||
echo "${full_auth_list}"
|
|
||||||
echo "--"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local AUTH_ID=$(echo "${actual_auth_table}" | grep -E "\|${OAUTH_NAME}\s+\|" | grep -iE '\|OAuth2\s+\|' | awk -F " " "{print \$1}")
|
|
||||||
|
|
||||||
if [[ -z "${AUTH_ID}" ]]; then
|
|
||||||
echo "No oauth configuration found with name '${OAUTH_NAME}'. Installing it now..."
|
|
||||||
gitea admin auth add-oauth {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}
|
|
||||||
echo '...installed.'
|
|
||||||
else
|
|
||||||
echo "Existing oauth configuration with name '${OAUTH_NAME}': '${AUTH_ID}'. Running update to sync settings..."
|
|
||||||
gitea admin auth update-oauth --id "${AUTH_ID}" {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}
|
|
||||||
echo '...sync settings done.'
|
|
||||||
fi
|
|
||||||
{{- end }}
|
|
||||||
{{- else }}
|
|
||||||
echo 'no oauth configuration... skipping.'
|
|
||||||
{{- end }}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_oauth
|
|
||||||
|
|
||||||
echo '==== END GITEA CONFIGURATION ===='
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{{- if .Values.serviceAccount.create }}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: {{ include "gitea.serviceAccountName" . }}
|
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
labels:
|
|
||||||
{{- include "gitea.labels" . | nindent 4 }}
|
|
||||||
{{- with .Values.serviceAccount.labels }}
|
|
||||||
{{- . | toYaml | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.serviceAccount.annotations }}
|
|
||||||
annotations:
|
|
||||||
{{- . | toYaml | nindent 4 }}
|
|
||||||
{{- end }}
|
|
||||||
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
|
||||||
{{- with .Values.serviceAccount.imagePullSecrets }}
|
|
||||||
imagePullSecrets:
|
|
||||||
{{- . | toYaml | nindent 2 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
File renamed without changes.
@@ -1,29 +1,20 @@
|
|||||||
{{- if .Values.ingress.enabled -}}
|
{{- if eq (include "gitea.ingress.enabled" .) "true" -}}
|
||||||
{{- $fullName := include "gitea.fullname" . -}}
|
---
|
||||||
{{- $httpPort := .Values.service.http.port -}}
|
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ $fullName }}
|
{{- with (include "gitea.ingress.annotations" .) }}
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
labels:
|
|
||||||
{{- include "gitea.labels" . | nindent 4 }}
|
|
||||||
annotations:
|
annotations:
|
||||||
{{- range $key, $value := .Values.ingress.annotations }}
|
{{- . | nindent 4 }}
|
||||||
{{ $key }}: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
spec:
|
|
||||||
ingressClassName: {{ tpl .Values.ingress.className . }}
|
|
||||||
{{- if .Values.ingress.tls }}
|
|
||||||
tls:
|
|
||||||
{{- range .Values.ingress.tls }}
|
|
||||||
- hosts:
|
|
||||||
{{- range .hosts }}
|
|
||||||
- {{ tpl . $ | quote }}
|
|
||||||
{{- end }}
|
|
||||||
secretName: {{ .secretName }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- with (include "gitea.ingress.labels" .) }}
|
||||||
|
labels:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ include "gitea.ingress.name" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
ingressClassName: {{ tpl .Values.ingress.ingressClassName . }}
|
||||||
rules:
|
rules:
|
||||||
{{- range .Values.ingress.hosts }}
|
{{- range .Values.ingress.hosts }}
|
||||||
- host: {{ tpl .host $ | quote }}
|
- host: {{ tpl .host $ | quote }}
|
||||||
@@ -38,7 +29,7 @@ spec:
|
|||||||
service:
|
service:
|
||||||
name: {{ include "gitea.service.http.name" $ }}
|
name: {{ include "gitea.service.http.name" $ }}
|
||||||
port:
|
port:
|
||||||
number: {{ $httpPort }}
|
number: {{ $.Values.service.http.port }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
- path: {{ .path | default "/" }}
|
- path: {{ .path | default "/" }}
|
||||||
pathType: {{ .pathType | default "Prefix" }}
|
pathType: {{ .pathType | default "Prefix" }}
|
||||||
@@ -46,7 +37,7 @@ spec:
|
|||||||
service:
|
service:
|
||||||
name: {{ include "gitea.service.http.name" $ }}
|
name: {{ include "gitea.service.http.name" $ }}
|
||||||
port:
|
port:
|
||||||
number: {{ $httpPort }}
|
number: {{ $.Values.service.http.port }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
@@ -56,7 +47,17 @@ spec:
|
|||||||
service:
|
service:
|
||||||
name: {{ include "gitea.service.http.name" $ }}
|
name: {{ include "gitea.service.http.name" $ }}
|
||||||
port:
|
port:
|
||||||
number: {{ $httpPort }}
|
number: {{ $.Values.service.http.port }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ tpl . $ | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{{- if eq (include "gitea.persistentVolumeClaim.enabled" .) "true" }}
|
||||||
|
---
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.persistentVolumeClaim.annotations" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (include "gitea.persistentVolumeClaim.labels" .) }}
|
||||||
|
labels:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ include "gitea.persistentVolumeClaim.name" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
{{- if gt (.Values.deployment.replicas | int) 1 }}
|
||||||
|
- ReadWriteMany
|
||||||
|
{{- else }}
|
||||||
|
{{- .Values.persistence.new.accessModes | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.persistence.new.size }}
|
||||||
|
{{- with .Values.persistence.new.storageClassName }}
|
||||||
|
storageClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMode: Filesystem
|
||||||
|
{{- with .Values.persistence.new.persistentVolumeName }}
|
||||||
|
volumeName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,18 @@
|
|||||||
|
{{- if and .Values.cloudnativePG.enabled (not .Values.cloudnativePG.credentials.existingSecret.enabled) -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.secret.cloudnativePG.annotations" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.secret.cloudnativePG.labels" . | nindent 4 }}
|
||||||
|
name: {{ include "gitea.secret.cloudnativePG.name" . }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
type: kubernetes.io/basic-auth
|
||||||
|
data:
|
||||||
|
password: {{ required "`cloudnativePG.credentials.new.password` must be set when `cloudnativePG.enabled` is enabled" .Values.cloudnativePG.credentials.new.password | b64enc | quote }}
|
||||||
|
{{- /* CloudNativePG requires the username of a basic-auth bootstrap Secret to match the owner of the Cluster. */}}
|
||||||
|
username: {{ required "`cloudnativePG.credentials.username` must be set when `cloudnativePG.enabled` is enabled" .Values.cloudnativePG.credentials.username | b64enc | quote }}
|
||||||
|
{{- end -}}
|
||||||
@@ -14,19 +14,13 @@ metadata:
|
|||||||
name: {{ include "gitea.secret.config.name" . }}
|
name: {{ include "gitea.secret.config.name" . }}
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
type: Opaque
|
type: Opaque
|
||||||
stringData:
|
data:
|
||||||
{{ (.Files.Glob "scripts/init-containers/config/*.sh").AsConfig | indent 2 }}
|
{{ (.Files.Glob "scripts/init-containers/config/*.sh").AsSecrets | indent 2 }}
|
||||||
assertions: |
|
assertions: {{ $assertions | b64enc | quote }}
|
||||||
{{- $assertions | nindent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- define "gitea.config.assertions" -}}
|
{{- define "gitea.config.assertions" -}}
|
||||||
|
|
||||||
{{- /*assert that only one PG dep is enabled */ -}}
|
|
||||||
{{- if and (.Values.postgresql.enabled) (index .Values "postgresql-ha" "enabled") -}}
|
|
||||||
{{- fail "Only one of postgresql or postgresql-ha can be enabled at the same time." -}}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- /* multiple replicas assertions */ -}}
|
{{- /* multiple replicas assertions */ -}}
|
||||||
{{- if gt (.Values.deployment.replicas | int) 1 -}}
|
{{- if gt (.Values.deployment.replicas | int) 1 -}}
|
||||||
{{- if .Values.gitea.config.cron -}}
|
{{- if .Values.gitea.config.cron -}}
|
||||||
@@ -37,8 +31,8 @@ stringData:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if eq (first .Values.persistence.accessModes) "ReadWriteOnce" -}}
|
{{- if eq (first .Values.persistence.new.accessModes) "ReadWriteOnce" -}}
|
||||||
{{- fail "When using multiple replicas, a RWX file system is required and persistence.accessModes[0] must be set to ReadWriteMany." -}}
|
{{- fail "When using multiple replicas, a RWX file system is required and persistence.new.accessModes[0] must be set to ReadWriteMany." -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.gitea.config.indexer -}}
|
{{- if .Values.gitea.config.indexer -}}
|
||||||
{{- if eq .Values.gitea.config.indexer.ISSUE_INDEXER_TYPE "bleve" -}}
|
{{- if eq .Values.gitea.config.indexer.ISSUE_INDEXER_TYPE "bleve" -}}
|
||||||
File renamed without changes.
@@ -0,0 +1,239 @@
|
|||||||
|
{{- if not .Values.secrets.init.existingSecret.enabled -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.secret.init.annotations" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.secret.init.labels" . | nindent 4 }}
|
||||||
|
name: {{ include "gitea.secret.init.name" . }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{ (.Files.Glob "scripts/init-containers/init/*.sh").AsSecrets | indent 2 }}
|
||||||
|
configure_gitea.sh: {{ include "gitea.init.configureGitea" . | trimAll "\n" | b64enc | quote }}
|
||||||
|
init_directory_structure.sh: {{ include "gitea.init.initDirectoryStructure" . | trimAll "\n" | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.init.initDirectoryStructure" -}}
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
{{- if .Values.initPreScript }}
|
||||||
|
# BEGIN: initPreScript
|
||||||
|
{{- with .Values.initPreScript -}}
|
||||||
|
{{ . | nindent 0 }}
|
||||||
|
{{- end -}}
|
||||||
|
# END: initPreScript
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if not .Values.deployment.gitea.image.rootless }}
|
||||||
|
chown -v 1000:1000 /data
|
||||||
|
{{- end }}
|
||||||
|
mkdir -pv /data/git/.ssh
|
||||||
|
chmod -Rv 700 /data/git/.ssh
|
||||||
|
[ ! -d /data/gitea/conf ] && mkdir -pv /data/gitea/conf
|
||||||
|
|
||||||
|
# prepare temp directory structure
|
||||||
|
mkdir -pv "${GITEA_TEMP}"
|
||||||
|
{{- if not .Values.deployment.gitea.image.rootless }}
|
||||||
|
chown -v 1000:1000 "${GITEA_TEMP}"
|
||||||
|
{{- end }}
|
||||||
|
chmod -v ug+rwx "${GITEA_TEMP}"
|
||||||
|
|
||||||
|
{{ if .Values.secrets.gpg.enabled -}}
|
||||||
|
if [ ! -d "${GNUPGHOME}" ]; then
|
||||||
|
mkdir -pv "${GNUPGHOME}"
|
||||||
|
chmod -v 700 "${GNUPGHOME}"
|
||||||
|
chown -v 1000:1000 "${GNUPGHOME}"
|
||||||
|
fi
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "gitea.init.configureGitea" -}}
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo '==== BEGIN GITEA CONFIGURATION ===='
|
||||||
|
|
||||||
|
{ # try
|
||||||
|
gitea migrate
|
||||||
|
} || { # catch
|
||||||
|
echo "Gitea migrate might fail due to database connection...This init-container will try again in a few seconds"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
{{- if include "valkey.servicename" . }}
|
||||||
|
function test_valkey_connection() {
|
||||||
|
local RETRY=0
|
||||||
|
local MAX=30
|
||||||
|
|
||||||
|
echo 'Wait for valkey to become avialable...'
|
||||||
|
until [ "${RETRY}" -ge "${MAX}" ]; do
|
||||||
|
RES_OPTIONS="ndots:0" nc -vz -w2 {{ include "valkey.servicename" . }} {{ include "valkey.port" . }} && break
|
||||||
|
RETRY=$[${RETRY}+1]
|
||||||
|
echo "...not ready yet (${RETRY}/${MAX})"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${RETRY}" -ge "${MAX}" ]; then
|
||||||
|
echo "Valkey not reachable after '${MAX}' attempts!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_valkey_connection
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{- if .Values.secrets.admin.enabled }}
|
||||||
|
function configure_admin_user() {
|
||||||
|
local full_admin_list=$(gitea admin user list --admin)
|
||||||
|
local actual_user_table=''
|
||||||
|
|
||||||
|
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
||||||
|
local regex="(.*)(ID\s+Username\s+Email\s+IsActive.*)"
|
||||||
|
if [[ "${full_admin_list}" =~ $regex ]]; then
|
||||||
|
actual_user_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
||||||
|
else
|
||||||
|
# This code block should never be reached, as long as the output table header remains the same.
|
||||||
|
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
||||||
|
|
||||||
|
echo "ERROR: 'configure_admin_user' was not able to determine the current list of admin users."
|
||||||
|
echo " Please review the output of 'gitea admin user list --admin' shown below."
|
||||||
|
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
||||||
|
echo "DEBUG: Output of 'gitea admin user list --admin'"
|
||||||
|
echo "--"
|
||||||
|
echo "${full_admin_list}"
|
||||||
|
echo "--"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ACCOUNT_ID=$(echo "${actual_user_table}" | grep -E "\s+${GITEA_ADMIN_USERNAME}\s+" | awk -F " " "{printf \$1}")
|
||||||
|
if [[ -z "${ACCOUNT_ID}" ]]; then
|
||||||
|
local -a create_args
|
||||||
|
create_args=(--admin --username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}" --email "${GITEA_ADMIN_EMAIL}")
|
||||||
|
if [[ "${GITEA_ADMIN_PASSWORD_MODE}" = initialOnlyRequireReset ]]; then
|
||||||
|
create_args+=(--must-change-password=true)
|
||||||
|
else
|
||||||
|
create_args+=(--must-change-password=false)
|
||||||
|
fi
|
||||||
|
echo "No admin user '${GITEA_ADMIN_USERNAME}' found. Creating now..."
|
||||||
|
gitea admin user create "${create_args[@]}"
|
||||||
|
echo '...created.'
|
||||||
|
else
|
||||||
|
if [[ "${GITEA_ADMIN_PASSWORD_MODE}" = keepUpdated ]]; then
|
||||||
|
echo "Admin account '${GITEA_ADMIN_USERNAME}' already exist. Running update to sync password..."
|
||||||
|
# See https://gitea.com/gitea/helm-gitea/issues/673
|
||||||
|
# --must-change-password argument was added to change-password, defaulting to true, counter to the previous behavior
|
||||||
|
# which acted as if it were provided with =false. If the argument is present in this version of gitea, then we
|
||||||
|
# should add it to prevent requiring frequent admin password resets.
|
||||||
|
local -a change_args
|
||||||
|
change_args=(--username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}")
|
||||||
|
if gitea admin user change-password --help | grep -F -- '--must-change-password' >/dev/null; then
|
||||||
|
change_args+=(--must-change-password=false)
|
||||||
|
fi
|
||||||
|
gitea admin user change-password "${change_args[@]}"
|
||||||
|
echo '...password sync done.'
|
||||||
|
else
|
||||||
|
echo "Admin account '${GITEA_ADMIN_USERNAME}' already exist, but update mode is set to '${GITEA_ADMIN_PASSWORD_MODE}'. Skipping."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_admin_user
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
function configure_ldap() {
|
||||||
|
{{- if .Values.gitea.ldap }}
|
||||||
|
{{- range $idx, $value := .Values.gitea.ldap }}
|
||||||
|
local LDAP_NAME={{ (printf "%s" $value.name) | squote }}
|
||||||
|
local full_auth_list=$(gitea admin auth list --vertical-bars)
|
||||||
|
local actual_auth_table=''
|
||||||
|
|
||||||
|
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
||||||
|
local regex="(.*)(ID\s+\|Name\s+\|Type\s+\|Enabled.*)"
|
||||||
|
if [[ "${full_auth_list}" =~ $regex ]]; then
|
||||||
|
actual_auth_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
||||||
|
else
|
||||||
|
# This code block should never be reached, as long as the output table header remains the same.
|
||||||
|
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
||||||
|
|
||||||
|
echo "ERROR: 'configure_ldap' was not able to determine the current list of authentication sources."
|
||||||
|
echo " Please review the output of 'gitea admin auth list --vertical-bars' shown below."
|
||||||
|
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
||||||
|
echo "DEBUG: Output of 'gitea admin auth list --vertical-bars'"
|
||||||
|
echo "--"
|
||||||
|
echo "${full_auth_list}"
|
||||||
|
echo "--"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local GITEA_AUTH_ID=$(echo "${actual_auth_table}" | grep -E "\|${LDAP_NAME}\s+\|" | grep -iE '\|LDAP \(via BindDN\)\s+\|' | awk -F " " "{print \$1}")
|
||||||
|
|
||||||
|
if [[ -z "${GITEA_AUTH_ID}" ]]; then
|
||||||
|
echo "No ldap configuration found with name '${LDAP_NAME}'. Installing it now..."
|
||||||
|
gitea admin auth add-ldap {{- include "gitea.ldap_settings" (list $idx $value) | indent 1 }}
|
||||||
|
echo '...installed.'
|
||||||
|
else
|
||||||
|
echo "Existing ldap configuration with name '${LDAP_NAME}': '${GITEA_AUTH_ID}'. Running update to sync settings..."
|
||||||
|
gitea admin auth update-ldap --id "${GITEA_AUTH_ID}" {{- include "gitea.ldap_settings" (list $idx $value) | indent 1 }}
|
||||||
|
echo '...sync settings done.'
|
||||||
|
fi
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
echo 'no ldap configuration... skipping.'
|
||||||
|
{{- end }}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_ldap
|
||||||
|
|
||||||
|
function configure_oauth() {
|
||||||
|
{{- if .Values.gitea.oauth }}
|
||||||
|
{{- range $idx, $value := .Values.gitea.oauth }}
|
||||||
|
local OAUTH_NAME={{ (printf "%s" $value.name) | squote }}
|
||||||
|
local full_auth_list=$(gitea admin auth list --vertical-bars)
|
||||||
|
local actual_auth_table=''
|
||||||
|
|
||||||
|
# We might have distorted output due to warning logs, so we have to detect the actual user table by its headline and trim output above that line
|
||||||
|
local regex="(.*)(ID\s+\|Name\s+\|Type\s+\|Enabled.*)"
|
||||||
|
if [[ "${full_auth_list}" =~ $regex ]]; then
|
||||||
|
actual_auth_table=$(echo "${BASH_REMATCH[2]}" | tail -n+2) # tail'ing to drop the table headline
|
||||||
|
else
|
||||||
|
# This code block should never be reached, as long as the output table header remains the same.
|
||||||
|
# If this code block is reached, the regex doesn't match anymore and we probably have to adjust this script.
|
||||||
|
|
||||||
|
echo "ERROR: 'configure_oauth' was not able to determine the current list of authentication sources."
|
||||||
|
echo " Please review the output of 'gitea admin auth list --vertical-bars' shown below."
|
||||||
|
echo " If you think it is an issue with the Helm Chart provisioning, file an issue at https://gitea.com/gitea/helm-gitea/issues."
|
||||||
|
echo "DEBUG: Output of 'gitea admin auth list --vertical-bars'"
|
||||||
|
echo "--"
|
||||||
|
echo "${full_auth_list}"
|
||||||
|
echo "--"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local AUTH_ID=$(echo "${actual_auth_table}" | grep -E "\|${OAUTH_NAME}\s+\|" | grep -iE '\|OAuth2\s+\|' | awk -F " " "{print \$1}")
|
||||||
|
|
||||||
|
if [[ -z "${AUTH_ID}" ]]; then
|
||||||
|
echo "No oauth configuration found with name '${OAUTH_NAME}'. Installing it now..."
|
||||||
|
gitea admin auth add-oauth {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}
|
||||||
|
echo '...installed.'
|
||||||
|
else
|
||||||
|
echo "Existing oauth configuration with name '${OAUTH_NAME}': '${AUTH_ID}'. Running update to sync settings..."
|
||||||
|
gitea admin auth update-oauth --id "${AUTH_ID}" {{- include "gitea.oauth_settings" (list $idx $value) | indent 1 }}
|
||||||
|
echo '...sync settings done.'
|
||||||
|
fi
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
echo 'no oauth configuration... skipping.'
|
||||||
|
{{- end }}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_oauth
|
||||||
|
|
||||||
|
echo '==== END GITEA CONFIGURATION ===='
|
||||||
|
{{- end }}
|
||||||
@@ -14,6 +14,8 @@ metadata:
|
|||||||
name: {{ include "gitea.secret.inlineConfig.name" . }}
|
name: {{ include "gitea.secret.inlineConfig.name" . }}
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
type: Opaque
|
type: Opaque
|
||||||
stringData:
|
data:
|
||||||
{{- $inlineConfiguration | nindent 2 }}
|
{{- range $key, $value := fromYaml $inlineConfiguration }}
|
||||||
|
{{ $key }}: {{ $value | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
File renamed without changes.
@@ -0,0 +1,21 @@
|
|||||||
|
{{- if eq (include "gitea.serviceAccount.enabled" .) "true" }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
{{- with (include "gitea.serviceAccount.annotations" .) }}
|
||||||
|
annotations:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (include "gitea.serviceAccount.labels" .) }}
|
||||||
|
labels:
|
||||||
|
{{- . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
name: {{ include "gitea.serviceAccount.name" . }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }}
|
||||||
|
{{- with .Values.serviceAccount.new.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- . | toYaml | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,27 +0,0 @@
|
|||||||
{{- if .Values.test.enabled }}
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
metadata:
|
|
||||||
name: "{{ include "gitea.fullname" . }}-test-connection"
|
|
||||||
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
|
||||||
labels:
|
|
||||||
{{ include "gitea.labels" . | nindent 4 }}
|
|
||||||
annotations:
|
|
||||||
"helm.sh/hook": test-success
|
|
||||||
spec:
|
|
||||||
{{- $hostUsers := include "gitea.hostUsers" . | trim }}
|
|
||||||
{{- $testContainerSecurityContext := include "gitea.containerSecurityContext" (list . (dict)) | trim }}
|
|
||||||
{{- if $hostUsers }}
|
|
||||||
hostUsers: {{ $hostUsers }}
|
|
||||||
{{- end }}
|
|
||||||
containers:
|
|
||||||
- name: wget
|
|
||||||
image: "{{ .Values.test.image.name }}:{{ .Values.test.image.tag }}"
|
|
||||||
{{- if $testContainerSecurityContext }}
|
|
||||||
securityContext:
|
|
||||||
{{- $testContainerSecurityContext | nindent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
command: ['wget']
|
|
||||||
args: ['{{ include "gitea.service.http.name" . }}:{{ .Values.service.http.port }}']
|
|
||||||
restartPolicy: Never
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: Admin secret template
|
suite: Test admin secret
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: skips rendering when the admin user is disabled
|
- it: "Skip rendering when the admin user is disabled"
|
||||||
set:
|
set:
|
||||||
secrets.admin.enabled: false
|
secrets.admin.enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 0
|
count: 0
|
||||||
|
|
||||||
- it: skips rendering using an existing secret reference
|
- it: "Skip rendering when an existing Secret is referenced"
|
||||||
set:
|
set:
|
||||||
secrets.admin.enabled: true
|
secrets.admin.enabled: true
|
||||||
secrets.admin.existingSecret.enabled: true
|
secrets.admin.existingSecret.enabled: true
|
||||||
@@ -21,14 +21,14 @@ tests:
|
|||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 0
|
count: 0
|
||||||
|
|
||||||
- it: fails rendering without credentials
|
- it: "Fail when no credentials are configured"
|
||||||
set:
|
set:
|
||||||
secrets.admin.new.password: ""
|
secrets.admin.new.password: ""
|
||||||
asserts:
|
asserts:
|
||||||
- failedTemplate:
|
- failedTemplate:
|
||||||
errorMessage: Either specify `secrets.admin.new.username` and `secrets.admin.new.password` or reference an existing Secret via `secrets.admin.existingSecret`
|
errorMessage: Either specify `secrets.admin.new.username` and `secrets.admin.new.password` or reference an existing Secret via `secrets.admin.existingSecret`
|
||||||
|
|
||||||
- it: renders the secret specification with the default credentials
|
- it: "Render the Secret with the default credentials"
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
@@ -49,7 +49,7 @@ tests:
|
|||||||
path: data.username
|
path: data.username
|
||||||
value: "Z2l0ZWFfYWRtaW4="
|
value: "Z2l0ZWFfYWRtaW4="
|
||||||
|
|
||||||
- it: supports custom annotations and labels
|
- it: "Render custom annotations and labels"
|
||||||
set:
|
set:
|
||||||
secrets.admin.new.annotations:
|
secrets.admin.new.annotations:
|
||||||
custom-annotation: annotation-value
|
custom-annotation: annotation-value
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
suite: Test cluster basics
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
tests:
|
||||||
|
- it: "Render nothing when cloudnativePG is disabled"
|
||||||
|
templates:
|
||||||
|
- templates/cluster.yaml
|
||||||
|
- templates/secret_cloudnativePG.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: false
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: "Render the Cluster with the default values"
|
||||||
|
template: templates/cluster.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- containsDocument:
|
||||||
|
kind: Cluster
|
||||||
|
apiVersion: postgresql.cnpg.io/v1
|
||||||
|
name: gitea-unittests-postgresql
|
||||||
|
namespace: testing
|
||||||
|
- equal:
|
||||||
|
path: spec.instances
|
||||||
|
value: 3
|
||||||
|
- equal:
|
||||||
|
path: spec.imageName
|
||||||
|
value: "ghcr.io/cloudnative-pg/postgresql:18.0"
|
||||||
|
- equal:
|
||||||
|
path: spec.bootstrap.initdb
|
||||||
|
value:
|
||||||
|
database: "gitea"
|
||||||
|
owner: "gitea"
|
||||||
|
secret:
|
||||||
|
name: gitea-unittests-postgresql-app
|
||||||
|
- equal:
|
||||||
|
path: spec.storage.size
|
||||||
|
value: "10Gi"
|
||||||
|
- notExists:
|
||||||
|
path: spec.storage.storageClass
|
||||||
|
- notExists:
|
||||||
|
path: spec.walStorage
|
||||||
|
- notExists:
|
||||||
|
path: spec.affinity
|
||||||
|
- notExists:
|
||||||
|
path: spec.topologySpreadConstraints
|
||||||
|
|
||||||
|
- it: "Render the credential Secret with the default values"
|
||||||
|
template: templates/secret_cloudnativePG.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- containsDocument:
|
||||||
|
kind: Secret
|
||||||
|
apiVersion: v1
|
||||||
|
name: gitea-unittests-postgresql-app
|
||||||
|
namespace: testing
|
||||||
|
- equal:
|
||||||
|
path: type
|
||||||
|
value: kubernetes.io/basic-auth
|
||||||
|
- equal:
|
||||||
|
path: data.password
|
||||||
|
decodeBase64: true
|
||||||
|
value: "gitea"
|
||||||
|
- equal:
|
||||||
|
path: data.username
|
||||||
|
decodeBase64: true
|
||||||
|
value: "gitea"
|
||||||
|
- notExists:
|
||||||
|
path: data.database
|
||||||
|
- notExists:
|
||||||
|
path: stringData
|
||||||
|
|
||||||
|
- it: "Render no credential Secret when an existing Secret is used"
|
||||||
|
template: templates/secret_cloudnativePG.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
credentials:
|
||||||
|
existingSecret:
|
||||||
|
enabled: true
|
||||||
|
secretName: my-credentials
|
||||||
|
asserts:
|
||||||
|
- hasDocuments:
|
||||||
|
count: 0
|
||||||
|
|
||||||
|
- it: "Reference the existing Secret in the Cluster"
|
||||||
|
template: templates/cluster.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
credentials:
|
||||||
|
existingSecret:
|
||||||
|
enabled: true
|
||||||
|
secretName: my-credentials
|
||||||
|
database: my-database
|
||||||
|
username: my-username
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.bootstrap.initdb
|
||||||
|
value:
|
||||||
|
database: "my-database"
|
||||||
|
owner: "my-username"
|
||||||
|
secret:
|
||||||
|
name: my-credentials
|
||||||
|
|
||||||
|
- it: "Apply the storage and walStorage customizations"
|
||||||
|
template: templates/cluster.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
storage:
|
||||||
|
size: 1337Mi
|
||||||
|
storageClass: my-storage-class
|
||||||
|
walStorage:
|
||||||
|
enabled: true
|
||||||
|
size: 42Mi
|
||||||
|
storageClass: my-wal-storage-class
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.storage
|
||||||
|
value:
|
||||||
|
size: "1337Mi"
|
||||||
|
storageClass: "my-storage-class"
|
||||||
|
- equal:
|
||||||
|
path: spec.walStorage
|
||||||
|
value:
|
||||||
|
size: "42Mi"
|
||||||
|
storageClass: "my-wal-storage-class"
|
||||||
|
|
||||||
|
- it: "Apply the scheduling customizations"
|
||||||
|
template: templates/cluster.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
affinity:
|
||||||
|
nodeSelector:
|
||||||
|
disktype: ssd
|
||||||
|
podAntiAffinityType: required
|
||||||
|
tolerations:
|
||||||
|
- key: my-key
|
||||||
|
operator: Equal
|
||||||
|
value: my-value
|
||||||
|
effect: NoSchedule
|
||||||
|
priorityClassName: my-priority-class
|
||||||
|
topologySpreadConstraints:
|
||||||
|
- maxSkew: 1
|
||||||
|
topologyKey: topology.kubernetes.io/zone
|
||||||
|
whenUnsatisfiable: DoNotSchedule
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: gitea
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.affinity
|
||||||
|
value:
|
||||||
|
nodeSelector:
|
||||||
|
disktype: ssd
|
||||||
|
podAntiAffinityType: required
|
||||||
|
tolerations:
|
||||||
|
- key: my-key
|
||||||
|
operator: Equal
|
||||||
|
value: my-value
|
||||||
|
effect: NoSchedule
|
||||||
|
- equal:
|
||||||
|
path: spec.priorityClassName
|
||||||
|
value: my-priority-class
|
||||||
|
- equal:
|
||||||
|
path: spec.topologySpreadConstraints
|
||||||
|
value:
|
||||||
|
- maxSkew: 1
|
||||||
|
topologyKey: topology.kubernetes.io/zone
|
||||||
|
whenUnsatisfiable: DoNotSchedule
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: gitea
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
suite: config template | actions config
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
templates:
|
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
|
||||||
tests:
|
|
||||||
- it: "actions are enabled by default (based on vanilla Gitea behavior)"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
notExists:
|
|
||||||
path: stringData.actions
|
|
||||||
|
|
||||||
- it: "actions can be disabled via inline config"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
set:
|
|
||||||
gitea.config.actions.ENABLED: false
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: stringData.actions
|
|
||||||
value: |-
|
|
||||||
ENABLED=false
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
suite: Test config actions
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/secret_inlineConfig.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Enable actions by default to match vanilla Gitea"
|
||||||
|
template: templates/secret_inlineConfig.yaml
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
notExists:
|
||||||
|
path: data.actions
|
||||||
|
|
||||||
|
- it: "Disable actions via the inline config"
|
||||||
|
template: templates/secret_inlineConfig.yaml
|
||||||
|
set:
|
||||||
|
gitea.config.actions.ENABLED: false
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
equal:
|
||||||
|
path: data.actions
|
||||||
|
decodeBase64: true
|
||||||
|
value: |-
|
||||||
|
ENABLED=false
|
||||||
@@ -1,36 +1,38 @@
|
|||||||
suite: config template | cache config
|
suite: Test config cache
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
tests:
|
tests:
|
||||||
- it: "cache is configured correctly for valkey"
|
- it: "Configure the cache for valkey"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: true
|
enabled: true
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.cache
|
path: data.cache
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ADAPTER=redis
|
ADAPTER=redis
|
||||||
HOST=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
HOST=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
||||||
|
|
||||||
- it: "cache is configured correctly for 'memory' when valkey is disabled"
|
- it: "Configure the cache for 'memory' when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.cache
|
path: data.cache
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ADAPTER=memory
|
ADAPTER=memory
|
||||||
HOST=
|
HOST=
|
||||||
|
|
||||||
- it: "cache can be customized when valkey is disabled"
|
- it: "Customize the cache when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
@@ -39,7 +41,8 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.cache
|
path: data.cache
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ADAPTER=custom-adapter
|
ADAPTER=custom-adapter
|
||||||
HOST=custom-host
|
HOST=custom-host
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
suite: config template | config_environment.sh
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
templates:
|
|
||||||
- templates/gitea/secret_admin.yaml
|
|
||||||
- templates/gitea/secret_config.yaml
|
|
||||||
tests:
|
|
||||||
- it: uses `gitea config edit-ini` to write app.ini from environment variables
|
|
||||||
template: templates/gitea/secret_config.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData["config_environment.sh"]
|
|
||||||
pattern: 'gitea config edit-ini --apply-env --config .+GITEA_APP_INI.+ --out .+GITEA_APP_INI'
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
suite: Test config database
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
tests:
|
||||||
|
- it: "Connect to the read-write Service of the CloudNativePG Cluster"
|
||||||
|
template: templates/secret_inlineConfig.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
matchRegex:
|
||||||
|
path: data.database
|
||||||
|
decodeBase64: true
|
||||||
|
pattern: HOST=gitea-unittests-postgresql-rw.testing.svc.cluster.local:5432
|
||||||
|
|
||||||
|
- it: "Connect to the read-write Service of the CloudNativePG Cluster with a custom cluster domain"
|
||||||
|
template: templates/secret_inlineConfig.yaml
|
||||||
|
set:
|
||||||
|
clusterDomain: my-special-cluster.local
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
matchRegex:
|
||||||
|
path: data.database
|
||||||
|
decodeBase64: true
|
||||||
|
pattern: HOST=gitea-unittests-postgresql-rw.testing.svc.my-special-cluster.local:5432
|
||||||
|
|
||||||
|
- it: "Connect to the configured CloudNativePG database"
|
||||||
|
template: templates/secret_inlineConfig.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
credentials:
|
||||||
|
database: gitea-database
|
||||||
|
username: gitea-username
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
equal:
|
||||||
|
path: data.database
|
||||||
|
decodeBase64: true
|
||||||
|
value: |-
|
||||||
|
DB_TYPE=postgres
|
||||||
|
HOST=gitea-unittests-postgresql-rw.testing.svc.cluster.local:5432
|
||||||
|
NAME=gitea-database
|
||||||
|
USER=gitea-username
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
suite: Test config environment script
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/secret_admin.yaml
|
||||||
|
- templates/secret_config.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Write app.ini from the environment variables via `gitea config edit-ini`"
|
||||||
|
template: templates/secret_config.yaml
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
matchRegex:
|
||||||
|
path: data["config_environment.sh"]
|
||||||
|
decodeBase64: true
|
||||||
|
pattern: 'gitea config edit-ini --apply-env --config .+GITEA_APP_INI.+ --out .+GITEA_APP_INI'
|
||||||
|
- it: "Render data instead of stringData so removed keys are pruned on upgrade"
|
||||||
|
template: templates/secret_config.yaml
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
notExists:
|
||||||
|
path: stringData
|
||||||
|
- documentIndex: 0
|
||||||
|
exists:
|
||||||
|
path: data["config_environment.sh"]
|
||||||
+17
-6
@@ -1,11 +1,11 @@
|
|||||||
suite: config template
|
suite: Test config inlineConfig
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: inline config stringData.server using TPL
|
- it: "Render the inline config of data.server via tpl"
|
||||||
set:
|
set:
|
||||||
global.giteaHostName: "gitea.example.com"
|
global.giteaHostName: "gitea.example.com"
|
||||||
ingress.enabled: true
|
ingress.enabled: true
|
||||||
@@ -21,13 +21,24 @@ tests:
|
|||||||
pattern: .*-inline-config$
|
pattern: .*-inline-config$
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: DOMAIN=gitea\.example\.com
|
pattern: DOMAIN=gitea\.example\.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: ROOT_URL=https://gitea\.example\.com
|
pattern: ROOT_URL=https://gitea\.example\.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: SSH_DOMAIN=gitea\.example\.com
|
pattern: SSH_DOMAIN=gitea\.example\.com
|
||||||
|
- it: "Render data instead of stringData so removed sections are pruned on upgrade"
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
notExists:
|
||||||
|
path: stringData
|
||||||
|
- documentIndex: 0
|
||||||
|
exists:
|
||||||
|
path: data.server
|
||||||
+17
-13
@@ -1,10 +1,10 @@
|
|||||||
suite: config template | metrics section (metrics token)
|
suite: Test config metrics token
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
tests:
|
tests:
|
||||||
- it: metrics token is set
|
- it: "Configure the metrics token when it is set"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
metrics:
|
metrics:
|
||||||
@@ -13,12 +13,13 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.metrics
|
path: data.metrics
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ENABLED=true
|
ENABLED=true
|
||||||
TOKEN=somepassword
|
TOKEN=somepassword
|
||||||
- it: metrics token is empty
|
- it: "Omit the metrics token when it is empty"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
metrics:
|
metrics:
|
||||||
@@ -27,11 +28,12 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.metrics
|
path: data.metrics
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ENABLED=true
|
ENABLED=true
|
||||||
- it: metrics token is nil
|
- it: "Omit the metrics token when it is nil"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
metrics:
|
metrics:
|
||||||
@@ -40,11 +42,12 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.metrics
|
path: data.metrics
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ENABLED=true
|
ENABLED=true
|
||||||
- it: does not configures a token if metrics are disabled
|
- it: "Omit the metrics token when metrics are disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
metrics:
|
metrics:
|
||||||
@@ -53,6 +56,7 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.metrics
|
path: data.metrics
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
ENABLED=false
|
ENABLED=false
|
||||||
@@ -1,36 +1,38 @@
|
|||||||
suite: config template | queue config
|
suite: Test config queue
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
tests:
|
tests:
|
||||||
- it: "queue is configured correctly for valkey"
|
- it: "Configure the queue for valkey"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: true
|
enabled: true
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.queue
|
path: data.queue
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
CONN_STR=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
CONN_STR=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
||||||
TYPE=redis
|
TYPE=redis
|
||||||
|
|
||||||
- it: "queue is configured correctly for 'levelDB' when valkey is disabled"
|
- it: "Configure the queue for 'levelDB' when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.queue
|
path: data.queue
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
CONN_STR=
|
CONN_STR=
|
||||||
TYPE=level
|
TYPE=level
|
||||||
|
|
||||||
- it: "queue can be customized when valkey is disabled"
|
- it: "Customize the queue when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
@@ -39,7 +41,8 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.queue
|
path: data.queue
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
CONN_STR=custom-connection-string
|
CONN_STR=custom-connection-string
|
||||||
TYPE=custom-type
|
TYPE=custom-type
|
||||||
+49
-32
@@ -1,49 +1,55 @@
|
|||||||
suite: config template | server section (domain related)
|
suite: Test config server domain
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
tests:
|
tests:
|
||||||
- it: "[default values] uses ingress host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
- it: "[default values] Use the ingress host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nDOMAIN=git.example.com
|
pattern: \nDOMAIN=git.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nSSH_DOMAIN=git.example.com
|
pattern: \nSSH_DOMAIN=git.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=http://git.example.com
|
pattern: \nROOT_URL=http://git.example.com
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[no ingress hosts] uses gitea http service for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
- it: "[no ingress hosts] Use the HTTP Service for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
ingress:
|
ingress:
|
||||||
hosts: []
|
hosts: []
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nDOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
pattern: \nDOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nSSH_DOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
pattern: \nSSH_DOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=http://gitea-unittests-http.testing.svc.cluster.local
|
pattern: \nROOT_URL=http://gitea-unittests-http.testing.svc.cluster.local
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[provided via values] uses that for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
- it: "[provided via values] Use the configured values for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
gitea.config.server.DOMAIN: provided.example.com
|
gitea.config.server.DOMAIN: provided.example.com
|
||||||
ingress:
|
ingress:
|
||||||
@@ -55,21 +61,24 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nDOMAIN=provided.example.com
|
pattern: \nDOMAIN=provided.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nSSH_DOMAIN=provided.example.com
|
pattern: \nSSH_DOMAIN=provided.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=http://provided.example.com
|
pattern: \nROOT_URL=http://provided.example.com
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[route enabled] uses route host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
- it: "[route enabled] Use the Route host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
route:
|
route:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -77,21 +86,24 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nDOMAIN=route.example.com
|
pattern: \nDOMAIN=route.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nSSH_DOMAIN=route.example.com
|
pattern: \nSSH_DOMAIN=route.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=http://route.example.com
|
pattern: \nROOT_URL=http://route.example.com
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[route tls termination] uses https for ROOT_URL"
|
- it: "[route tls termination] Use https for ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
route:
|
route:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -101,13 +113,14 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=https://route.example.com
|
pattern: \nROOT_URL=https://route.example.com
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[HTTPRoute enabled] uses first hostname for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
- it: "[HTTPRoute enabled] Use the first hostname for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
ingress:
|
ingress:
|
||||||
hosts: []
|
hosts: []
|
||||||
@@ -123,21 +136,24 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nDOMAIN=gw.example.com
|
pattern: \nDOMAIN=gw.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nSSH_DOMAIN=gw.example.com
|
pattern: \nSSH_DOMAIN=gw.example.com
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=http://gw.example.com
|
pattern: \nROOT_URL=http://gw.example.com
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
- it: "[HTTPRoute tls] switches ROOT_URL to https"
|
- it: "[HTTPRoute tls] Switch ROOT_URL to https"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
ingress:
|
ingress:
|
||||||
hosts: []
|
hosts: []
|
||||||
@@ -154,5 +170,6 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData.server
|
path: data.server
|
||||||
|
decodeBase64: true
|
||||||
pattern: \nROOT_URL=https://gw.example.com
|
pattern: \nROOT_URL=https://gw.example.com
|
||||||
@@ -1,36 +1,38 @@
|
|||||||
suite: config template | session config
|
suite: Test config session
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
tests:
|
tests:
|
||||||
- it: "session is configured correctly for valkey"
|
- it: "Configure the session for valkey"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: true
|
enabled: true
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.session
|
path: data.session
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
PROVIDER=redis
|
PROVIDER=redis
|
||||||
PROVIDER_CONFIG=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
PROVIDER_CONFIG=redis://:changeme@gitea-unittests-valkey.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
|
||||||
|
|
||||||
- it: "session is configured correctly for 'memory' when valkey is disabled"
|
- it: "Configure the session for 'memory' when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.session
|
path: data.session
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
PROVIDER=memory
|
PROVIDER=memory
|
||||||
PROVIDER_CONFIG=
|
PROVIDER_CONFIG=
|
||||||
|
|
||||||
- it: "session can be customized when valkey is disabled"
|
- it: "Customize the session when valkey is disabled"
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
template: templates/secret_inlineConfig.yaml
|
||||||
set:
|
set:
|
||||||
valkey:
|
valkey:
|
||||||
enabled: false
|
enabled: false
|
||||||
@@ -39,7 +41,8 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: stringData.session
|
path: data.session
|
||||||
|
decodeBase64: true
|
||||||
value: |-
|
value: |-
|
||||||
PROVIDER=custom-provider
|
PROVIDER=custom-provider
|
||||||
PROVIDER_CONFIG=custom-provider-config
|
PROVIDER_CONFIG=custom-provider-config
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
suite: Dependency checks | Customization integrity | postgresql-ha
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
set:
|
|
||||||
postgresql:
|
|
||||||
enabled: false
|
|
||||||
postgresql-ha:
|
|
||||||
enabled: true
|
|
||||||
global:
|
|
||||||
postgresql:
|
|
||||||
database: gitea-database
|
|
||||||
password: gitea-password
|
|
||||||
username: gitea-username
|
|
||||||
postgresql:
|
|
||||||
repmgrPassword: custom-password-repmgr
|
|
||||||
postgresPassword: custom-password-postgres
|
|
||||||
password: custom-password-overwritten-by-global-postgresql-password
|
|
||||||
pgpool:
|
|
||||||
adminPassword: custom-password-pgpool
|
|
||||||
srCheckPassword: custom-password-sr-check
|
|
||||||
service:
|
|
||||||
ports:
|
|
||||||
postgresql: 1234
|
|
||||||
persistence:
|
|
||||||
size: 1337Mi
|
|
||||||
tests:
|
|
||||||
- it: "[postgresql-ha] DB settings are applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/postgresql/statefulset.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
contains:
|
|
||||||
path: spec.template.spec.containers[0].env
|
|
||||||
content:
|
|
||||||
name: POSTGRES_DB
|
|
||||||
value: "gitea-database"
|
|
||||||
- documentIndex: 0
|
|
||||||
contains:
|
|
||||||
path: spec.template.spec.containers[0].env
|
|
||||||
content:
|
|
||||||
name: POSTGRES_USER
|
|
||||||
value: "gitea-username"
|
|
||||||
- it: "[postgresql-ha] DB passwords are applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/postgresql/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["repmgr-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXJlcG1ncg=="
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["postgres-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXBvc3RncmVz"
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["password"]
|
|
||||||
value: "Z2l0ZWEtcGFzc3dvcmQ=" # postgresql-ha.postgresql.password is overwritten by postgresql-ha.global.postgresql.password and should not be referenced here
|
|
||||||
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["admin-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
||||||
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["admin-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
||||||
- it: "[postgresql-ha] pgpool.adminPassword is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["admin-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXBncG9vbA=="
|
|
||||||
- it: "[postgresql-ha] pgpool.srCheckPassword is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["sr-check-password"]
|
|
||||||
value: "Y3VzdG9tLXBhc3N3b3JkLXNyLWNoZWNr"
|
|
||||||
- it: "[postgresql-ha] persistence.size is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/postgresql/statefulset.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
|
|
||||||
value: "1337Mi"
|
|
||||||
- it: "[postgresql-ha] service.ports.postgresql is applied as expected"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/service.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: spec.ports[0].port
|
|
||||||
value: 1234
|
|
||||||
- it: "[postgresql-ha] renders the referenced service"
|
|
||||||
template: charts/postgresql-ha/templates/pgpool/service.yaml
|
|
||||||
asserts:
|
|
||||||
- containsDocument:
|
|
||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
name: gitea-unittests-postgresql-ha-pgpool
|
|
||||||
namespace: testing
|
|
||||||
- it: "[gitea] connects to pgpool service"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.cluster.local:1234
|
|
||||||
- it: "[gitea] connects to pgpool service with custom cluster domain"
|
|
||||||
set:
|
|
||||||
clusterDomain: my-special-cluster.local
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.my-special-cluster.local:1234
|
|
||||||
- it: "[gitea] connects to configured database"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: NAME=gitea-database
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: USER=gitea-username
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: PASSWD=gitea-password
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
suite: Dependency checks | Customization integrity | postgresql
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
set:
|
|
||||||
postgresql-ha:
|
|
||||||
enabled: false
|
|
||||||
postgresql:
|
|
||||||
enabled: true
|
|
||||||
global:
|
|
||||||
postgresql:
|
|
||||||
auth:
|
|
||||||
password: gitea-password
|
|
||||||
database: gitea-database
|
|
||||||
username: gitea-username
|
|
||||||
service:
|
|
||||||
ports:
|
|
||||||
postgresql: 1234
|
|
||||||
primary:
|
|
||||||
persistence:
|
|
||||||
size: 1337Mi
|
|
||||||
tests:
|
|
||||||
- it: "[postgresql] DB settings are applied as expected"
|
|
||||||
template: charts/postgresql/templates/primary/statefulset.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
contains:
|
|
||||||
path: spec.template.spec.containers[0].env
|
|
||||||
content:
|
|
||||||
name: POSTGRES_DATABASE
|
|
||||||
value: "gitea-database"
|
|
||||||
- documentIndex: 0
|
|
||||||
contains:
|
|
||||||
path: spec.template.spec.containers[0].env
|
|
||||||
content:
|
|
||||||
name: POSTGRES_USER
|
|
||||||
value: "gitea-username"
|
|
||||||
- it: "[postgresql] DB password is applied as expected"
|
|
||||||
template: charts/postgresql/templates/secrets.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: data["password"]
|
|
||||||
value: "Z2l0ZWEtcGFzc3dvcmQ="
|
|
||||||
- it: "[postgresql] primary.persistence.size is applied as expected"
|
|
||||||
template: charts/postgresql/templates/primary/statefulset.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
|
|
||||||
value: "1337Mi"
|
|
||||||
- it: "[postgresql] global.postgresql.service.ports.postgresql is applied as expected"
|
|
||||||
template: charts/postgresql/templates/primary/svc.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
equal:
|
|
||||||
path: spec.ports[0].port
|
|
||||||
value: 1234
|
|
||||||
- it: "[postgresql] renders the referenced service"
|
|
||||||
template: charts/postgresql/templates/primary/svc.yaml
|
|
||||||
asserts:
|
|
||||||
- containsDocument:
|
|
||||||
kind: Service
|
|
||||||
apiVersion: v1
|
|
||||||
name: gitea-unittests-postgresql
|
|
||||||
namespace: testing
|
|
||||||
- it: "[gitea] connects to postgresql service"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: HOST=gitea-unittests-postgresql.testing.svc.cluster.local:1234
|
|
||||||
- it: "[gitea] connects to postgresql service with custom cluster domain"
|
|
||||||
set:
|
|
||||||
clusterDomain: my-special-cluster.local
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: HOST=gitea-unittests-postgresql.testing.svc.my-special-cluster.local:1234
|
|
||||||
- it: "[gitea] connects to configured database"
|
|
||||||
template: templates/gitea/secret_inlineConfig.yaml
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: NAME=gitea-database
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: USER=gitea-username
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: stringData.database
|
|
||||||
pattern: PASSWD=gitea-password
|
|
||||||
+11
-9
@@ -1,4 +1,4 @@
|
|||||||
suite: Dependency checks | Customization integrity | valkey
|
suite: Test dependency customization integrity of valkey
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
@@ -12,14 +12,14 @@ set:
|
|||||||
permissions: "~* &* +@all"
|
permissions: "~* &* +@all"
|
||||||
password: gitea-password
|
password: gitea-password
|
||||||
tests:
|
tests:
|
||||||
- it: "[valkey] valkey.auth.aclUsers.default.password is applied as expected"
|
- it: "[valkey] Apply valkey.auth.aclUsers.default.password"
|
||||||
template: charts/valkey/templates/secret.yaml
|
template: charts/valkey/templates/secret.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
equal:
|
equal:
|
||||||
path: data.default-password
|
path: data.default-password
|
||||||
value: "Z2l0ZWEtcGFzc3dvcmQ="
|
value: "Z2l0ZWEtcGFzc3dvcmQ="
|
||||||
- it: "[valkey] renders the referenced service"
|
- it: "[valkey] Render the referenced Service"
|
||||||
template: charts/valkey/templates/service.yaml
|
template: charts/valkey/templates/service.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- containsDocument:
|
- containsDocument:
|
||||||
@@ -34,19 +34,21 @@ tests:
|
|||||||
port: 6379
|
port: 6379
|
||||||
targetPort: tcp
|
targetPort: tcp
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- it: "[gitea] waits for valkey to be up and running"
|
- it: "[gitea] Wait for valkey to be up and running"
|
||||||
template: templates/gitea/secret_init.yaml
|
template: templates/secret_init.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData["configure_gitea.sh"]
|
path: data["configure_gitea.sh"]
|
||||||
|
decodeBase64: true
|
||||||
pattern: nc -vz -w2 gitea-unittests-valkey.testing.svc.cluster.local 6379
|
pattern: nc -vz -w2 gitea-unittests-valkey.testing.svc.cluster.local 6379
|
||||||
- it: "[gitea] waits for valkey to be up and running with custom cluster domain"
|
- it: "[gitea] Wait for valkey to be up and running with a custom cluster domain"
|
||||||
set:
|
set:
|
||||||
clusterDomain: my-special-cluster.local
|
clusterDomain: my-special-cluster.local
|
||||||
template: templates/gitea/secret_init.yaml
|
template: templates/secret_init.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- documentIndex: 0
|
- documentIndex: 0
|
||||||
matchRegex:
|
matchRegex:
|
||||||
path: stringData["configure_gitea.sh"]
|
path: data["configure_gitea.sh"]
|
||||||
|
decodeBase64: true
|
||||||
pattern: nc -vz -w2 gitea-unittests-valkey.testing.svc.my-special-cluster.local 6379
|
pattern: nc -vz -w2 gitea-unittests-valkey.testing.svc.my-special-cluster.local 6379
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
suite: Dependency checks | Major image bumps
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
tests:
|
|
||||||
- it: "[postgresql-ha] ensures we detect major image version upgrades"
|
|
||||||
template: charts/postgresql-ha/templates/postgresql/statefulset.yaml
|
|
||||||
set:
|
|
||||||
postgresql:
|
|
||||||
enabled: false
|
|
||||||
postgresql-ha:
|
|
||||||
enabled: true
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: spec.template.spec.containers[0].image
|
|
||||||
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
|
|
||||||
pattern: bitnamilegacy/postgresql-repmgr:17.+$
|
|
||||||
- it: "[postgresql] ensures we detect major image version upgrades"
|
|
||||||
template: charts/postgresql/templates/primary/statefulset.yaml
|
|
||||||
set:
|
|
||||||
postgresql:
|
|
||||||
enabled: true
|
|
||||||
postgresql-ha:
|
|
||||||
enabled: false
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: spec.template.spec.containers[0].image
|
|
||||||
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
|
|
||||||
pattern: bitnamilegacy/postgresql:17.+$
|
|
||||||
- it: "[valkey] ensures we detect major image version upgrades"
|
|
||||||
template: charts/valkey/templates/deploy_valkey.yaml
|
|
||||||
set:
|
|
||||||
valkey:
|
|
||||||
enabled: true
|
|
||||||
asserts:
|
|
||||||
- documentIndex: 0
|
|
||||||
matchRegex:
|
|
||||||
path: spec.template.spec.containers[0].image
|
|
||||||
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
|
|
||||||
pattern: valkey/valkey:9.+$
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
suite: Test dependency major image bumps
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
tests:
|
||||||
|
- it: "[valkey] Detect major image version upgrades"
|
||||||
|
template: charts/valkey/templates/deploy_valkey.yaml
|
||||||
|
set:
|
||||||
|
valkey:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
matchRegex:
|
||||||
|
path: spec.template.spec.containers[0].image
|
||||||
|
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
|
||||||
|
pattern: valkey/valkey:9.+$
|
||||||
+18
-18
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template
|
suite: Test deployment additional config
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: Renders a deployment
|
- it: "Render a Deployment with additionalConfigFromEnvs"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
@@ -20,8 +20,8 @@ tests:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
- it: Deployment with empty additionalConfigFromEnvs
|
- it: "Render the Deployment with empty additionalConfigFromEnvs"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea.additionalConfigFromEnvs: []
|
gitea.additionalConfigFromEnvs: []
|
||||||
asserts:
|
asserts:
|
||||||
@@ -48,8 +48,8 @@ tests:
|
|||||||
value: /tmp/existing-envs
|
value: /tmp/existing-envs
|
||||||
- name: ENV_TO_INI_MOUNT_POINT
|
- name: ENV_TO_INI_MOUNT_POINT
|
||||||
value: /env-to-ini-mounts
|
value: /env-to-ini-mounts
|
||||||
- it: Deployment with standard additionalConfigFromEnvs
|
- it: "Render the Deployment with standard additionalConfigFromEnvs"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea.additionalConfigFromEnvs: [{name: GITEA_database_HOST, value: my-db:123}, {name: GITEA_database_USER, value: my-user}]
|
gitea.additionalConfigFromEnvs: [{name: GITEA_database_HOST, value: my-db:123}, {name: GITEA_database_USER, value: my-user}]
|
||||||
asserts:
|
asserts:
|
||||||
@@ -80,8 +80,8 @@ tests:
|
|||||||
value: my-db:123
|
value: my-db:123
|
||||||
- name: GITEA_database_USER
|
- name: GITEA_database_USER
|
||||||
value: my-user
|
value: my-user
|
||||||
- it: Deployment with templated additionalConfigFromEnvs
|
- it: "Render the Deployment with templated additionalConfigFromEnvs"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea.misc.host: my-db-host:321
|
gitea.misc.host: my-db-host:321
|
||||||
gitea.misc.user: my-db-user
|
gitea.misc.user: my-db-user
|
||||||
@@ -114,8 +114,8 @@ tests:
|
|||||||
value: my-db-host:321
|
value: my-db-host:321
|
||||||
- name: GITEA_database_USER
|
- name: GITEA_database_USER
|
||||||
value: my-db-user
|
value: my-db-user
|
||||||
- it: Deployment with additionalConfigFromEnvs templated secret name
|
- it: "Render the Deployment with a templated Secret name in additionalConfigFromEnvs"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea.misc.existingSecret: my-db-secret
|
gitea.misc.existingSecret: my-db-secret
|
||||||
gitea.additionalConfigFromEnvs[0]:
|
gitea.additionalConfigFromEnvs[0]:
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (admin user)
|
suite: Test deployment admin user
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: reads the admin credentials from the generated secret
|
- it: "Read the admin credentials from the generated Secret"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- contains:
|
- contains:
|
||||||
path: spec.template.spec.initContainers[2].env
|
path: spec.template.spec.initContainers[2].env
|
||||||
@@ -44,8 +44,8 @@ tests:
|
|||||||
name: GITEA_ADMIN_PASSWORD_MODE
|
name: GITEA_ADMIN_PASSWORD_MODE
|
||||||
value: keepUpdated
|
value: keepUpdated
|
||||||
|
|
||||||
- it: reads the admin credentials from the configured keys of an existing secret
|
- it: "Read the admin credentials from the configured keys of an existing Secret"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.admin.existingSecret.enabled: true
|
secrets.admin.existingSecret.enabled: true
|
||||||
secrets.admin.existingSecret.secretName: custom-admin-secret
|
secrets.admin.existingSecret.secretName: custom-admin-secret
|
||||||
@@ -78,8 +78,8 @@ tests:
|
|||||||
key: custom-email
|
key: custom-email
|
||||||
name: custom-admin-secret
|
name: custom-admin-secret
|
||||||
|
|
||||||
- it: omits the admin environment when the admin user is disabled
|
- it: "Omit the admin environment when the admin user is disabled"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.admin.enabled: false
|
secrets.admin.enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
@@ -94,8 +94,8 @@ tests:
|
|||||||
name: GITEA_ADMIN_PASSWORD_MODE
|
name: GITEA_ADMIN_PASSWORD_MODE
|
||||||
any: true
|
any: true
|
||||||
|
|
||||||
- it: fails on an unsupported password mode
|
- it: "Fail on an unsupported password mode"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.admin.passwordMode: unsupported
|
secrets.admin.passwordMode: unsupported
|
||||||
asserts:
|
asserts:
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (basic)
|
suite: Test deployment basics
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: renders a deployment
|
- it: "Render a Deployment"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
@@ -20,15 +20,15 @@ tests:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
- it: renders no deployment when disabled
|
- it: "Skip rendering when the Deployment is disabled"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.enabled: false
|
deployment.enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 0
|
count: 0
|
||||||
- it: deployment labels are set
|
- it: "Render the configured Deployment labels"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.labels:
|
deployment.labels:
|
||||||
hello: world
|
hello: world
|
||||||
@@ -45,8 +45,8 @@ tests:
|
|||||||
path: spec.selector.matchLabels
|
path: spec.selector.matchLabels
|
||||||
content:
|
content:
|
||||||
hello: world
|
hello: world
|
||||||
- it: deployment labels are not in selector matchLabels
|
- it: "Omit the Deployment labels from the selector matchLabels"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.labels:
|
deployment.labels:
|
||||||
custom-label: custom-value
|
custom-label: custom-value
|
||||||
@@ -57,12 +57,37 @@ tests:
|
|||||||
value:
|
value:
|
||||||
app.kubernetes.io/name: gitea
|
app.kubernetes.io/name: gitea
|
||||||
app.kubernetes.io/instance: gitea-unittests
|
app.kubernetes.io/instance: gitea-unittests
|
||||||
- it: nodeSelector is undefined
|
- it: "Render the Deployment labels even when none are configured"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
asserts:
|
||||||
|
- isSubset:
|
||||||
|
path: metadata.labels
|
||||||
|
content:
|
||||||
|
app: gitea
|
||||||
|
app.kubernetes.io/name: gitea
|
||||||
|
app.kubernetes.io/instance: gitea-unittests
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
- it: "Omit the Deployment annotations when none are configured"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
asserts:
|
||||||
|
- notExists:
|
||||||
|
path: metadata.annotations
|
||||||
|
- it: "Render the configured Deployment annotations"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.annotations:
|
||||||
|
hello: world
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: metadata.annotations
|
||||||
|
value:
|
||||||
|
hello: world
|
||||||
|
- it: "Omit the nodeSelector when none is configured"
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.nodeSelector
|
path: spec.template.spec.nodeSelector
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- it: nodeSelector is defined
|
- it: "Render the configured nodeSelector"
|
||||||
set:
|
set:
|
||||||
deployment.nodeSelector:
|
deployment.nodeSelector:
|
||||||
foo: bar
|
foo: bar
|
||||||
@@ -73,14 +98,14 @@ tests:
|
|||||||
content:
|
content:
|
||||||
foo: bar
|
foo: bar
|
||||||
bar: foo
|
bar: foo
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- it: affinity is undefined
|
- it: "Omit the affinity when none is configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.affinity
|
path: spec.template.spec.affinity
|
||||||
- it: affinity is defined
|
- it: "Render the configured affinity"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.affinity:
|
deployment.affinity:
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
@@ -103,13 +128,13 @@ tests:
|
|||||||
operator: In
|
operator: In
|
||||||
values:
|
values:
|
||||||
- linux
|
- linux
|
||||||
- it: dnsConfig is undefined
|
- it: "Omit the dnsConfig when none is configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.dnsConfig
|
path: spec.template.spec.dnsConfig
|
||||||
- it: dnsConfig is defined
|
- it: "Render the configured dnsConfig"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.dnsConfig:
|
deployment.dnsConfig:
|
||||||
nameservers:
|
nameservers:
|
||||||
@@ -126,34 +151,34 @@ tests:
|
|||||||
options:
|
options:
|
||||||
- name: ndots
|
- name: ndots
|
||||||
value: "2"
|
value: "2"
|
||||||
- it: priorityClassName is undefined
|
- it: "Omit the priorityClassName when none is configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.priorityClassName
|
path: spec.template.spec.priorityClassName
|
||||||
- it: priorityClassName is defined
|
- it: "Render the configured priorityClassName"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.priorityClassName: high-priority
|
deployment.priorityClassName: high-priority
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.priorityClassName
|
path: spec.template.spec.priorityClassName
|
||||||
value: high-priority
|
value: high-priority
|
||||||
- it: schedulerName is undefined
|
- it: "Omit the schedulerName when none is configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.schedulerName
|
path: spec.template.spec.schedulerName
|
||||||
- it: schedulerName is defined
|
- it: "Render the configured schedulerName"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.schedulerName: stork
|
deployment.schedulerName: stork
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.schedulerName
|
path: spec.template.spec.schedulerName
|
||||||
value: stork
|
value: stork
|
||||||
- it: strategy defaults to a rolling update
|
- it: "Default the strategy to a rolling update"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.strategy
|
path: spec.strategy
|
||||||
@@ -162,8 +187,8 @@ tests:
|
|||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 0
|
maxUnavailable: 0
|
||||||
maxSurge: 100%
|
maxSurge: 100%
|
||||||
- it: strategy omits rollingUpdate for other strategy types
|
- it: "Omit rollingUpdate for other strategy types"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.strategy.type: Recreate
|
deployment.strategy.type: Recreate
|
||||||
asserts:
|
asserts:
|
||||||
@@ -171,13 +196,13 @@ tests:
|
|||||||
path: spec.strategy
|
path: spec.strategy
|
||||||
value:
|
value:
|
||||||
type: Recreate
|
type: Recreate
|
||||||
- it: tolerations are undefined
|
- it: "Omit the tolerations when none are configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.tolerations
|
path: spec.template.spec.tolerations
|
||||||
- it: tolerations are defined
|
- it: "Render the configured tolerations"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.tolerations:
|
deployment.tolerations:
|
||||||
- key: database/type
|
- key: database/type
|
||||||
@@ -192,13 +217,13 @@ tests:
|
|||||||
operator: Equal
|
operator: Equal
|
||||||
value: postgres
|
value: postgres
|
||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
- it: topologySpreadConstraints are undefined
|
- it: "Omit the topologySpreadConstraints when none are configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.topologySpreadConstraints
|
path: spec.template.spec.topologySpreadConstraints
|
||||||
- it: topologySpreadConstraints are defined
|
- it: "Render the configured topologySpreadConstraints"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.topologySpreadConstraints:
|
deployment.topologySpreadConstraints:
|
||||||
- topologyKey: kubernetes.io/hostname
|
- topologyKey: kubernetes.io/hostname
|
||||||
@@ -218,24 +243,24 @@ tests:
|
|||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/instance: gitea-unittests
|
app.kubernetes.io/instance: gitea-unittests
|
||||||
|
|
||||||
- it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container"
|
- it: "Inject TMP_EXISTING_ENVS_FILE into the 'init-app-ini' init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- contains:
|
- contains:
|
||||||
path: spec.template.spec.initContainers[1].env
|
path: spec.template.spec.initContainers[1].env
|
||||||
content:
|
content:
|
||||||
name: TMP_EXISTING_ENVS_FILE
|
name: TMP_EXISTING_ENVS_FILE
|
||||||
value: /tmp/existing-envs
|
value: /tmp/existing-envs
|
||||||
- it: "injects ENV_TO_INI_MOUNT_POINT as environment variable to 'init-app-ini' init container"
|
- it: "Inject ENV_TO_INI_MOUNT_POINT into the 'init-app-ini' init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- contains:
|
- contains:
|
||||||
path: spec.template.spec.initContainers[1].env
|
path: spec.template.spec.initContainers[1].env
|
||||||
content:
|
content:
|
||||||
name: ENV_TO_INI_MOUNT_POINT
|
name: ENV_TO_INI_MOUNT_POINT
|
||||||
value: /env-to-ini-mounts
|
value: /env-to-ini-mounts
|
||||||
- it: "deployment.gitea.env is injected into all init containers and the gitea container"
|
- it: "Inject deployment.gitea.env into all init containers and the gitea container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.env:
|
deployment.gitea.env:
|
||||||
- name: VARIABLE
|
- name: VARIABLE
|
||||||
@@ -261,8 +286,8 @@ tests:
|
|||||||
content:
|
content:
|
||||||
name: VARIABLE
|
name: VARIABLE
|
||||||
value: my-value
|
value: my-value
|
||||||
- it: CPU resources are defined as well as GOMAXPROCS
|
- it: "Render GOMAXPROCS when the CPU resources are defined"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.resources:
|
deployment.gitea.resources:
|
||||||
limits:
|
limits:
|
||||||
@@ -289,8 +314,8 @@ tests:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 100ms
|
cpu: 100ms
|
||||||
memory: 100Mi
|
memory: 100Mi
|
||||||
- it: container resources default to an empty map and GOMAXPROCS is omitted
|
- it: "Default the container resources to an empty map and omit GOMAXPROCS"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].resources
|
path: spec.template.spec.containers[0].resources
|
||||||
@@ -303,13 +328,13 @@ tests:
|
|||||||
resourceFieldRef:
|
resourceFieldRef:
|
||||||
divisor: "1"
|
divisor: "1"
|
||||||
resource: limits.cpu
|
resource: limits.cpu
|
||||||
- it: pod level resources are undefined
|
- it: "Omit the pod level resources when none are configured"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.resources
|
path: spec.template.spec.resources
|
||||||
- it: pod level resources are defined
|
- it: "Render the configured pod level resources"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.resources:
|
deployment.resources:
|
||||||
limits:
|
limits:
|
||||||
@@ -328,8 +353,8 @@ tests:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 250m
|
cpu: 250m
|
||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
- it: Init containers have correct volumeMount path
|
- it: "Render the configured volumeMount path of the init containers"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
initContainersScriptsVolumeMountPath: "/custom/init/path"
|
initContainersScriptsVolumeMountPath: "/custom/init/path"
|
||||||
asserts:
|
asserts:
|
||||||
@@ -339,8 +364,8 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath
|
||||||
value: "/custom/init/path"
|
value: "/custom/init/path"
|
||||||
- it: Init containers have correct volumeMount path if there is no override
|
- it: "Render the default volumeMount path of the init containers"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="init")].mountPath
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="init")].mountPath
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
suite: deployment template (checksum annotations)
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
templates:
|
|
||||||
- templates/gitea/deployment.yaml
|
|
||||||
- templates/gitea/secret_admin.yaml
|
|
||||||
- templates/gitea/secret_config.yaml
|
|
||||||
- templates/gitea/secret_gpg.yaml
|
|
||||||
- templates/gitea/secret_init.yaml
|
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
|
||||||
- templates/gitea/secret_metrics.yaml
|
|
||||||
tests:
|
|
||||||
- it: adds a checksum annotation for every Secret by default
|
|
||||||
template: templates/gitea/deployment.yaml
|
|
||||||
asserts:
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/admin"]
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/config"]
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/init"]
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/metrics"]
|
|
||||||
|
|
||||||
- it: omits the checksum annotations when addSHASumAnnotation is disabled
|
|
||||||
template: templates/gitea/deployment.yaml
|
|
||||||
set:
|
|
||||||
secrets.admin.addSHASumAnnotation: false
|
|
||||||
secrets.config.addSHASumAnnotation: false
|
|
||||||
secrets.gpg.addSHASumAnnotation: false
|
|
||||||
secrets.init.addSHASumAnnotation: false
|
|
||||||
secrets.inlineConfig.addSHASumAnnotation: false
|
|
||||||
secrets.metrics.addSHASumAnnotation: false
|
|
||||||
asserts:
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/admin"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/config"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/gpg"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/init"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/metrics"]
|
|
||||||
|
|
||||||
- it: omits the checksum annotation of a single disabled Secret only
|
|
||||||
template: templates/gitea/deployment.yaml
|
|
||||||
set:
|
|
||||||
secrets.init.addSHASumAnnotation: false
|
|
||||||
asserts:
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/config"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/init"]
|
|
||||||
- exists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
|
||||||
|
|
||||||
- it: omits the checksum annotations of Secrets provided by the user
|
|
||||||
template: templates/gitea/deployment.yaml
|
|
||||||
set:
|
|
||||||
secrets.admin.existingSecret.enabled: true
|
|
||||||
secrets.admin.existingSecret.secretName: custom-admin
|
|
||||||
secrets.config.existingSecret.enabled: true
|
|
||||||
secrets.config.existingSecret.secretName: custom-config
|
|
||||||
secrets.gpg.existingSecret.enabled: true
|
|
||||||
secrets.gpg.existingSecret.secretName: custom-gpg
|
|
||||||
secrets.init.existingSecret.enabled: true
|
|
||||||
secrets.init.existingSecret.secretName: custom-init
|
|
||||||
secrets.inlineConfig.existingSecret.enabled: true
|
|
||||||
secrets.inlineConfig.existingSecret.secretName: custom-inline-config
|
|
||||||
secrets.metrics.existingSecret.enabled: true
|
|
||||||
secrets.metrics.existingSecret.secretName: custom-metrics
|
|
||||||
asserts:
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/admin"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/config"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/gpg"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/init"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
|
||||||
- notExists:
|
|
||||||
path: spec.template.metadata.annotations["checksum/metrics"]
|
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
suite: Test deployment checksum annotations
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/deployment.yaml
|
||||||
|
- templates/secret_admin.yaml
|
||||||
|
- templates/secret_cloudnativePG.yaml
|
||||||
|
- templates/secret_config.yaml
|
||||||
|
- templates/secret_gpg.yaml
|
||||||
|
- templates/secret_init.yaml
|
||||||
|
- templates/secret_inlineConfig.yaml
|
||||||
|
- templates/secret_metrics.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Omit the checksum annotations by default"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG.enabled: true
|
||||||
|
|
||||||
|
secrets.admin.enabled: true
|
||||||
|
secrets.config.enabled: true
|
||||||
|
secrets.gpg.enabled: true
|
||||||
|
secrets.gpg.new.privateKey: |
|
||||||
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||||
|
-----END PGP PRIVATE KEY BLOCK-----
|
||||||
|
secrets.init.enabled: true
|
||||||
|
secrets.inlineConfig.enabled: true
|
||||||
|
secrets.metrics.enabled: true
|
||||||
|
asserts:
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/admin"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/cloudnativePG"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/config"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/gpg"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/init"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/metrics"]
|
||||||
|
|
||||||
|
- it: "Add a checksum annotation for every Secret when addSHASumAnnotation is enabled"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG.credentials.addSHASumAnnotation: true
|
||||||
|
cloudnativePG.enabled: true
|
||||||
|
|
||||||
|
secrets.admin.addSHASumAnnotation: true
|
||||||
|
secrets.admin.enabled: true
|
||||||
|
|
||||||
|
secrets.config.addSHASumAnnotation: true
|
||||||
|
secrets.config.enabled: true
|
||||||
|
|
||||||
|
secrets.gpg.addSHASumAnnotation: true
|
||||||
|
secrets.gpg.enabled: true
|
||||||
|
secrets.gpg.new.privateKey: |
|
||||||
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||||
|
-----END PGP PRIVATE KEY BLOCK-----
|
||||||
|
|
||||||
|
secrets.init.addSHASumAnnotation: true
|
||||||
|
secrets.init.enabled: true
|
||||||
|
|
||||||
|
secrets.inlineConfig.addSHASumAnnotation: true
|
||||||
|
secrets.inlineConfig.enabled: true
|
||||||
|
|
||||||
|
secrets.metrics.addSHASumAnnotation: true
|
||||||
|
secrets.metrics.enabled: true
|
||||||
|
asserts:
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/admin"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/cloudnativePG"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/config"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/gpg"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/init"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/metrics"]
|
||||||
|
|
||||||
|
- it: "Omit the checksum annotation of a single disabled Secret only"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
secrets.admin.addSHASumAnnotation: false
|
||||||
|
secrets.admin.enabled: true
|
||||||
|
|
||||||
|
secrets.config.addSHASumAnnotation: false
|
||||||
|
secrets.config.enabled: true
|
||||||
|
|
||||||
|
secrets.gpg.addSHASumAnnotation: false
|
||||||
|
secrets.gpg.enabled: true
|
||||||
|
secrets.gpg.new.privateKey: |
|
||||||
|
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||||
|
-----END PGP PRIVATE KEY BLOCK-----
|
||||||
|
|
||||||
|
secrets.init.addSHASumAnnotation: false
|
||||||
|
secrets.init.enabled: true
|
||||||
|
|
||||||
|
secrets.inlineConfig.addSHASumAnnotation: false
|
||||||
|
secrets.inlineConfig.enabled: true
|
||||||
|
|
||||||
|
secrets.metrics.addSHASumAnnotation: false
|
||||||
|
secrets.metrics.enabled: true
|
||||||
|
asserts:
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/admin"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/config"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/gpg"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/init"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/metrics"]
|
||||||
|
|
||||||
|
- it: "Add the checksum of Secrets provided by the user"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
secrets.admin.enabled: true
|
||||||
|
secrets.admin.addSHASumAnnotation: true
|
||||||
|
secrets.admin.existingSecret.enabled: true
|
||||||
|
secrets.admin.existingSecret.secretName: custom-admin
|
||||||
|
|
||||||
|
secrets.config.enabled: true
|
||||||
|
secrets.config.addSHASumAnnotation: true
|
||||||
|
secrets.config.existingSecret.enabled: true
|
||||||
|
secrets.config.existingSecret.secretName: custom-config
|
||||||
|
|
||||||
|
secrets.gpg.enabled: true
|
||||||
|
secrets.gpg.addSHASumAnnotation: true
|
||||||
|
secrets.gpg.existingSecret.enabled: true
|
||||||
|
secrets.gpg.existingSecret.secretName: custom-gpg
|
||||||
|
|
||||||
|
secrets.init.enabled: true
|
||||||
|
secrets.init.addSHASumAnnotation: true
|
||||||
|
secrets.init.existingSecret.enabled: true
|
||||||
|
secrets.init.existingSecret.secretName: custom-init
|
||||||
|
|
||||||
|
secrets.inlineConfig.enabled: true
|
||||||
|
secrets.inlineConfig.addSHASumAnnotation: true
|
||||||
|
secrets.inlineConfig.existingSecret.enabled: true
|
||||||
|
secrets.inlineConfig.existingSecret.secretName: custom-inline-config
|
||||||
|
|
||||||
|
secrets.metrics.enabled: true
|
||||||
|
secrets.metrics.addSHASumAnnotation: true
|
||||||
|
secrets.metrics.existingSecret.enabled: true
|
||||||
|
secrets.metrics.existingSecret.secretName: custom-metrics
|
||||||
|
asserts:
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/admin"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/config"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/gpg"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/init"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/inlineConfig"]
|
||||||
|
- exists:
|
||||||
|
path: spec.template.metadata.annotations["checksum/metrics"]
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
suite: Test deployment cloudnativePG credentials
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/deployment.yaml
|
||||||
|
- templates/secret_cloudnativePG.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Inject no database password when cloudnativePG is disabled"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: false
|
||||||
|
asserts:
|
||||||
|
- notContains:
|
||||||
|
path: spec.template.spec.initContainers[1].env
|
||||||
|
content:
|
||||||
|
name: GITEA__database__PASSWD
|
||||||
|
any: true
|
||||||
|
|
||||||
|
- it: "Inject the database password from the rendered Secret"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
asserts:
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.initContainers[1].env
|
||||||
|
content:
|
||||||
|
name: GITEA__database__PASSWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: password
|
||||||
|
name: gitea-unittests-postgresql-app
|
||||||
|
|
||||||
|
- it: "Inject the database password from an existing Secret"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
credentials:
|
||||||
|
existingSecret:
|
||||||
|
enabled: true
|
||||||
|
secretName: my-credentials
|
||||||
|
passwordKey: my-password-key
|
||||||
|
asserts:
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.initContainers[1].env
|
||||||
|
content:
|
||||||
|
name: GITEA__database__PASSWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: my-password-key
|
||||||
|
name: my-credentials
|
||||||
|
|
||||||
|
- it: "Fail when an existing Secret is used without a name"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
cloudnativePG:
|
||||||
|
enabled: true
|
||||||
|
credentials:
|
||||||
|
existingSecret:
|
||||||
|
enabled: true
|
||||||
|
secretName: ""
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "`cloudnativePG.credentials.existingSecret.secretName` must be set when `cloudnativePG.credentials.existingSecret.enabled` is enabled"
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (extraEnvSourceFile)
|
suite: Test deployment extraEnvSourceFile
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: uses direct execution when extraEnvSourceFile is not set
|
- it: "Use direct execution when extraEnvSourceFile is not set"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[1].command
|
path: spec.template.spec.initContainers[1].command
|
||||||
@@ -25,8 +25,8 @@ tests:
|
|||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.initContainers[2].args
|
path: spec.template.spec.initContainers[2].args
|
||||||
|
|
||||||
- it: sources env file in init-app-ini when extraEnvSourceFile is set
|
- it: "Source the env file in init-app-ini when extraEnvSourceFile is set"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
extraEnvSourceFile: /vault/secrets/gitea
|
extraEnvSourceFile: /vault/secrets/gitea
|
||||||
@@ -41,8 +41,8 @@ tests:
|
|||||||
path: spec.template.spec.initContainers[1].args[0]
|
path: spec.template.spec.initContainers[1].args[0]
|
||||||
pattern: config_environment\.sh
|
pattern: config_environment\.sh
|
||||||
|
|
||||||
- it: sources env file in configure-gitea when extraEnvSourceFile is set
|
- it: "Source the env file in configure-gitea when extraEnvSourceFile is set"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
extraEnvSourceFile: /vault/secrets/gitea
|
extraEnvSourceFile: /vault/secrets/gitea
|
||||||
@@ -57,8 +57,8 @@ tests:
|
|||||||
path: spec.template.spec.initContainers[2].args[0]
|
path: spec.template.spec.initContainers[2].args[0]
|
||||||
pattern: configure_gitea\.sh
|
pattern: configure_gitea\.sh
|
||||||
|
|
||||||
- it: sources env file in configure-gpg when extraEnvSourceFile is set with signing enabled
|
- it: "Source the env file in configure-gpg when extraEnvSourceFile is set and signing is enabled"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -76,8 +76,8 @@ tests:
|
|||||||
path: spec.template.spec.initContainers[2].args[0]
|
path: spec.template.spec.initContainers[2].args[0]
|
||||||
pattern: configure_gpg_environment\.sh
|
pattern: configure_gpg_environment\.sh
|
||||||
|
|
||||||
- it: includes file existence check in source command
|
- it: "Include a file existence check in the source command"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
extraEnvSourceFile: /vault/secrets/gitea
|
extraEnvSourceFile: /vault/secrets/gitea
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
suite: deployment template
|
suite: Test deployment extraInitContainers
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: Render the deployment (default)
|
- it: "Render the Deployment with the default init containers"
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- lengthEqual:
|
- lengthEqual:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers
|
||||||
count: 3
|
count: 3
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
|
|
||||||
- it: Render the deployment (signing)
|
- it: "Render the Deployment with the signing init container"
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -29,40 +29,85 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- lengthEqual:
|
- lengthEqual:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers
|
||||||
count: 4
|
count: 4
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
|
|
||||||
- it: Render the deployment (extraInitContainers)
|
- it: "Render the Deployment with extraInitContainers"
|
||||||
set:
|
set:
|
||||||
postExtraInitContainers:
|
deployment.initContainers:
|
||||||
- name: foo
|
- container:
|
||||||
image: docker.io/library/busybox:latest
|
name: bar
|
||||||
preExtraInitContainers:
|
image: docker.io/library/busybox:latest
|
||||||
- name: bar
|
- link: "initDirectories"
|
||||||
image: docker.io/library/busybox:latest
|
- link: "initAppIni"
|
||||||
|
- link: "initConfigureGPG"
|
||||||
|
- link: "initConfigureGitea"
|
||||||
|
- container:
|
||||||
|
name: foo
|
||||||
|
image: docker.io/library/busybox:latest
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
secrets.gpg.existingSecret.secretName: "custom-gpg-secret"
|
secrets.gpg.existingSecret.secretName: "custom-gpg-secret"
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- lengthEqual:
|
- lengthEqual:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers
|
||||||
count: 6
|
count: 6
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
- contains:
|
- equal:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers[0].name
|
||||||
content:
|
value: bar
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[5].name
|
||||||
|
value: foo
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
|
||||||
|
- it: "Render the chart-managed init containers in the configured order"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initContainers:
|
||||||
|
- link: "initConfigureGitea"
|
||||||
|
- link: "initDirectories"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].name
|
||||||
|
value: configure-gitea
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].name
|
||||||
|
value: init-directories
|
||||||
|
|
||||||
|
- it: "Fail when an init container entry sets both container and link"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initContainers:
|
||||||
|
- link: "initDirectories"
|
||||||
|
container:
|
||||||
name: foo
|
name: foo
|
||||||
image: docker.io/library/busybox:latest
|
image: docker.io/library/busybox:latest
|
||||||
template: templates/gitea/deployment.yaml
|
asserts:
|
||||||
- contains:
|
- failedTemplate:
|
||||||
path: spec.template.spec.initContainers
|
errorMessage: "deployment.initContainers[0]: `container` and `link` are mutually exclusive"
|
||||||
content:
|
|
||||||
name: bar
|
- it: "Fail when an init container entry sets neither container nor link"
|
||||||
image: docker.io/library/busybox:latest
|
template: templates/deployment.yaml
|
||||||
template: templates/gitea/deployment.yaml
|
set:
|
||||||
|
deployment.initContainers:
|
||||||
|
- name: foo
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "deployment.initContainers[0]: either `container` or `link` must be set"
|
||||||
|
|
||||||
|
- it: "Fail when an init container links to an unknown configuration"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initContainers:
|
||||||
|
- link: "initSomething"
|
||||||
|
asserts:
|
||||||
|
- failedTemplate:
|
||||||
|
errorMessage: "deployment.initContainers[0]: unknown link `initSomething`, expected one of: initAppIni, initConfigureGPG, initConfigureGitea, initDirectories"
|
||||||
+26
-23
@@ -1,24 +1,25 @@
|
|||||||
suite: deployment template (HA)
|
suite: Test deployment high availability
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: fails with multiple replicas and "GIT_GC_REPOS" enabled
|
- it: "Fail with multiple replicas and GIT_GC_REPOS enabled"
|
||||||
template: templates/gitea/secret_config.yaml
|
template: templates/secret_config.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
persistence:
|
persistence:
|
||||||
accessModes:
|
new:
|
||||||
- ReadWriteMany
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
gitea:
|
gitea:
|
||||||
config:
|
config:
|
||||||
cron:
|
cron:
|
||||||
@@ -27,22 +28,23 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- failedTemplate:
|
- failedTemplate:
|
||||||
errorMessage: "Invoking the garbage collector via CRON is not yet supported when running with multiple replicas. Please set 'gitea.config.cron.GIT_GC_REPOS.enabled = false'."
|
errorMessage: "Invoking the garbage collector via CRON is not yet supported when running with multiple replicas. Please set 'gitea.config.cron.GIT_GC_REPOS.enabled = false'."
|
||||||
- it: fails with multiple replicas and RWX file system not set
|
- it: "Fail with multiple replicas and no RWX file system"
|
||||||
template: templates/gitea/secret_config.yaml
|
template: templates/secret_config.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
asserts:
|
asserts:
|
||||||
- failedTemplate:
|
- failedTemplate:
|
||||||
errorMessage: "When using multiple replicas, a RWX file system is required and persistence.accessModes[0] must be set to ReadWriteMany."
|
errorMessage: "When using multiple replicas, a RWX file system is required and persistence.new.accessModes[0] must be set to ReadWriteMany."
|
||||||
- it: fails with multiple replicas and bleve issue indexer
|
- it: "Fail with multiple replicas and the bleve issue indexer"
|
||||||
template: templates/gitea/secret_config.yaml
|
template: templates/secret_config.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
persistence:
|
persistence:
|
||||||
accessModes:
|
new:
|
||||||
- ReadWriteMany
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
gitea:
|
gitea:
|
||||||
config:
|
config:
|
||||||
indexer:
|
indexer:
|
||||||
@@ -50,14 +52,15 @@ tests:
|
|||||||
asserts:
|
asserts:
|
||||||
- failedTemplate:
|
- failedTemplate:
|
||||||
errorMessage: "When using multiple replicas, the issue indexer (gitea.config.indexer.ISSUE_INDEXER_TYPE) must be set to a HA-ready provider such as 'meilisearch', 'elasticsearch' or 'db' (if the DB is HA-ready)."
|
errorMessage: "When using multiple replicas, the issue indexer (gitea.config.indexer.ISSUE_INDEXER_TYPE) must be set to a HA-ready provider such as 'meilisearch', 'elasticsearch' or 'db' (if the DB is HA-ready)."
|
||||||
- it: fails with multiple replicas and bleve repo indexer
|
- it: "Fail with multiple replicas and the bleve repo indexer"
|
||||||
template: templates/gitea/secret_config.yaml
|
template: templates/secret_config.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
persistence:
|
persistence:
|
||||||
accessModes:
|
new:
|
||||||
- ReadWriteMany
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
gitea:
|
gitea:
|
||||||
config:
|
config:
|
||||||
indexer:
|
indexer:
|
||||||
+48
-29
@@ -1,4 +1,4 @@
|
|||||||
suite: deployment template (image configuration)
|
suite: Test deployment image configuration
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
@@ -6,54 +6,54 @@ chart:
|
|||||||
# Override appVersion to be consistent with used digest :)
|
# Override appVersion to be consistent with used digest :)
|
||||||
appVersion: 1.19.3
|
appVersion: 1.19.3
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: default values
|
- it: "Render the default image reference"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
||||||
- it: tag override
|
- it: "Render a custom image tag"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.tag: "1.19.4"
|
deployment.gitea.image.tag: "1.19.4"
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.4-rootless"
|
value: "docker.gitea.com/gitea:1.19.4-rootless"
|
||||||
- it: root-based image
|
- it: "Render the root-based image variant"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.rootless: false
|
deployment.gitea.image.rootless: false
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.3"
|
value: "docker.gitea.com/gitea:1.19.3"
|
||||||
- it: scoped registry
|
- it: "Render a scoped image registry"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.registry: "example.com"
|
deployment.gitea.image.registry: "example.com"
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "example.com/gitea:1.19.3-rootless"
|
value: "example.com/gitea:1.19.3-rootless"
|
||||||
- it: global registry
|
- it: "Render the global image registry"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
global.imageRegistry: "global.example.com"
|
global.imageRegistry: "global.example.com"
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "global.example.com/gitea:1.19.3-rootless"
|
value: "global.example.com/gitea:1.19.3-rootless"
|
||||||
- it: digest for rootless image
|
- it: "Render a digest for the rootless image"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
gitea:
|
gitea:
|
||||||
@@ -64,8 +64,8 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
value: "docker.gitea.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
||||||
- it: image fullOverride (does not append rootless)
|
- it: "Render image.fullOverride without appending the rootless suffix"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
gitea:
|
gitea:
|
||||||
@@ -81,8 +81,8 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.3"
|
value: "docker.gitea.com/gitea:1.19.3"
|
||||||
- it: digest for root-based image
|
- it: "Render a digest for the root-based image"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment:
|
deployment:
|
||||||
gitea:
|
gitea:
|
||||||
@@ -93,8 +93,8 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.19.3@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
value: "docker.gitea.com/gitea:1.19.3@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
||||||
- it: digest and global registry
|
- it: "Render a digest together with the global image registry"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
global.imageRegistry: "global.example.com"
|
global.imageRegistry: "global.example.com"
|
||||||
deployment.gitea.image.digest: "sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
deployment.gitea.image.digest: "sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
||||||
@@ -102,10 +102,14 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "global.example.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
value: "global.example.com/gitea:1.19.3-rootless@sha256:b28e8f3089b52ebe6693295df142f8c12eff354e9a4a5bfbb5c10f296c3a537a"
|
||||||
- it: correctly renders floating tag references
|
- it: "Render unquoted floating tag references"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.tag: 1.21 # use non-quoted value on purpose. See: https://gitea.com/gitea/helm-gitea/issues/631
|
# use non-quoted values on purpose. See: https://gitea.com/gitea/helm-gitea/issues/631
|
||||||
|
deployment.gitea.image.tag: 1.21
|
||||||
|
deployment.initDirectories.image.tag: 1.21
|
||||||
|
deployment.initAppIni.image.tag: 1.21
|
||||||
|
deployment.initConfigureGitea.image.tag: 1.21
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[0].image
|
path: spec.template.spec.initContainers[0].image
|
||||||
@@ -119,3 +123,18 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: "docker.gitea.com/gitea:1.21-rootless"
|
value: "docker.gitea.com/gitea:1.21-rootless"
|
||||||
|
- it: "Render the own image configuration of the init containers"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initDirectories.image.registry: "init.example.com"
|
||||||
|
deployment.initDirectories.image.tag: "1.19.4"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].image
|
||||||
|
value: "init.example.com/gitea:1.19.4-rootless"
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].image
|
||||||
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].image
|
||||||
|
value: "docker.gitea.com/gitea:1.19.3-rootless"
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
suite: Test ingress tpl use
|
|
||||||
templates:
|
|
||||||
- templates/gitea/ingress.yaml
|
|
||||||
tests:
|
|
||||||
- it: Ingress Class using TPL
|
|
||||||
set:
|
|
||||||
global.ingress.className: "ingress-class"
|
|
||||||
ingress.className: "{{ .Values.global.ingress.className }}"
|
|
||||||
ingress.enabled: true
|
|
||||||
ingress.hosts[0].host: "some-host"
|
|
||||||
ingress.tls:
|
|
||||||
- secretName: gitea-tls
|
|
||||||
hosts:
|
|
||||||
- "some-host"
|
|
||||||
asserts:
|
|
||||||
- isKind:
|
|
||||||
of: Ingress
|
|
||||||
- equal:
|
|
||||||
path: spec.tls[0].hosts[0]
|
|
||||||
value: "some-host"
|
|
||||||
- equal:
|
|
||||||
path: spec.rules[0].host
|
|
||||||
value: "some-host"
|
|
||||||
- equal:
|
|
||||||
path: spec.ingressClassName
|
|
||||||
value: "ingress-class"
|
|
||||||
|
|
||||||
- it: hostname using TPL
|
|
||||||
set:
|
|
||||||
global.giteaHostName: "gitea.example.com"
|
|
||||||
ingress.enabled: true
|
|
||||||
ingress.hosts[0].host: "{{ .Values.global.giteaHostName }}"
|
|
||||||
ingress.tls:
|
|
||||||
- secretName: gitea-tls
|
|
||||||
hosts:
|
|
||||||
- "{{ .Values.global.giteaHostName }}"
|
|
||||||
asserts:
|
|
||||||
- isKind:
|
|
||||||
of: Ingress
|
|
||||||
- equal:
|
|
||||||
path: spec.tls[0].hosts[0]
|
|
||||||
value: "gitea.example.com"
|
|
||||||
- equal:
|
|
||||||
path: spec.rules[0].host
|
|
||||||
value: "gitea.example.com"
|
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
suite: Test deployment init container configuration
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/deployment.yaml
|
||||||
|
- templates/secret_admin.yaml
|
||||||
|
- templates/secret_config.yaml
|
||||||
|
- templates/secret_gpg.yaml
|
||||||
|
- templates/secret_init.yaml
|
||||||
|
- templates/secret_inlineConfig.yaml
|
||||||
|
- templates/secret_metrics.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Append the per-container env"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initDirectories.env:
|
||||||
|
- name: INIT_DIRECTORIES
|
||||||
|
value: "1"
|
||||||
|
deployment.gitea.env:
|
||||||
|
- name: SHARED
|
||||||
|
value: "1"
|
||||||
|
asserts:
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.initContainers[0].env
|
||||||
|
content:
|
||||||
|
name: INIT_DIRECTORIES
|
||||||
|
value: "1"
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.initContainers[0].env
|
||||||
|
content:
|
||||||
|
name: SHARED
|
||||||
|
value: "1"
|
||||||
|
- notContains:
|
||||||
|
path: spec.template.spec.initContainers[1].env
|
||||||
|
content:
|
||||||
|
name: INIT_DIRECTORIES
|
||||||
|
value: "1"
|
||||||
|
|
||||||
|
- it: "Render the per-container envFrom"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initAppIni.envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: special-secret
|
||||||
|
asserts:
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.initContainers[0].envFrom
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].envFrom
|
||||||
|
value:
|
||||||
|
- secretRef:
|
||||||
|
name: special-secret
|
||||||
|
|
||||||
|
- it: "Append the per-container volumeMounts"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initConfigureGitea.volumeMounts:
|
||||||
|
- name: my-configmap-volume
|
||||||
|
mountPath: /configmap
|
||||||
|
readOnly: true
|
||||||
|
asserts:
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.initContainers[2].volumeMounts
|
||||||
|
content:
|
||||||
|
name: my-configmap-volume
|
||||||
|
mountPath: /configmap
|
||||||
|
readOnly: true
|
||||||
|
- notContains:
|
||||||
|
path: spec.template.spec.initContainers[0].volumeMounts
|
||||||
|
content:
|
||||||
|
name: my-configmap-volume
|
||||||
|
mountPath: /configmap
|
||||||
|
readOnly: true
|
||||||
|
|
||||||
|
- it: "Override the resources of a single init container"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.initDirectories.resources:
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].resources
|
||||||
|
value:
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].resources
|
||||||
|
value:
|
||||||
|
limits: {}
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
|
||||||
|
- it: "Override the security context of a single init container"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.gitea.securityContext:
|
||||||
|
runAsUser: 1000
|
||||||
|
deployment.initDirectories.securityContext:
|
||||||
|
runAsUser: 2000
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[0].securityContext.runAsUser
|
||||||
|
value: 2000
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[1].securityContext.runAsUser
|
||||||
|
value: 1000
|
||||||
|
|
||||||
|
- it: "Render the envFrom of the gitea container"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
deployment.gitea.envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: special-config
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
value:
|
||||||
|
- configMapRef:
|
||||||
|
name: special-config
|
||||||
|
|
||||||
|
- it: "Omit the envFrom when it is unset"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
asserts:
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.containers[0].envFrom
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.initContainers[0].envFrom
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (openshift)
|
suite: Test deployment on OpenShift
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: renders openshift-compatible defaults for chart-managed containers
|
- it: "Render OpenShift compatible defaults for the chart-managed containers"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
openshift.enabled: true
|
openshift.enabled: true
|
||||||
asserts:
|
asserts:
|
||||||
@@ -61,8 +61,8 @@ tests:
|
|||||||
seccompProfile:
|
seccompProfile:
|
||||||
type: RuntimeDefault
|
type: RuntimeDefault
|
||||||
|
|
||||||
- it: does not force runAsUser 1000 for command init containers on OpenShift
|
- it: "Omit runAsUser 1000 for command init containers on OpenShift"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
openshift.enabled: true
|
openshift.enabled: true
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
@@ -74,13 +74,13 @@ tests:
|
|||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.initContainers[3].securityContext.runAsUser
|
path: spec.template.spec.initContainers[3].securityContext.runAsUser
|
||||||
|
|
||||||
- it: preserves explicit pod and container security context overrides on OpenShift
|
- it: "Preserve explicit pod and container security context overrides on OpenShift"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
openshift:
|
openshift:
|
||||||
enabled: true
|
enabled: true
|
||||||
hostUsers: true
|
|
||||||
deployment:
|
deployment:
|
||||||
|
hostUsers: true
|
||||||
securityContext:
|
securityContext:
|
||||||
fsGroup: 1000620000
|
fsGroup: 1000620000
|
||||||
gitea:
|
gitea:
|
||||||
@@ -102,11 +102,12 @@ tests:
|
|||||||
path: spec.template.spec.containers[0].securityContext.runAsGroup
|
path: spec.template.spec.containers[0].securityContext.runAsGroup
|
||||||
value: 1000620000
|
value: 1000620000
|
||||||
|
|
||||||
- it: renders an explicit hostUsers=false override on OpenShift
|
- it: "Render an explicit hostUsers=false override on OpenShift"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
openshift:
|
openshift:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
deployment:
|
||||||
hostUsers: false
|
hostUsers: false
|
||||||
asserts:
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (probes)
|
suite: Test deployment probes
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: renders default liveness probe
|
- it: "Render the default liveness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.containers[0].livenessProbe.enabled
|
path: spec.template.spec.containers[0].livenessProbe.enabled
|
||||||
@@ -26,8 +26,8 @@ tests:
|
|||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: http
|
port: http
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
- it: renders default readiness probe
|
- it: "Render the default readiness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.containers[0].readinessProbe.enabled
|
path: spec.template.spec.containers[0].readinessProbe.enabled
|
||||||
@@ -41,13 +41,13 @@ tests:
|
|||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: http
|
port: http
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
- it: does not render a default startup probe
|
- it: "Skip the startup probe by default"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.template.spec.containers[0].startupProbe
|
path: spec.template.spec.containers[0].startupProbe
|
||||||
- it: allows enabling a startup probe
|
- it: "Render the startup probe when it is enabled"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea.startupProbe.enabled: true
|
gitea.startupProbe.enabled: true
|
||||||
asserts:
|
asserts:
|
||||||
@@ -64,8 +64,8 @@ tests:
|
|||||||
port: http
|
port: http
|
||||||
timeoutSeconds: 1
|
timeoutSeconds: 1
|
||||||
|
|
||||||
- it: allows overwriting the default port of the liveness probe
|
- it: "Overwrite the default port of the liveness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
@@ -78,8 +78,8 @@ tests:
|
|||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: my-port
|
port: my-port
|
||||||
|
|
||||||
- it: allows overwriting the default port of the readiness probe
|
- it: "Overwrite the default port of the readiness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
@@ -92,8 +92,8 @@ tests:
|
|||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: my-port
|
port: my-port
|
||||||
|
|
||||||
- it: allows overwriting the default port of the startup probe
|
- it: "Overwrite the default port of the startup probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
startupProbe:
|
startupProbe:
|
||||||
@@ -107,8 +107,8 @@ tests:
|
|||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: my-port
|
port: my-port
|
||||||
|
|
||||||
- it: allows using a non-default method as liveness probe
|
- it: "Use a non-default method as liveness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
@@ -135,8 +135,8 @@ tests:
|
|||||||
port: http
|
port: http
|
||||||
timeoutSeconds: 13372
|
timeoutSeconds: 13372
|
||||||
|
|
||||||
- it: allows using a non-default method as readiness probe
|
- it: "Use a non-default method as readiness probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
@@ -163,8 +163,8 @@ tests:
|
|||||||
port: http
|
port: http
|
||||||
timeoutSeconds: 13372
|
timeoutSeconds: 13372
|
||||||
|
|
||||||
- it: allows using a non-default method as startup probe
|
- it: "Use a non-default method as startup probe"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
gitea:
|
gitea:
|
||||||
startupProbe:
|
startupProbe:
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
suite: sidecar container
|
|
||||||
release:
|
|
||||||
name: gitea-unittests
|
|
||||||
namespace: testing
|
|
||||||
templates:
|
|
||||||
- templates/gitea/deployment.yaml
|
|
||||||
- templates/gitea/secret_admin.yaml
|
|
||||||
- templates/gitea/secret_config.yaml
|
|
||||||
- templates/gitea/secret_gpg.yaml
|
|
||||||
- templates/gitea/secret_init.yaml
|
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
|
||||||
- templates/gitea/secret_metrics.yaml
|
|
||||||
tests:
|
|
||||||
- it: supports adding a sidecar container
|
|
||||||
template: templates/gitea/deployment.yaml
|
|
||||||
set:
|
|
||||||
extraContainers:
|
|
||||||
- name: sidecar-bob
|
|
||||||
image: busybox
|
|
||||||
asserts:
|
|
||||||
- equal:
|
|
||||||
path: spec.template.spec.containers[1].name
|
|
||||||
value: "sidecar-bob"
|
|
||||||
- equal:
|
|
||||||
path: spec.template.spec.containers[1].image
|
|
||||||
value: "busybox"
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
suite: Test deployment sidecar container
|
||||||
|
release:
|
||||||
|
name: gitea-unittests
|
||||||
|
namespace: testing
|
||||||
|
templates:
|
||||||
|
- templates/deployment.yaml
|
||||||
|
- templates/secret_admin.yaml
|
||||||
|
- templates/secret_config.yaml
|
||||||
|
- templates/secret_gpg.yaml
|
||||||
|
- templates/secret_init.yaml
|
||||||
|
- templates/secret_inlineConfig.yaml
|
||||||
|
- templates/secret_metrics.yaml
|
||||||
|
tests:
|
||||||
|
- it: "Render an additional sidecar container"
|
||||||
|
template: templates/deployment.yaml
|
||||||
|
set:
|
||||||
|
extraContainers:
|
||||||
|
- name: sidecar-bob
|
||||||
|
image: busybox
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[1].name
|
||||||
|
value: "sidecar-bob"
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[1].image
|
||||||
|
value: "busybox"
|
||||||
+16
-16
@@ -1,26 +1,26 @@
|
|||||||
suite: deployment template (signing disabled)
|
suite: Test deployment with signing disabled
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: skips gpg init container
|
- it: "Skip the gpg init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notContains:
|
- notContains:
|
||||||
path: spec.template.spec.initContainers
|
path: spec.template.spec.initContainers
|
||||||
any: true
|
any: true
|
||||||
content:
|
content:
|
||||||
name: configure-gpg
|
name: configure-gpg
|
||||||
- it: skips gpg env in `init-directories` init container
|
- it: "Skip the gpg env of the `init-directories` init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: false
|
secrets.gpg.enabled: false
|
||||||
asserts:
|
asserts:
|
||||||
@@ -28,15 +28,15 @@ tests:
|
|||||||
path: spec.template.spec.initContainers[0].env
|
path: spec.template.spec.initContainers[0].env
|
||||||
content:
|
content:
|
||||||
name: GNUPGHOME
|
name: GNUPGHOME
|
||||||
- it: skips gpg env in runtime container
|
- it: "Skip the gpg env of the runtime container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notContains:
|
- notContains:
|
||||||
path: spec.template.spec.containers[0].env
|
path: spec.template.spec.containers[0].env
|
||||||
content:
|
content:
|
||||||
name: GNUPGHOME
|
name: GNUPGHOME
|
||||||
- it: skips gpg volume spec
|
- it: "Skip the gpg volume spec"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
asserts:
|
asserts:
|
||||||
- notContains:
|
- notContains:
|
||||||
path: spec.template.spec.volumes
|
path: spec.template.spec.volumes
|
||||||
+20
-20
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (signing enabled)
|
suite: Test deployment with signing enabled
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: adds gpg init container
|
- it: "Add the gpg init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -48,8 +48,8 @@ tests:
|
|||||||
- name: gpg-private-key
|
- name: gpg-private-key
|
||||||
mountPath: /raw
|
mountPath: /raw
|
||||||
readOnly: true
|
readOnly: true
|
||||||
- it: adds gpg env in `init-directories` init container
|
- it: "Add the gpg env to the `init-directories` init container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -63,8 +63,8 @@ tests:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: custom-gpg-secret
|
name: custom-gpg-secret
|
||||||
key: gpgHome
|
key: gpgHome
|
||||||
- it: adds gpg env in runtime container
|
- it: "Add the gpg env to the runtime container"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -78,8 +78,8 @@ tests:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: custom-gpg-secret
|
name: custom-gpg-secret
|
||||||
key: gpgHome
|
key: gpgHome
|
||||||
- it: reads the gpg home from the configured key of an existing secret
|
- it: "Read the gpg home from the configured key of an existing Secret"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
@@ -94,8 +94,8 @@ tests:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: custom-gpg-secret
|
name: custom-gpg-secret
|
||||||
key: custom-gpg-home
|
key: custom-gpg-home
|
||||||
- it: adds gpg volume spec
|
- it: "Add the gpg volume spec"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.new.privateKey: "gpg-key-placeholder"
|
secrets.gpg.new.privateKey: "gpg-key-placeholder"
|
||||||
@@ -110,8 +110,8 @@ tests:
|
|||||||
- key: privateKey
|
- key: privateKey
|
||||||
path: private.asc
|
path: private.asc
|
||||||
defaultMode: 0100
|
defaultMode: 0100
|
||||||
- it: supports gpg volume spec with external reference
|
- it: "Render the gpg volume spec with an external reference"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
secrets.gpg.enabled: true
|
secrets.gpg.enabled: true
|
||||||
secrets.gpg.existingSecret.enabled: true
|
secrets.gpg.existingSecret.enabled: true
|
||||||
+18
-18
@@ -1,18 +1,18 @@
|
|||||||
suite: deployment template (SSH configuration)
|
suite: Test deployment SSH configuration
|
||||||
release:
|
release:
|
||||||
name: gitea-unittests
|
name: gitea-unittests
|
||||||
namespace: testing
|
namespace: testing
|
||||||
templates:
|
templates:
|
||||||
- templates/gitea/deployment.yaml
|
- templates/deployment.yaml
|
||||||
- templates/gitea/secret_admin.yaml
|
- templates/secret_admin.yaml
|
||||||
- templates/gitea/secret_config.yaml
|
- templates/secret_config.yaml
|
||||||
- templates/gitea/secret_gpg.yaml
|
- templates/secret_gpg.yaml
|
||||||
- templates/gitea/secret_init.yaml
|
- templates/secret_init.yaml
|
||||||
- templates/gitea/secret_inlineConfig.yaml
|
- templates/secret_inlineConfig.yaml
|
||||||
- templates/gitea/secret_metrics.yaml
|
- templates/secret_metrics.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: supports defining SSH log level for root based image
|
- it: "Define the SSH log level for the root based image"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.rootless: false
|
deployment.gitea.image.rootless: false
|
||||||
asserts:
|
asserts:
|
||||||
@@ -21,8 +21,8 @@ tests:
|
|||||||
content:
|
content:
|
||||||
name: SSH_LOG_LEVEL
|
name: SSH_LOG_LEVEL
|
||||||
value: "INFO"
|
value: "INFO"
|
||||||
- it: supports overriding SSH log level
|
- it: "Override the SSH log level"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.rootless: false
|
deployment.gitea.image.rootless: false
|
||||||
gitea.ssh.logLevel: "DEBUG"
|
gitea.ssh.logLevel: "DEBUG"
|
||||||
@@ -32,8 +32,8 @@ tests:
|
|||||||
content:
|
content:
|
||||||
name: SSH_LOG_LEVEL
|
name: SSH_LOG_LEVEL
|
||||||
value: "DEBUG"
|
value: "DEBUG"
|
||||||
- it: supports overriding SSH log level (even when image.fullOverride set)
|
- it: "Override the SSH log level when image.fullOverride is set"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.fullOverride: docker.gitea.com/gitea:1.19.3
|
deployment.gitea.image.fullOverride: docker.gitea.com/gitea:1.19.3
|
||||||
deployment.gitea.image.rootless: false
|
deployment.gitea.image.rootless: false
|
||||||
@@ -44,8 +44,8 @@ tests:
|
|||||||
content:
|
content:
|
||||||
name: SSH_LOG_LEVEL
|
name: SSH_LOG_LEVEL
|
||||||
value: "DEBUG"
|
value: "DEBUG"
|
||||||
- it: skips SSH_LOG_LEVEL for rootless image
|
- it: "Skip SSH_LOG_LEVEL for the rootless image"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.rootless: true
|
deployment.gitea.image.rootless: true
|
||||||
gitea.ssh.logLevel: "DEBUG" # explicitly defining a non-standard level here
|
gitea.ssh.logLevel: "DEBUG" # explicitly defining a non-standard level here
|
||||||
@@ -55,8 +55,8 @@ tests:
|
|||||||
any: true
|
any: true
|
||||||
content:
|
content:
|
||||||
name: SSH_LOG_LEVEL
|
name: SSH_LOG_LEVEL
|
||||||
- it: skips SSH_LOG_LEVEL for rootless image (even when image.fullOverride set)
|
- it: "Skip SSH_LOG_LEVEL for the rootless image when image.fullOverride is set"
|
||||||
template: templates/gitea/deployment.yaml
|
template: templates/deployment.yaml
|
||||||
set:
|
set:
|
||||||
deployment.gitea.image.fullOverride: docker.gitea.com/gitea:1.19.3
|
deployment.gitea.image.fullOverride: docker.gitea.com/gitea:1.19.3
|
||||||
deployment.gitea.image.rootless: true
|
deployment.gitea.image.rootless: true
|
||||||
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user