From 893dae7e14e4b97b879673497672497e9bdd1558 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Sun, 2 Feb 2025 20:50:00 +0100 Subject: [PATCH 01/63] ci: add helper for running spell checks --- Justfile | 7 +++++++ configs/typos.toml | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Justfile create mode 100644 configs/typos.toml diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..131d014 --- /dev/null +++ b/Justfile @@ -0,0 +1,7 @@ +config_dir := "./configs" + +### HELPERS ################################################################### + +# Run spell checker +spellcheck: + typos --config "{{ config_dir }}/typos.toml" diff --git a/configs/typos.toml b/configs/typos.toml new file mode 100644 index 0000000..8d38a84 --- /dev/null +++ b/configs/typos.toml @@ -0,0 +1,12 @@ +# typos configuration (https://github.com/crate-ci/typos) + +[default] +extend-ignore-re = [ + # ignore lines with trailing "spellchecker:disable-line" + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", + # ignore blocks with "spellchecker:" + "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", +] + +[default.extend-words] +eaasi = "eaasi" From 8055c06c020d5ce1e3a9ba2c213f2a34a6f14cf4 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:03:07 +0100 Subject: [PATCH 02/63] chore: add initial `.gitignore` --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03bd412 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.env From d68d01acdfd60b48f0c73e8b4c394c9733b1f286 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:05:04 +0100 Subject: [PATCH 03/63] ci: add helper for generating changelogs --- Justfile | 11 +++++++++++ cliff.toml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 cliff.toml diff --git a/Justfile b/Justfile index 131d014..bcfcee8 100644 --- a/Justfile +++ b/Justfile @@ -1,3 +1,4 @@ +chart_dir := "./charts" config_dir := "./configs" ### HELPERS ################################################################### @@ -5,3 +6,13 @@ config_dir := "./configs" # Run spell checker spellcheck: typos --config "{{ config_dir }}/typos.toml" + +# Update chart's changelog +update-changelog chart version="" dir=(chart_dir / chart): + #!/usr/bin/env -S sh -eu -o allexport + test -f cliff.env && . ./cliff.env + export cliff_commit_scope="{{ chart }}" + git cliff --unreleased \ + {{ if version == "" { "--bump" } else { "--tag " + chart + "-" + version } }} \ + --tag-pattern "{{ chart }}-.+" \ + --prepend "{{ dir }}/CHANGELOG.md" diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..67a6c39 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,55 @@ +# git-cliff configuration (https://github.com/orhun/git-cliff) + +[changelog] +trim = false + +header = """ +# Changelog +""" + +body = """ +## {{ version }} - *{{ timestamp | date(format="%Y-%m-%d") }}* +{% set scope = get_env(name="cliff_commit_scope") -%} +{% set commits = commits | filter(attribute="scope", value=scope) -%} +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | split(pat=":") | last | trim }} + +{% for commit in commits -%} +{% set message = commit.message | upper_first -%} +{% if commit.breaking -%} +{% set message = "(**!**) " ~ message -%} +{% endif -%} +{% set short_sha = commit.id | truncate(length=7, end="") -%} +{% set commit_url = "/commit/" ~ commit.id -%} +{% set ref = "[`" ~ short_sha ~ "`](" ~ commit_url ~ ")" -%} +- {{ message }} - ({{ ref }}) +{% endfor -%} +{% endfor -%} +""" + +postprocessors = [ + # Replace repository placeholder with the real URL + { pattern = "", replace = "https://github.com/eaasi/helm-charts" }, +] + +[git] +conventional_commits = true +filter_unconventional = true +filter_commits = false +split_commits = false +sort_commits = "oldest" +topo_order = false + +commit_parsers = [ + { message = "^feat", group = "1: Features" }, + { message = "^fix", group = "2: Bug Fixes" }, + { message = "^refactor", group = "3: Refactoring" }, + { message = "^test", group = "4: Testing" }, + { message = "^ci", group = "5: Continuous Integration" }, + { message = "^docs", group = "6: Documentation" }, + { message = ".*", group = "7: Miscellaneous" }, +] + +[remote.github] +owner = "eaasi" +repo = "helm-charts" From 39cb9cec9d3e80203cfa594894e47bd0a5450dd4 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:09:51 +0100 Subject: [PATCH 04/63] ci: include commit authors in changelogs --- cliff.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cliff.toml b/cliff.toml index 67a6c39..acd1d10 100644 --- a/cliff.toml +++ b/cliff.toml @@ -22,6 +22,9 @@ body = """ {% set short_sha = commit.id | truncate(length=7, end="") -%} {% set commit_url = "/commit/" ~ commit.id -%} {% set ref = "[`" ~ short_sha ~ "`](" ~ commit_url ~ ")" -%} +{% if commit.remote.username -%} +{% set ref = ref ~ " by @" ~ commit.remote.username -%} +{% endif -%} - {{ message }} - ({{ ref }}) {% endfor -%} {% endfor -%} From 8809b148ab0da4733c5c22b4d216a74bb9a6ec91 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:15:02 +0100 Subject: [PATCH 05/63] ci: include commit PRs in changelogs --- cliff.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cliff.toml b/cliff.toml index acd1d10..310d0c7 100644 --- a/cliff.toml +++ b/cliff.toml @@ -25,6 +25,11 @@ body = """ {% if commit.remote.username -%} {% set ref = ref ~ " by @" ~ commit.remote.username -%} {% endif -%} +{% if commit.remote.pr_number -%} +{% set pr_num = commit.remote.pr_number -%} +{% set pr_url = "/pull/" ~ pr_num -%} +{% set ref = ref ~ " in [#" ~ pr_num ~ "](" ~ pr_url ~ ")" -%} +{% endif -%} - {{ message }} - ({{ ref }}) {% endfor -%} {% endfor -%} From edec701f01a6b72466aa18edd1547cb8473b5e03 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:24:20 +0100 Subject: [PATCH 06/63] ci: include commit bodies in changelogs --- cliff.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cliff.toml b/cliff.toml index 310d0c7..1c3ece1 100644 --- a/cliff.toml +++ b/cliff.toml @@ -31,6 +31,12 @@ body = """ {% set ref = ref ~ " in [#" ~ pr_num ~ "](" ~ pr_url ~ ")" -%} {% endif -%} - {{ message }} - ({{ ref }}) +{% set include_commit_body = get_env(name="cliff_include_commit_body", default="false") -%} +{% set include_commit_body = include_commit_body == "true" -%} +{% if include_commit_body and commit.body %} + {{ commit.body | indent(prefix=" ") }} + +{% endif -%} {% endfor -%} {% endfor -%} """ From cf1f38dd80ae16c4b4f0f4ffbc8dcd8444896f03 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:34:53 +0100 Subject: [PATCH 07/63] ci: add links to more detailed changelogs --- cliff.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cliff.toml b/cliff.toml index 1c3ece1..0ce24f2 100644 --- a/cliff.toml +++ b/cliff.toml @@ -39,6 +39,10 @@ body = """ {% endif -%} {% endfor -%} {% endfor -%} +{% if previous.version -%} +{% set diff_url = "/compare/" ~ previous.version ~ ".." ~ version %} +The more detailed changelog for `{{ version }}` can be found [here]({{ diff_url }}). +{% endif -%} """ postprocessors = [ From a3b76abd0507dd2304a151a245b4ebce94dcd496 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 14:52:02 +0100 Subject: [PATCH 08/63] ci: enhance issue references in changelogs --- cliff.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cliff.toml b/cliff.toml index 0ce24f2..d6579b8 100644 --- a/cliff.toml +++ b/cliff.toml @@ -58,6 +58,11 @@ split_commits = false sort_commits = "oldest" topo_order = false +commit_preprocessors = [ + # Replace issue references with their remote link template + { pattern = '([\(\s]+)#([0-9]+)', replace = "${1}[#${2}](/issues/${2})"}, +] + commit_parsers = [ { message = "^feat", group = "1: Features" }, { message = "^fix", group = "2: Bug Fixes" }, From f4efad986b48539baa4eb2fdba43b3e510c4e74e Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 15:02:12 +0100 Subject: [PATCH 09/63] ci: add helper for running chart linter --- Justfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Justfile b/Justfile index bcfcee8..580892b 100644 --- a/Justfile +++ b/Justfile @@ -7,6 +7,10 @@ config_dir := "./configs" spellcheck: typos --config "{{ config_dir }}/typos.toml" +# Run chart linter +lint chart="*": + helm lint "{{ chart_dir / chart }}" + # Update chart's changelog update-changelog chart version="" dir=(chart_dir / chart): #!/usr/bin/env -S sh -eu -o allexport From 2cd03ced66aa4d9975751ce4db35f0278366885d Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 15:17:55 +0100 Subject: [PATCH 10/63] ci: add helper for running chart validator --- Justfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Justfile b/Justfile index 580892b..29d4d85 100644 --- a/Justfile +++ b/Justfile @@ -11,6 +11,18 @@ spellcheck: lint chart="*": helm lint "{{ chart_dir / chart }}" +# Run chart validator +validate chart="*": + docker run -t --rm --network="host" \ + --workdir="/data" \ + --volume="$PWD:/data" \ + --volume="$(helm env HELM_CACHE_HOME):/root/.cache/helm:ro" \ + --volume="$(helm env HELM_CONFIG_HOME):/root/.config/helm:ro" \ + "quay.io/helmpack/chart-testing:v3.7.1" \ + ct lint --config "{{ config_dir }}/chart-testing.yaml" \ + --helm-dependency-extra-args "--skip-refresh" \ + {{ if chart == "*" { "--all" } else { '--charts "' + (chart_dir / chart) + '"' } }} + # Update chart's changelog update-changelog chart version="" dir=(chart_dir / chart): #!/usr/bin/env -S sh -eu -o allexport From 64a87d74e51b9b45bc485b55cd8751d053152659 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 15:33:03 +0100 Subject: [PATCH 11/63] ci: add job for running spell checks --- .github/workflows/checks.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/checks.yaml diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml new file mode 100644 index 0000000..37817b1 --- /dev/null +++ b/.github/workflows/checks.yaml @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Reusable workflow for running various checks on Helm charts + +name: checks +on: + workflow_call: + +permissions: + contents: read + +env: + CLICOLOR: 1 + +jobs: + spell-checker: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run spell checker + uses: crate-ci/typos@v1.29.7 + with: + config: ./configs/typos.toml From deef1d27489c54513825bf55daa353ece3849e34 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 16:31:06 +0100 Subject: [PATCH 12/63] ci: add job for running chart linters --- .github/workflows/checks.yaml | 30 ++++++++++++++++++++++++++++++ configs/chart-testing.yaml | 7 +++++++ 2 files changed, 37 insertions(+) create mode 100644 configs/chart-testing.yaml diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 37817b1..c065427 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -6,6 +6,11 @@ name: checks on: workflow_call: + inputs: + enable-change-detection: + description: Enable change detection + default: false + type: boolean permissions: contents: read @@ -14,6 +19,31 @@ env: CLICOLOR: 1 jobs: + helm-linter: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Fetch whole history required for change detection (if enabled) + fetch-depth: ${{ (inputs.enable-change-detection) && '0' || '1' }} + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + check-latest: true + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.17.0 + - name: Install chart-testing + uses: helm/chart-testing-action@v2.7.0 + - name: Run chart linters and validators + env: + # Enable change detection if explicitly requested, else check all charts + CHART_TESTING_ARGS: ${{ (inputs.enable-change-detection) && '--target-branch main' || '--all' }} + run: ct lint --config ./configs/chart-testing.yaml ${{ env.CHART_TESTING_ARGS }} + spell-checker: runs-on: ubuntu-latest steps: diff --git a/configs/chart-testing.yaml b/configs/chart-testing.yaml new file mode 100644 index 0000000..d3f98d0 --- /dev/null +++ b/configs/chart-testing.yaml @@ -0,0 +1,7 @@ +# chart-testing configuration (https://github.com/helm/chart-testing) + +check-version-increment: false +validate-maintainers: false +remote: origin +chart-dirs: + - charts From 1c278ce5d6299f9c004f1141b9a778d142f7ba57 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 4 Feb 2025 17:07:01 +0100 Subject: [PATCH 13/63] ci: add job for running chart tests --- .github/workflows/checks.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index c065427..b8db83b 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -44,6 +44,24 @@ jobs: CHART_TESTING_ARGS: ${{ (inputs.enable-change-detection) && '--target-branch main' || '--all' }} run: ct lint --config ./configs/chart-testing.yaml ${{ env.CHART_TESTING_ARGS }} + helm-tester: + runs-on: ubuntu-latest + needs: + - helm-linter + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Start Minikube cluster + uses: medyagh/setup-minikube@v0.0.20 + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.17.0 + - name: Install chart-testing + uses: helm/chart-testing-action@v2.7.0 + - name: Install and test charts + run: ct install --config ./configs/chart-testing.yaml --all + spell-checker: runs-on: ubuntu-latest steps: From fb8ce642601b0a3484f874e3322d49e785be84b9 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 14:51:04 +0100 Subject: [PATCH 14/63] ci: add reusable action for installing `committed` --- .github/actions/setup-committed/action.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/actions/setup-committed/action.yaml diff --git a/.github/actions/setup-committed/action.yaml b/.github/actions/setup-committed/action.yaml new file mode 100644 index 0000000..ecae960 --- /dev/null +++ b/.github/actions/setup-committed/action.yaml @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +name: setup-committed +description: Helper for installing Committed +runs: + using: composite + steps: + - name: Install Committed + uses: jaxxstorm/action-install-gh-release@v2.1.0 + with: + repo: crate-ci/committed + tag: v1.1.7 From 62724fdaf2413e21d00cc0cb0522651c26be16ce Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 15:11:04 +0100 Subject: [PATCH 15/63] ci: add workflow for enforcing commit style --- .github/workflows/commit-style.yaml | 44 +++++++++++++++++++++++++++++ configs/committed.toml | 26 +++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/commit-style.yaml create mode 100644 configs/committed.toml diff --git a/.github/workflows/commit-style.yaml b/.github/workflows/commit-style.yaml new file mode 100644 index 0000000..4b19e96 --- /dev/null +++ b/.github/workflows/commit-style.yaml @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Workflow for enforcing commit style conventions + +name: commit-style +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +permissions: + contents: read + +env: + CLICOLOR: 1 + +jobs: + commit-linter: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Fetch full history for merge-base detection! + fetch-depth: 0 + - id: commit-range + name: Determine commit range + uses: eaasi/commit-range-action@v0.5 + - name: Install commit style linter + uses: ./.github/actions/setup-committed + - name: Run commit style linter + run: | + range="${{ steps.commit-range.outputs.commit-range }}" + echo "Linting commits:" + git log --color=always --graph --oneline "${range:?}" || true + echo "" + committed -vv --color=always \ + --config ./configs/committed.toml \ + "${range}" + echo "DONE: Commits follow the required style conventions." diff --git a/configs/committed.toml b/configs/committed.toml new file mode 100644 index 0000000..39dcc37 --- /dev/null +++ b/configs/committed.toml @@ -0,0 +1,26 @@ +# committed configuration (https://github.com/crate-ci/committed) + +line_length = 0 +subject_length = 0 +subject_capitalized = false +subject_not_punctuated = true +imperative_subject = true +merge_commit = true +no_fixup = true +no_wip = true + +style = "conventional" + +# allowed commit types +allowed_types = [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "refactor", + "revert", + "style", + "test", +] From 042d57b9b772874e5935d944d5ca9a6e9cb3f685 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 15:45:05 +0100 Subject: [PATCH 16/63] ci: add helpers for controlling Minikube clusters --- Justfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Justfile b/Justfile index 29d4d85..d4b2a63 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,12 @@ chart_dir := "./charts" config_dir := "./configs" +# Name of the Minikube cluster +cluster := "eaasi" + +# Name of the cluster namespace +namespace := "eaasi" + ### HELPERS ################################################################### # Run spell checker @@ -32,3 +38,30 @@ update-changelog chart version="" dir=(chart_dir / chart): {{ if version == "" { "--bump" } else { "--tag " + chart + "-" + version } }} \ --tag-pattern "{{ chart }}-.+" \ --prepend "{{ dir }}/CHANGELOG.md" + +### MINIKUBE ################################################################## + +# Start a Minikube cluster +cluster-start name=cluster ns=namespace *args: + minikube start --profile "{{ name }}" \ + --namespace "{{ ns }}" \ + --cpus "no-limit" \ + --memory "no-limit" \ + --force-systemd=true \ + {{ args }} + +# Stop a Minikube cluster +cluster-stop name=cluster: + minikube stop --profile "{{ name }}" + +# Pause a Minikube cluster +cluster-pause name=cluster: + minikube pause --profile "{{ name }}" --all-namespaces + +# Unpause a Minikube cluster +cluster-unpause name=cluster: + minikube unpause --profile "{{ name }}" --all-namespaces + +# Delete a Minikube cluster +cluster-delete name=cluster: + minikube delete --profile "{{ name }}" From 3d6e281d77b2ed1631db0e68a590209feab3158a Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 16:06:24 +0100 Subject: [PATCH 17/63] ci: add helpers for running common Helm operations --- Justfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Justfile b/Justfile index d4b2a63..be59d63 100644 --- a/Justfile +++ b/Justfile @@ -39,6 +39,47 @@ update-changelog chart version="" dir=(chart_dir / chart): --tag-pattern "{{ chart }}-.+" \ --prepend "{{ dir }}/CHANGELOG.md" +### HELM ###################################################################### + +# Add external chart repositories +add-chart-repos: + # TODO: add repos! + +# Build dependencies for all charts +build-chart-deps: + #!/usr/bin/env -S sh -eu + charts=$(ls "{{ chart_dir }}/") + for chart in $charts; do + just dep-build "$chart" + done + +# Build Helm chart's dependencies from its lock file +dep-build chart *args="--skip-refresh": + helm dependency build "{{ chart_dir / chart }}" {{ args }} + +# Update Helm chart's on-disk dependencies +dep-update chart *args="--skip-refresh": + helm dependency update "{{ chart_dir / chart }}" {{ args }} + +# Install a Helm chart +install chart name=chart ns=namespace *args: + helm install "{{ name }}" "{{ chart_dir / chart }}" \ + --namespace "{{ ns }}" --create-namespace {{ args }} + +# Uninstall a Helm chart release +uninstall release ns=namespace *args: + helm uninstall "{{ release }}" --namespace "{{ ns }}" {{ args }} + +# Upgrade a Helm chart release +upgrade chart release=chart ns=namespace *args: + helm upgrade "{{ release }}" "{{ chart_dir / chart }}" \ + --namespace "{{ ns }}" --create-namespace --install {{ args }} + +# Render a Helm chart +render chart name=chart ns=namespace *args: + helm template "{{ name }}" "{{ chart_dir / chart }}" \ + --namespace "{{ ns }}" {{ args }} | less + ### MINIKUBE ################################################################## # Start a Minikube cluster From 6645e6238f439c29865ab0ee7a4ad2c265d0b652 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 16:40:02 +0100 Subject: [PATCH 18/63] docs: describe how chart helpers can be used for development --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index b248514..9399cca 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,14 @@ using the [Helm](https://helm.sh) package manager. ## Helm Repository Add this Helm repository using: + ```console $ helm repo add eaasi https://eaasi.github.io/helm-charts $ helm repo update ``` List the available charts by running: + ```console $ helm search repo eaasi ``` @@ -20,6 +22,61 @@ $ helm search repo eaasi For more details, see the documentation for each chart: +## Development + +Multiple [Just](https://github.com/casey/just) recipes are provided in order to simplify local chart development. +For an overview of all available recipes and their parameters, take a look at the provided [Justfile](./Justfile) or simply run: + +```console +$ just --list +``` + +### Chart Helpers + +All source files can be checked for typos with: + +```console +$ just spellcheck +``` + +A chart linter can be run against a specific chart or all charts with: + +```console +$ just lint # omit name to lint all charts! +``` + +An extended validation can be performed on a specific chart or all charts with: + +```console +$ just validate # omit name to validate all charts! +``` + +All chart's templates can be rendered (without installing) with: + +```console +$ just render # +``` + +A specific chart can be installed or upgraded with: + +```console +$ just install # +$ just upgrade # +``` + +A previously installed release can be removed with: + +```console +$ just uninstall # +``` + +The dependencies of a chart can be managed with: + +```console +$ just dep-build # rebuild deps from Chart.lock file +$ just dep-update # update deps to mirror Chart.yaml +``` + ## License Helm charts for EAASI are distributed under the [Apache-2.0](./LICENSE) license. From f2585e985c6e00abc23439e3886f82c1e12e3344 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 16:56:04 +0100 Subject: [PATCH 19/63] docs: describe how Minikube helpers can be used for development --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 9399cca..ffa8bc4 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,28 @@ $ just dep-build # rebuild deps from Chart.lock file $ just dep-update # update deps to mirror Chart.yaml ``` +### Minikube Management + +A local [Minikube](https://minikube.sigs.k8s.io) cluster can be created with: + +```console +$ just cluster-start +``` + +A running Minikube cluster can be paused and resumed later with: + +```console +$ just cluster-pause +$ just cluster-unpause +``` + +When a local Minikube cluster is not needed anymore, it can be stopped or deleted with: + +```console +$ just cluster-stop +$ just cluster-delete +``` + ## License Helm charts for EAASI are distributed under the [Apache-2.0](./LICENSE) license. From 77c7b3ecd69ea4eabea59bf904c80a6e7f4dd821 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 16:58:57 +0100 Subject: [PATCH 20/63] docs: describe how to use helpers for adding chart repositories --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index ffa8bc4..776ec01 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,20 @@ $ just cluster-stop $ just cluster-delete ``` +### Deployment + +Before deploying anything, the chart repositories for all dependencies must be added with: + +```console +$ just add-chart-repos +``` + +Next, rebuild all required chart dependencies with: + +```console +$ just build-chart-deps +``` + ## License Helm charts for EAASI are distributed under the [Apache-2.0](./LICENSE) license. From 11829dd031b56e1f4ef104e5fb1f414e0924b8b5 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 19:11:09 +0100 Subject: [PATCH 21/63] ci: add reusable action for installing `helm` --- .github/actions/setup-helm/action.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/actions/setup-helm/action.yaml diff --git a/.github/actions/setup-helm/action.yaml b/.github/actions/setup-helm/action.yaml new file mode 100644 index 0000000..d959686 --- /dev/null +++ b/.github/actions/setup-helm/action.yaml @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +name: setup-helm +description: Helper for installing Helm +runs: + using: composite + steps: + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.17.0 From 061053006cd634500e11c28700575cfa682878ef Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 19:20:48 +0100 Subject: [PATCH 22/63] refactor: reuse step for installing `helm` in multiple jobs --- .github/workflows/checks.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index b8db83b..21049a5 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -32,10 +32,9 @@ jobs: with: python-version: '3.x' check-latest: true - - name: Install Helm - uses: azure/setup-helm@v4 - with: - version: v3.17.0 + - &install-helm-step + name: Install Helm + uses: ./.github/actions/setup-helm - name: Install chart-testing uses: helm/chart-testing-action@v2.7.0 - name: Run chart linters and validators @@ -53,10 +52,7 @@ jobs: uses: actions/checkout@v4 - name: Start Minikube cluster uses: medyagh/setup-minikube@v0.0.20 - - name: Install Helm - uses: azure/setup-helm@v4 - with: - version: v3.17.0 + - *install-helm-step - name: Install chart-testing uses: helm/chart-testing-action@v2.7.0 - name: Install and test charts From 42772134f541eb7953123a41b4d9e33666f33df0 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Mon, 24 Feb 2025 19:26:56 +0100 Subject: [PATCH 23/63] refactor: reuse step for installing `ct` in multiple jobs --- .github/workflows/checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 21049a5..234a338 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -35,7 +35,8 @@ jobs: - &install-helm-step name: Install Helm uses: ./.github/actions/setup-helm - - name: Install chart-testing + - &install-ct-step + name: Install chart-testing uses: helm/chart-testing-action@v2.7.0 - name: Run chart linters and validators env: @@ -53,8 +54,7 @@ jobs: - name: Start Minikube cluster uses: medyagh/setup-minikube@v0.0.20 - *install-helm-step - - name: Install chart-testing - uses: helm/chart-testing-action@v2.7.0 + - *install-ct-step - name: Install and test charts run: ct install --config ./configs/chart-testing.yaml --all From a607511a444e82b44c09f4763c71541f25bc3715 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 13:43:07 +0100 Subject: [PATCH 24/63] ci: add reusable action for installing `just` --- .github/actions/setup-just/action.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/actions/setup-just/action.yaml diff --git a/.github/actions/setup-just/action.yaml b/.github/actions/setup-just/action.yaml new file mode 100644 index 0000000..b185b5e --- /dev/null +++ b/.github/actions/setup-just/action.yaml @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +name: setup-just +description: Helper for installing Just +runs: + using: composite + steps: + - name: Install Just + uses: taiki-e/install-action@v2 + with: + tool: just@1.40.0 From 5c7e7830bcedb1a2f2e23891b052a5d0ca7a0a60 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 14:04:01 +0100 Subject: [PATCH 25/63] ci: register external chart repositories required for validation --- .github/workflows/checks.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 234a338..0aca6f4 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -32,12 +32,16 @@ jobs: with: python-version: '3.x' check-latest: true + - name: Install Just + uses: ./.github/actions/setup-just - &install-helm-step name: Install Helm uses: ./.github/actions/setup-helm - &install-ct-step name: Install chart-testing uses: helm/chart-testing-action@v2.7.0 + - name: Add external chart repositories + run: just add-chart-repos - name: Run chart linters and validators env: # Enable change detection if explicitly requested, else check all charts From fa058dbead72b5d7edfa1f5d17f31fdf03bf2667 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 14:06:04 +0100 Subject: [PATCH 26/63] ci: register external chart repositories required for testing --- .github/workflows/checks.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 0aca6f4..3cd223f 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -32,7 +32,8 @@ jobs: with: python-version: '3.x' check-latest: true - - name: Install Just + - &install-just-step + name: Install Just uses: ./.github/actions/setup-just - &install-helm-step name: Install Helm @@ -40,7 +41,8 @@ jobs: - &install-ct-step name: Install chart-testing uses: helm/chart-testing-action@v2.7.0 - - name: Add external chart repositories + - &add-chart-repos-step + name: Add external chart repositories run: just add-chart-repos - name: Run chart linters and validators env: @@ -55,10 +57,12 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - *install-just-step - name: Start Minikube cluster uses: medyagh/setup-minikube@v0.0.20 - *install-helm-step - *install-ct-step + - *add-chart-repos-step - name: Install and test charts run: ct install --config ./configs/chart-testing.yaml --all From 93ab4a4304794d9b91748ec126c8ca130599d3ac Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 14:08:12 +0100 Subject: [PATCH 27/63] ci: reuse helper for starting Minikube test clusters --- .github/workflows/checks.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 3cd223f..bcd81ea 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -58,8 +58,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - *install-just-step - - name: Start Minikube cluster + - name: Install Minikube uses: medyagh/setup-minikube@v0.0.20 + with: + start: false + - name: Start Minikube cluster + run: just cluster-start - *install-helm-step - *install-ct-step - *add-chart-repos-step From 6496cca7d2500bcc83dee80ff36891cc1a57cf4e Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 14:18:02 +0100 Subject: [PATCH 28/63] ci: add workflow for running various CI checks --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++++ charts/.gitkeep | 0 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 charts/.gitkeep diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..5eb189c --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Workflow for running various CI checks + +name: continuous-integration +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: read + +jobs: + checks: + uses: ./.github/workflows/checks.yaml + with: + enable-change-detection: ${{ github.ref != 'refs/heads/main' }} diff --git a/charts/.gitkeep b/charts/.gitkeep new file mode 100644 index 0000000..e69de29 From 92423319275ed00ade650f0230b7d7cbad2f39a7 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 15:05:45 +0100 Subject: [PATCH 29/63] ci: add step for extracting a list of validated charts --- .github/workflows/checks.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index bcd81ea..dbc0af2 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -21,6 +21,8 @@ env: jobs: helm-linter: runs-on: ubuntu-latest + env: + CHART_TESTING_LOG: chart-testing.log steps: - name: Checkout repository uses: actions/checkout@v4 @@ -48,7 +50,15 @@ jobs: env: # Enable change detection if explicitly requested, else check all charts CHART_TESTING_ARGS: ${{ (inputs.enable-change-detection) && '--target-branch main' || '--all' }} - run: ct lint --config ./configs/chart-testing.yaml ${{ env.CHART_TESTING_ARGS }} + run: | + set -o pipefail + ct lint --config ./configs/chart-testing.yaml ${{ env.CHART_TESTING_ARGS }} \ + | tee "${{ env.CHART_TESTING_LOG }}" + - id: ct-log-parser + name: Parse chart-testing logs + uses: eaasi/chart-list-action@v0.3 + with: + ct-log-file: ${{ env.CHART_TESTING_LOG }} helm-tester: runs-on: ubuntu-latest From 334ff05a6392f8bb12af16c03a63cb852369c212 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 15:09:31 +0100 Subject: [PATCH 30/63] ci: export validated chart list from reusable workflow --- .github/workflows/checks.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index dbc0af2..a9ddf85 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -11,6 +11,10 @@ on: description: Enable change detection default: false type: boolean + outputs: + charts: + description: List of validated charts + value: ${{ jobs.helm-linter.outputs.charts }} permissions: contents: read @@ -21,6 +25,8 @@ env: jobs: helm-linter: runs-on: ubuntu-latest + outputs: + charts: ${{ steps.ct-log-parser.outputs.charts }} env: CHART_TESTING_LOG: chart-testing.log steps: From 6a4d93551e1ea0fada88cd967a1dec00da0a7b78 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 15:28:42 +0100 Subject: [PATCH 31/63] ci: add job for checking chart changelogs --- .github/workflows/checks.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index a9ddf85..54662ea 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -95,3 +95,27 @@ jobs: uses: crate-ci/typos@v1.29.7 with: config: ./configs/typos.toml + + changelog-checker: + runs-on: ubuntu-latest + needs: + - helm-linter + - spell-checker + if: ${{ needs.helm-linter.outputs.charts != '[]' }} + strategy: + matrix: + chart: ${{ fromJSON(needs.helm-linter.outputs.charts) }} + env: + CHANGELOG_FILE: ${{ matrix.chart.path }}/CHANGELOG.md + steps: + - name: Checkout chart's changelog + uses: actions/checkout@v4 + with: + sparse-checkout: ${{ env.CHANGELOG_FILE }} + - name: Check chart's changelog + uses: eaasi/release-notes-action@v0.6 + with: + changelog-file: ${{ env.CHANGELOG_FILE }} + release-version: ${{ matrix.chart.name }}-${{ matrix.chart.version }} + # Ignore missing changelogs for default chart version + continue-on-error: ${{ matrix.chart.version == '0.1.0' }} From 6263599f3c33de9b8e636fc606f22e1e7f867521 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 20:03:57 +0100 Subject: [PATCH 32/63] ci: add support for limiting reusable checks to specific chart --- .github/workflows/checks.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 54662ea..8de3271 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -11,6 +11,10 @@ on: description: Enable change detection default: false type: boolean + chart: + description: Limit checks to a specific chart + default: '' + type: string outputs: charts: description: List of validated charts @@ -53,12 +57,19 @@ jobs: name: Add external chart repositories run: just add-chart-repos - name: Run chart linters and validators - env: - # Enable change detection if explicitly requested, else check all charts - CHART_TESTING_ARGS: ${{ (inputs.enable-change-detection) && '--target-branch main' || '--all' }} run: | set -o pipefail - ct lint --config ./configs/chart-testing.yaml ${{ env.CHART_TESTING_ARGS }} \ + if ${{ inputs.enable-change-detection }}; then + # Enable change detection if requested + set -- "--target-branch" "main" + elif test -n "${{ inputs.chart }}"; then + # Process only the specified chart + set -- "--charts" "./charts/${{ inputs.chart }}" + else + # Process all charts + set -- "--all" + fi + ct lint --config ./configs/chart-testing.yaml "$@" \ | tee "${{ env.CHART_TESTING_LOG }}" - id: ct-log-parser name: Parse chart-testing logs From 5004f8dda4bab6a52d71e52a6d40bc562c2ffc4c Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 20:20:03 +0100 Subject: [PATCH 33/63] ci: add workflow for packaging and releasing charts --- .github/workflows/release.yaml | 120 +++++++++++++++++++++++++++++++++ configs/chart-releaser.yaml | 5 ++ 2 files changed, 125 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 configs/chart-releaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a42177a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,120 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Workflow for packaging and releasing Helm charts + +name: release +on: + push: + tags: + - '**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: read + +env: + CLICOLOR: 1 + +jobs: + tag-parser: + runs-on: ubuntu-latest + outputs: + chart: ${{ steps.refname-parsing.outputs.chart }} + version: ${{ steps.refname-parsing.outputs.version }} + steps: + - id: refname-parsing + name: Parse pushed ref name + run: | + # Parse ref names of the form - + echo "Parsing ref name '${GITHUB_REF_NAME:?}'..." + refname="$(echo "${GITHUB_REF_NAME}" | sed -E 's/^(.+)-([0-9]+.*)$/\1:\2/')" + lookup() { cut -d ':' -f "${1:?}"; } + chart="$(echo "${refname:?}" | lookup 1)" + version="$(echo "${refname}" | lookup 2)" + echo "chart=${chart:?}" >> "${GITHUB_OUTPUT}" + echo "version=${version:?}" >> "${GITHUB_OUTPUT}" + echo "Parsed values:" + echo " chart = ${chart}" + echo " version = ${version}" + + chart-checks: + needs: + - tag-parser + uses: ./.github/workflows/checks.yaml + with: + chart: ${{ needs.tag-parser.outputs.chart }} + enable-change-detection: false + + chart-info: + runs-on: ubuntu-latest + needs: + - chart-checks + - tag-parser + outputs: + name: ${{ matrix.chart.name }} + version: ${{ matrix.chart.version}} + refname: ${{ matrix.chart.name }}-${{ matrix.chart.version }} + path: ${{ matrix.chart.path }} + strategy: + fail-fast: true + matrix: + chart: ${{ fromJSON(needs.chart-checks.outputs.charts) }} + steps: + - name: Find expected chart + run: | + test "${{ matrix.chart.name }}" = "${{ needs.tag-parser.outputs.chart }}" + + version-check: + runs-on: ubuntu-latest + needs: + - chart-info + - tag-parser + steps: + - name: Check chart version + run: | + curver="${{ needs.chart-info.outputs.version }}" + tagver="${{ needs.tag-parser.outputs.version }}" + if test "${curver:?}" != "${tagver:?}"; then + echo "::error::Chart version '${curver}' does not match tag version '${tagver}'!" + exit 1 + fi + + chart-releaser: + runs-on: ubuntu-latest + permissions: + contents: write + needs: + - chart-info + - chart-checks + - version-check + env: + CHART_RELEASER_CONFIG: ./configs/chart-releaser.yaml + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Update Git configuration + run: | + git config user.name "${{ github.event.pusher.name }}" + git config user.email "${{ github.event.pusher.email }}" + - name: Install chart-releaser + uses: helm/chart-releaser-action@v1.7.0 + with: + install_only: true + - name: Package requested chart + run: | + cr package "${{ needs.chart-info.outputs.path }}" \ + --config "${{ env.CHART_RELEASER_CONFIG }}" + - name: Upload chart package + run: | + cr upload --config "${{ env.CHART_RELEASER_CONFIG }}" \ + --token "${{ secrets.GITHUB_TOKEN }}" \ + --commit "${{ github.sha }}" \ + --skip-existing + - name: Update chart repository index + run: | + cr index --config "${{ env.CHART_RELEASER_CONFIG }}" \ + --token "${{ secrets.GITHUB_TOKEN }}" \ + --push diff --git a/configs/chart-releaser.yaml b/configs/chart-releaser.yaml new file mode 100644 index 0000000..a16b9b4 --- /dev/null +++ b/configs/chart-releaser.yaml @@ -0,0 +1,5 @@ +# chart-releaser configuration (https://github.com/helm/chart-releaser) + +pages-branch: pages +skip-existing: true +make-release-latest: false From d88c7ae81757f1ef967f7fd9bb8b490110226d9f Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 20:28:48 +0100 Subject: [PATCH 34/63] ci: register external chart repositories required for releasing --- .github/workflows/release.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a42177a..fdd28bc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -99,10 +99,16 @@ jobs: run: | git config user.name "${{ github.event.pusher.name }}" git config user.email "${{ github.event.pusher.email }}" + - name: Install Just + uses: ./.github/actions/setup-just + - name: Install Helm + uses: ./.github/actions/setup-helm - name: Install chart-releaser uses: helm/chart-releaser-action@v1.7.0 with: install_only: true + - name: Add external chart repositories + run: just add-chart-repos - name: Package requested chart run: | cr package "${{ needs.chart-info.outputs.path }}" \ From 4a0a40aa7b5ea4494f0c3cdd5018eb0ba07a4d76 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 20:40:08 +0100 Subject: [PATCH 35/63] ci: add step for preparing chart release notes --- .github/workflows/release.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fdd28bc..078e178 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -92,6 +92,7 @@ jobs: - version-check env: CHART_RELEASER_CONFIG: ./configs/chart-releaser.yaml + RELEASE_NOTES_FILE_NAME: RELEASE.md steps: - name: Checkout repository uses: actions/checkout@v4 @@ -109,6 +110,12 @@ jobs: install_only: true - name: Add external chart repositories run: just add-chart-repos + - name: Extract chart's release notes + uses: eaasi/release-notes-action@v0.6 + with: + changelog-file: ${{ needs.chart-info.outputs.path }}/CHANGELOG.md + release-notes-file: ${{ needs.chart-info.outputs.path }}/${{ env.RELEASE_NOTES_FILE_NAME }} + release-version: '${{ needs.chart-info.outputs.refname }}' - name: Package requested chart run: | cr package "${{ needs.chart-info.outputs.path }}" \ From bcd513d65e582fc1b62bd8f229c505703f7db64c Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Tue, 18 Mar 2025 20:55:04 +0100 Subject: [PATCH 36/63] ci: configure `cr` to consume prepared release notes --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 078e178..b37e40e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -125,6 +125,7 @@ jobs: cr upload --config "${{ env.CHART_RELEASER_CONFIG }}" \ --token "${{ secrets.GITHUB_TOKEN }}" \ --commit "${{ github.sha }}" \ + --release-notes-file "${{ env.RELEASE_NOTES_FILE_NAME }}" \ --skip-existing - name: Update chart repository index run: | From a0b449c1ab9d1cd79bad3ef14391fbc6fe0a4a49 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Wed, 19 Mar 2025 14:19:01 +0100 Subject: [PATCH 37/63] ci: add reusable action for running `typos` --- .github/actions/check-typos/action.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/actions/check-typos/action.yaml diff --git a/.github/actions/check-typos/action.yaml b/.github/actions/check-typos/action.yaml new file mode 100644 index 0000000..9663c10 --- /dev/null +++ b/.github/actions/check-typos/action.yaml @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +name: check-typos +description: Helper for running Typos +inputs: + files: + description: Files to check + required: false + default: '' +runs: + using: composite + steps: + - name: Install and run Typos + uses: crate-ci/typos@v1.29.7 + with: + config: ./configs/typos.toml + files: ${{ inputs.files }} From 2c3adbf3052ef44335e3d205b7756457065b3c1d Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Wed, 19 Mar 2025 14:29:31 +0100 Subject: [PATCH 38/63] refactor: reuse local action for running `typos` --- .github/workflows/checks.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 8de3271..cf0f3a5 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -103,9 +103,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Run spell checker - uses: crate-ci/typos@v1.29.7 - with: - config: ./configs/typos.toml + uses: ./.github/actions/check-typos changelog-checker: runs-on: ubuntu-latest From 70ee7a2c2b1a89c1c9311bda6d365d0c7b2fba08 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Wed, 19 Mar 2025 15:53:07 +0100 Subject: [PATCH 39/63] ci: add workflow for enforcing PR naming convention --- .github/workflows/pr-naming.yaml | 86 ++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/pr-naming.yaml diff --git a/.github/workflows/pr-naming.yaml b/.github/workflows/pr-naming.yaml new file mode 100644 index 0000000..c26aa56 --- /dev/null +++ b/.github/workflows/pr-naming.yaml @@ -0,0 +1,86 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Workflow for enforcing PR naming conventions + +name: pr-naming +on: + pull_request: + types: + - opened + - edited + - reopened + +permissions: + contents: none + +env: + COMMIT_MESSAGE_FILE: ./commit-message.txt + CLICOLOR: 1 + +jobs: + commit-message: + runs-on: ubuntu-latest + outputs: + content: ${{ steps.message-constructor.outputs.content }} + steps: + - id: message-constructor + name: Construct commit message + env: + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: | + ${{ github.event.pull_request.body }} + run: | + print-commit-message() { + echo "${PR_TITLE:?}" + if test -n "${PR_BODY}"; then + echo "" + echo "${PR_BODY}" + fi + } + # Output commit message + { + echo "content<> "${GITHUB_OUTPUT}" + + commit-linter: + runs-on: ubuntu-latest + needs: + - commit-message + steps: + - &checkout-repository-step + name: Checkout repository + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/actions + configs + - &prepare-commit-message-step + name: Prepare commit message + run: | + echo -n '${{ needs.commit-message.outputs.content }}' > "${{ env.COMMIT_MESSAGE_FILE }}" + - name: Install commit style linter + uses: ./.github/actions/setup-committed + - name: Run commit style linter + run: | + echo "Linting commit message:" + cat "${{ env.COMMIT_MESSAGE_FILE }}" | sed 's/^/> /' + echo "" + committed -vv --color=always \ + --config ./configs/committed.toml \ + --commit-file "${{ env.COMMIT_MESSAGE_FILE }}" + echo "DONE: PR follows the required naming conventions." + + spell-checker: + runs-on: ubuntu-latest + needs: + - commit-message + steps: + - *checkout-repository-step + - *prepare-commit-message-step + - name: Run spell checker + uses: ./.github/actions/check-typos + with: + files: ${{ env.COMMIT_MESSAGE_FILE }} From 24200d1e889fe76efe020c20ec49657821de17d8 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:24:04 +0100 Subject: [PATCH 40/63] chore: add `database` to allowed commit scopes --- configs/committed.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/committed.toml b/configs/committed.toml index 39dcc37..ba8dcaf 100644 --- a/configs/committed.toml +++ b/configs/committed.toml @@ -24,3 +24,8 @@ allowed_types = [ "style", "test", ] + +# allowed commit scopes +allowed_scopes = [ + "database", +] From 0ca887886970f33595f24eb46cb59668be08c29f Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:26:34 +0100 Subject: [PATCH 41/63] docs(database): add initial README --- README.md | 1 + charts/.gitkeep | 0 charts/database/README.md | 3 +++ 3 files changed, 4 insertions(+) delete mode 100644 charts/.gitkeep create mode 100644 charts/database/README.md diff --git a/README.md b/README.md index 776ec01..a03b268 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ $ helm search repo eaasi ## Charts For more details, see the documentation for each chart: +- [database](./charts/database/README.md) ## Development diff --git a/charts/.gitkeep b/charts/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/charts/database/README.md b/charts/database/README.md new file mode 100644 index 0000000..5774e35 --- /dev/null +++ b/charts/database/README.md @@ -0,0 +1,3 @@ +# EAASI Database Helm Chart + +This Helm chart deploys the EAASI Database on [Kubernetes](https://kubernetes.io/) using the [Helm](https://helm.sh) package manager. From c11afb000f425caa5c936cce0672af2819f8eaee Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:32:16 +0100 Subject: [PATCH 42/63] build(database): add initial `.helmignore` --- charts/database/.helmignore | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 charts/database/.helmignore diff --git a/charts/database/.helmignore b/charts/database/.helmignore new file mode 100644 index 0000000..2b89084 --- /dev/null +++ b/charts/database/.helmignore @@ -0,0 +1,25 @@ +# Patterns to ignore when building packages. + +.DS_Store + +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ + +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ + +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ From 32dc595db333a2a9dfd3ac218112249a170601cf Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:41:21 +0100 Subject: [PATCH 43/63] build(database): add initial chart metadata --- charts/database/Chart.yaml | 10 ++++++++++ charts/database/values.yaml | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 charts/database/Chart.yaml create mode 100644 charts/database/values.yaml diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml new file mode 100644 index 0000000..70b22aa --- /dev/null +++ b/charts/database/Chart.yaml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: v2 +name: database +version: "0.1.0" +description: EAASI Database Helm Chart +type: application +sources: + - https://github.com/eaasi/helm-charts diff --git a/charts/database/values.yaml b/charts/database/values.yaml new file mode 100644 index 0000000..9b2a720 --- /dev/null +++ b/charts/database/values.yaml @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Default values for the EAASI Database From 288636eda6c7bec64dce90b373e65dea0066a8b2 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:52:28 +0100 Subject: [PATCH 44/63] build(database): add external chart repository `cnpg` --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index be59d63..6a7abb0 100644 --- a/Justfile +++ b/Justfile @@ -43,7 +43,7 @@ update-changelog chart version="" dir=(chart_dir / chart): # Add external chart repositories add-chart-repos: - # TODO: add repos! + helm repo add "cnpg" "https://cloudnative-pg.github.io/charts" # Build dependencies for all charts build-chart-deps: From 3b8bca3f7e382ad380ac29c89acca0f1c8ab19a3 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:55:05 +0100 Subject: [PATCH 45/63] build(database): add dependency `@cnpg/cloudnative-pg` v0.23.2 --- charts/database/Chart.lock | 6 ++++++ charts/database/Chart.yaml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 charts/database/Chart.lock diff --git a/charts/database/Chart.lock b/charts/database/Chart.lock new file mode 100644 index 0000000..6db68a7 --- /dev/null +++ b/charts/database/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: cloudnative-pg + repository: https://cloudnative-pg.github.io/charts + version: 0.23.2 +digest: sha256:80433e6b4e86900e9daa42348b8863d23370af8f9b4447b7299ba4d440c1bd61 +generated: "2025-03-20T16:50:24.991419617+01:00" diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml index 70b22aa..7663736 100644 --- a/charts/database/Chart.yaml +++ b/charts/database/Chart.yaml @@ -8,3 +8,8 @@ description: EAASI Database Helm Chart type: application sources: - https://github.com/eaasi/helm-charts +dependencies: + - repository: "@cnpg" + name: cloudnative-pg + version: "0.23.2" + alias: operator From ff12e57705af1833322b122f5b77b8a381dc28a3 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 16:59:01 +0100 Subject: [PATCH 46/63] feat(database): add initial database-operator config --- charts/database/Chart.yaml | 1 + charts/database/values.yaml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml index 7663736..abf798f 100644 --- a/charts/database/Chart.yaml +++ b/charts/database/Chart.yaml @@ -13,3 +13,4 @@ dependencies: name: cloudnative-pg version: "0.23.2" alias: operator + condition: operator.enabled diff --git a/charts/database/values.yaml b/charts/database/values.yaml index 9b2a720..184570c 100644 --- a/charts/database/values.yaml +++ b/charts/database/values.yaml @@ -2,3 +2,17 @@ # SPDX-License-Identifier: Apache-2.0 # Default values for the EAASI Database + +# Configuration for the CNPG operator: +# https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg +operator: + # -- Should the operator be enabled? + enabled: false + # -- Override operator name + fullnameOverride: cnpg-operator + # -- Override subchart name + # NOTE: The original chart name must be used here for now, because + # the upstream chart hard-codes it in multiple templates! + nameOverride: cloudnative-pg + # -- Number of replicas + replicaCount: 1 From b561a9e0d3934b23689341ac5b1af204f74b9da8 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 17:15:07 +0100 Subject: [PATCH 47/63] build(database): add dependency `@cnpg/cluster` v0.2.1 --- charts/database/Chart.lock | 7 +++++-- charts/database/Chart.yaml | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/charts/database/Chart.lock b/charts/database/Chart.lock index 6db68a7..d0413a0 100644 --- a/charts/database/Chart.lock +++ b/charts/database/Chart.lock @@ -2,5 +2,8 @@ dependencies: - name: cloudnative-pg repository: https://cloudnative-pg.github.io/charts version: 0.23.2 -digest: sha256:80433e6b4e86900e9daa42348b8863d23370af8f9b4447b7299ba4d440c1bd61 -generated: "2025-03-20T16:50:24.991419617+01:00" +- name: cluster + repository: https://cloudnative-pg.github.io/charts + version: 0.2.1 +digest: sha256:a08a4edc8fc4f25677834d9157b702c8eeb5c33ace93f60fd5f450f5ce393d76 +generated: "2025-03-20T17:10:37.269076118+01:00" diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml index abf798f..5f3dad2 100644 --- a/charts/database/Chart.yaml +++ b/charts/database/Chart.yaml @@ -14,3 +14,6 @@ dependencies: version: "0.23.2" alias: operator condition: operator.enabled + - repository: "@cnpg" + name: cluster + version: "0.2.1" From 58e5c96d601b066bab36e6f93a568131eb4b6ed1 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 17:57:03 +0100 Subject: [PATCH 48/63] feat(database): add initial database-cluster config --- charts/database/Chart.yaml | 1 + charts/database/values.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml index 5f3dad2..7ae8a2c 100644 --- a/charts/database/Chart.yaml +++ b/charts/database/Chart.yaml @@ -17,3 +17,4 @@ dependencies: - repository: "@cnpg" name: cluster version: "0.2.1" + condition: cluster.enabled diff --git a/charts/database/values.yaml b/charts/database/values.yaml index 184570c..bf2edb9 100644 --- a/charts/database/values.yaml +++ b/charts/database/values.yaml @@ -16,3 +16,27 @@ operator: nameOverride: cloudnative-pg # -- Number of replicas replicaCount: 1 + +# Configuration for the CNPG cluster: +# https://github.com/cloudnative-pg/charts/tree/main/charts/cluster +cluster: + # -- Should the cluster be enabled? + enabled: true + # -- Override cluster name + fullnameOverride: eaasi + # -- Override subchart name + nameOverride: database-cluster + # -- Cluster mode of operation + mode: standalone + # -- Type of the CNPG database + type: postgresql + # -- Version of the CNPG database + version: + postgresql: "17.4" + # -- CNPG cluster config + cluster: + # -- Number of instances + instances: 1 + # -- Database storage config + storage: + size: 1Gi From a4ac2e50f89c9e8cf908eb7e174be6df84e40dc8 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 18:02:08 +0100 Subject: [PATCH 49/63] build(database): fail early when operator and cluster are enabled The operator installs CRDs that the cluster subchart depends on. If both are enabled at the same time, then the first installation will fail due to unknown CRDs in the later execution stages anyways. --- charts/database/templates/assertions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 charts/database/templates/assertions.yaml diff --git a/charts/database/templates/assertions.yaml b/charts/database/templates/assertions.yaml new file mode 100644 index 0000000..549ea95 --- /dev/null +++ b/charts/database/templates/assertions.yaml @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +{{- if and .Values.operator.enabled .Values.cluster.enabled -}} +{{- fail "Either the operator or the cluster should be enabled, not both!" -}} +{{- end -}} From 4cb9c104f8fb9e5fbf64dc2519e06594dadd93df Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 18:28:12 +0100 Subject: [PATCH 50/63] feat(database): configure cluster's pod affinity --- charts/database/values.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/charts/database/values.yaml b/charts/database/values.yaml index bf2edb9..13e7650 100644 --- a/charts/database/values.yaml +++ b/charts/database/values.yaml @@ -37,6 +37,11 @@ cluster: cluster: # -- Number of instances instances: 1 + # -- Affinity rules for Pods + affinity: + enablePodAntiAffinity: true + podAntiAffinityType: preferred + topologyKey: kubernetes.io/hostname # -- Database storage config storage: size: 1Gi From ec355042175f821363b938589169b17bc4a22588 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 19:10:09 +0100 Subject: [PATCH 51/63] feat(database): add connection pooler for the primary instance --- charts/database/values.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/charts/database/values.yaml b/charts/database/values.yaml index 13e7650..206b9c0 100644 --- a/charts/database/values.yaml +++ b/charts/database/values.yaml @@ -45,3 +45,14 @@ cluster: # -- Database storage config storage: size: 1Gi + # -- PgBouncer poolers + poolers: + - name: rw + type: rw + instances: 1 + poolMode: transaction + parameters: + max_client_conn: "250" + default_pool_size: "20" + reserve_pool_size: "5" + min_pool_size: "5" From da39129a6fd9daccafab8958ade06c1d851950fb Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 20:25:05 +0100 Subject: [PATCH 52/63] ci(database): add helper for deploying database-operators --- Justfile | 6 ++++++ charts/database/configs/operator.yaml | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 charts/database/configs/operator.yaml diff --git a/Justfile b/Justfile index 6a7abb0..74ca6c3 100644 --- a/Justfile +++ b/Justfile @@ -106,3 +106,9 @@ cluster-unpause name=cluster: # Delete a Minikube cluster cluster-delete name=cluster: minikube delete --profile "{{ name }}" + +### EAASI ##################################################################### + +# Deploy the database-operator +deploy-database-operator name="database-operator" ns="cnpg-system" *args="--wait": \ + (upgrade "database" name ns "-f" (chart_dir / "database/configs/operator.yaml") args) diff --git a/charts/database/configs/operator.yaml b/charts/database/configs/operator.yaml new file mode 100644 index 0000000..6ba6cd7 --- /dev/null +++ b/charts/database/configs/operator.yaml @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +# Override values for installing the operator + +operator: + # Enable the operator + enabled: true + +cluster: + # Disable the cluster + enabled: false From 4b3f87bad99b6f1bf26e14ab94044e75b55240d7 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 20:29:01 +0100 Subject: [PATCH 53/63] ci(database): add helper for deploying database-clusters --- Justfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Justfile b/Justfile index 74ca6c3..4577b1c 100644 --- a/Justfile +++ b/Justfile @@ -7,6 +7,10 @@ cluster := "eaasi" # Name of the cluster namespace namespace := "eaasi" +# Defaults for database-cluster +database_cluster_name := "database-cluster" +database_cluster_ns := "database" + ### HELPERS ################################################################### # Run spell checker @@ -112,3 +116,7 @@ cluster-delete name=cluster: # Deploy the database-operator deploy-database-operator name="database-operator" ns="cnpg-system" *args="--wait": \ (upgrade "database" name ns "-f" (chart_dir / "database/configs/operator.yaml") args) + +# Deploy the database-cluster +deploy-database-cluster name=database_cluster_name ns=database_cluster_ns *args="--wait": \ + (upgrade "database" name ns args) From da3c00e994f378bf615adbe72d832106c83b93cf Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 20:36:47 +0100 Subject: [PATCH 54/63] ci: add helper for deploying all EAASI components --- Justfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Justfile b/Justfile index 4577b1c..1741820 100644 --- a/Justfile +++ b/Justfile @@ -120,3 +120,8 @@ deploy-database-operator name="database-operator" ns="cnpg-system" *args="--wait # Deploy the database-cluster deploy-database-cluster name=database_cluster_name ns=database_cluster_ns *args="--wait": \ (upgrade "database" name ns args) + +# Deploy all components +deploy-all: \ + (deploy-database-operator) \ + (deploy-database-cluster) \ From ea9f2def197f29cdd849f3b0e9e663c177ff4bdd Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 20:59:09 +0100 Subject: [PATCH 55/63] docs(database): describe a basic deployment procedure --- charts/database/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/charts/database/README.md b/charts/database/README.md index 5774e35..e817fa3 100644 --- a/charts/database/README.md +++ b/charts/database/README.md @@ -1,3 +1,34 @@ # EAASI Database Helm Chart This Helm chart deploys the EAASI Database on [Kubernetes](https://kubernetes.io/) using the [Helm](https://helm.sh) package manager. + +## Getting Started + +This chart depends on the [operator](https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg) and the [cluster](https://github.com/cloudnative-pg/charts/tree/main/charts/cluster) charts from the [CloudNativePG](https://github.com/cloudnative-pg) project. + +### Adding the Repositories + +```console +$ helm repo add cnpg "https://cloudnative-pg.github.io/charts" +$ helm repo add eaasi "https://eaasi.github.io/helm-charts" +``` + +### Installing the Operator + +First, the *CNPG operator* must be installed, since it provides several CRDs required for setting up new database *clusters*. +Skip this step if the operator is already installed in your K8s cluster: + +```console +$ helm install database-operator eaasi/database \ + --namespace cnpg-system --create-namespace \ + -f ./configs/operator.yaml +``` + +### Creating a Cluster + +A new *CNPG cluster* can be created with the following command: + +```console +$ helm install database-cluster eaasi/database \ + --namespace database --create-namespace +``` From 82b6c8071c4cc527b24089af061748d20cfe052d Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 21:11:25 +0100 Subject: [PATCH 56/63] docs(database): describe available configuration parameters --- charts/database/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/database/README.md b/charts/database/README.md index e817fa3..c36ae5b 100644 --- a/charts/database/README.md +++ b/charts/database/README.md @@ -32,3 +32,10 @@ A new *CNPG cluster* can be created with the following command: $ helm install database-cluster eaasi/database \ --namespace database --create-namespace ``` + +## Configuration + +A minimal configuration for an operator and a cluster is provided in the default [values.yaml](./values.yaml) file. +For further details on all available parameters, please refer to the configuration files of the upstream [operator](https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg) and [cluster](https://github.com/cloudnative-pg/charts/tree/main/charts/cluster) charts. + +The extensive documentation for the CloudNativePG project can be found [here](https://cloudnative-pg.io/documentation/current/). From eb4ebec7d09482704c3cafa8679bc15d47276d23 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Thu, 20 Mar 2025 21:31:03 +0100 Subject: [PATCH 57/63] docs(database): describe how a development database can be deployed --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index a03b268..e1259c5 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,18 @@ Next, rebuild all required chart dependencies with: $ just build-chart-deps ``` +The [database](./charts/database) operator can be deployed with: + +```console +$ just deploy-database-operator # +``` + +Then, a [database](./charts/database) cluster can be deployed with: + +```console +$ just deploy-database-cluster # +``` + ## License Helm charts for EAASI are distributed under the [Apache-2.0](./LICENSE) license. From a274a87e3769e4c6249d02cb85019011c8da1b3c Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 14:26:34 +0100 Subject: [PATCH 58/63] ci: add helpers for testing deployed charts --- Justfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Justfile b/Justfile index 1741820..1e48c01 100644 --- a/Justfile +++ b/Justfile @@ -84,6 +84,10 @@ render chart name=chart ns=namespace *args: helm template "{{ name }}" "{{ chart_dir / chart }}" \ --namespace "{{ ns }}" {{ args }} | less +# Test a Helm chart release +test release ns=namespace *args: + helm test "{{ release }}" --namespace "{{ ns }}" {{ args }} + ### MINIKUBE ################################################################## # Start a Minikube cluster @@ -125,3 +129,11 @@ deploy-database-cluster name=database_cluster_name ns=database_cluster_ns *args= deploy-all: \ (deploy-database-operator) \ (deploy-database-cluster) \ + +# Test the database-cluster +test-database-cluster name=database_cluster_name ns=database_cluster_ns *args: \ + (test name ns args) + +# Test all components +test-all: \ + (test-database-cluster) \ From 15d5822daa6c627d63110cef361cc2b920438986 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 14:38:22 +0100 Subject: [PATCH 59/63] ci: rework `helm-tester` job to use custom helpers instead of `ct` tool --- .github/workflows/checks.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index cf0f3a5..e2af4e3 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -92,10 +92,13 @@ jobs: - name: Start Minikube cluster run: just cluster-start - *install-helm-step - - *install-ct-step - *add-chart-repos-step - - name: Install and test charts - run: ct install --config ./configs/chart-testing.yaml --all + - name: Build chart dependencies + run: just build-chart-deps + - name: Install charts + run: just deploy-all + - name: Test charts + run: just test-all spell-checker: runs-on: ubuntu-latest From 077656dff9b00603837fe470cd6e788e21ff53c7 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 15:05:45 +0100 Subject: [PATCH 60/63] ci: ignore typo false positives triggered by `ba` surrounded by numbers --- configs/typos.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/typos.toml b/configs/typos.toml index 8d38a84..c727fa6 100644 --- a/configs/typos.toml +++ b/configs/typos.toml @@ -6,6 +6,9 @@ extend-ignore-re = [ "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # ignore blocks with "spellchecker:" "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", + # ignore false positives triggered by "ba" surrounded by numbers + "[0-9]+ba", + "ba[0-9]+", ] [default.extend-words] From 3037e0d3b32c8b25b781e11927bb8ebe59582aee Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 15:45:54 +0100 Subject: [PATCH 61/63] test(database): add ping-test for configured connection poolers --- .../database/templates/tests/pooler-ping.yaml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 charts/database/templates/tests/pooler-ping.yaml diff --git a/charts/database/templates/tests/pooler-ping.yaml b/charts/database/templates/tests/pooler-ping.yaml new file mode 100644 index 0000000..4285955 --- /dev/null +++ b/charts/database/templates/tests/pooler-ping.yaml @@ -0,0 +1,69 @@ +# SPDX-FileCopyrightText: 2025 Yale University +# SPDX-License-Identifier: Apache-2.0 + +{{ if .Values.cluster.enabled -}} +{{ $context := dict "Values" .Values.cluster "Release" .Release -}} +{{ $fullname := include "cluster.fullname" $context -}} +{{ $namespace := include "cluster.namespace" $context -}} +{{ $secname := printf "%s-app" $fullname -}} +{{ range $index, $pooler := .Values.cluster.poolers -}} +{{ $svcname := printf "%s-pooler-%s" $fullname $pooler.name -}} +{{ $jobname := printf "%s-ping-test" $svcname -}} +{{/* +Simple database ping test for a configured CNPG Pooler, adapted from: +https://github.com/cloudnative-pg/charts/blob/cluster-v0.2.1/charts/cluster/templates/tests/ping.yaml +*/ -}} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ $jobname }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/component: database-ping-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded +spec: + template: + metadata: + name: {{ $jobname }} + namespace: {{ $namespace }} + labels: + app.kubernetes.io/component: database-ping-test + spec: + restartPolicy: Never + containers: + - name: alpine + image: alpine:3.21 + env: + - name: PGUSER + valueFrom: + secretKeyRef: + name: {{ $secname }} + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: {{ $secname }} + key: password + - name: PGDBNAME + valueFrom: + secretKeyRef: + name: {{ $secname }} + key: dbname + optional: true + command: + - "/bin/sh" + args: + - "-e" + - "-u" + - "-c" + - | + apk add postgresql-client + psql --no-password \ + -h "{{ $svcname }}.{{ $namespace }}.svc.cluster.local" \ + -p 5432 \ + -d "${PGDBNAME:-$PGUSER}" \ + -c "SELECT 1" +{{ end -}} +{{ end -}} From d50231440162297e124f6361777d0db84d0ce0a8 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 15:55:22 +0100 Subject: [PATCH 62/63] build(database): bump chart version to 0.5.0 --- charts/database/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/database/Chart.yaml b/charts/database/Chart.yaml index 7ae8a2c..37206a2 100644 --- a/charts/database/Chart.yaml +++ b/charts/database/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: database -version: "0.1.0" +version: "0.5.0" description: EAASI Database Helm Chart type: application sources: From 2960228d2a586634d2b0d4b0ea64e5deb7cdecf9 Mon Sep 17 00:00:00 2001 From: Oleg Stobbe Date: Fri, 21 Mar 2025 15:58:49 +0100 Subject: [PATCH 63/63] chore(database): update changelog for version 0.5.0 --- charts/database/.helmignore | 1 + charts/database/CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 charts/database/CHANGELOG.md diff --git a/charts/database/.helmignore b/charts/database/.helmignore index 2b89084..6e75903 100644 --- a/charts/database/.helmignore +++ b/charts/database/.helmignore @@ -1,5 +1,6 @@ # Patterns to ignore when building packages. +CHANGELOG.md .DS_Store # Common VCS dirs diff --git a/charts/database/CHANGELOG.md b/charts/database/CHANGELOG.md new file mode 100644 index 0000000..2e1a615 --- /dev/null +++ b/charts/database/CHANGELOG.md @@ -0,0 +1,35 @@ +# Changelog + +## database-0.5.0 - *2025-03-21* + +### Features + +- Add initial database-operator config - ([`7e74059`](https://github.com/eaasi/helm-charts/commit/7e74059495b1f8372a18fde15a12fd717dd3180f)) +- Add initial database-cluster config - ([`4b69330`](https://github.com/eaasi/helm-charts/commit/4b693307d23e6d1809c96be67e3128ff8560e1e5)) +- Configure cluster's pod affinity - ([`4c246f2`](https://github.com/eaasi/helm-charts/commit/4c246f29808bc4d80966c4c793905fd1e0f2d1b7)) +- Add connection pooler for the primary instance - ([`dfb97d0`](https://github.com/eaasi/helm-charts/commit/dfb97d0909c2d57a715f9dd57a8c21b4b593c834)) + +### Testing + +- Add ping-test for configured connection poolers - ([`7e3c434`](https://github.com/eaasi/helm-charts/commit/7e3c434bdb769dc151719aabf0f750a918dd4043)) + +### Continuous Integration + +- Add helper for deploying database-operators - ([`4195122`](https://github.com/eaasi/helm-charts/commit/419512222f7fb7e6472a1e240b66c5da9379f843)) +- Add helper for deploying database-clusters - ([`6a2195b`](https://github.com/eaasi/helm-charts/commit/6a2195b2b779ec28b941c4dec82320646776a351)) + +### Documentation + +- Add initial README - ([`5e58495`](https://github.com/eaasi/helm-charts/commit/5e5849556726fb1a8155ed7088d384b5d2b323d7)) +- Describe a basic deployment procedure - ([`ad61b1b`](https://github.com/eaasi/helm-charts/commit/ad61b1bfdcd0dde0268a56e610ce329a2cae1553)) +- Describe available configuration parameters - ([`ed9d7db`](https://github.com/eaasi/helm-charts/commit/ed9d7dbb2b290ff0ca774db869ffa157ac83df3d)) +- Describe how a development database can be deployed - ([`3005ccb`](https://github.com/eaasi/helm-charts/commit/3005ccb54c62f5a9642be7ba35ee661e815f59df)) + +### Miscellaneous + +- Add initial `.helmignore` - ([`dda6abc`](https://github.com/eaasi/helm-charts/commit/dda6abc21b2734b0a0a52287e950afab05da90e7)) +- Add initial chart metadata - ([`1025303`](https://github.com/eaasi/helm-charts/commit/1025303121eb060421e299eda1267b2771bc0cf2)) +- Add external chart repository `cnpg` - ([`44fac8b`](https://github.com/eaasi/helm-charts/commit/44fac8b7aea39c68eb7b017f1eef5c23c8c521a4)) +- Add dependency `@cnpg/cloudnative-pg` v0.23.2 - ([`e473c61`](https://github.com/eaasi/helm-charts/commit/e473c61512bdaf0f82f7cfbcba66ca87314812f4)) +- Add dependency `@cnpg/cluster` v0.2.1 - ([`6833b2b`](https://github.com/eaasi/helm-charts/commit/6833b2b88b02177037b2a5972fb93592a1b5723e)) +- Fail early when operator and cluster are enabled - ([`d5de591`](https://github.com/eaasi/helm-charts/commit/d5de591555c44f77c43c23eb2a1e39b9f531a0ff))