diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index 2dbdd77..7f18822 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -7,6 +7,21 @@ on: paths: - "charts/**" jobs: + unit-test: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - name: Helm tool installer + uses: Azure/setup-helm@v3 + + - name: Install helm-unittest plugin + run: helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.1.1 + + - name: Run helm unit tests + run: helm unittest charts/kafka-ui + build-and-test: runs-on: ubuntu-latest steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a93ecad --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +# Pre-commit hooks for kafbat/helm-charts +# +# Install once: pre-commit install +# Run on demand: pre-commit run --all-files +# +# These mirror what CI enforces (see .github/workflows/), so contributors +# catch issues locally before pushing. During a normal `git commit` the hooks +# only run against the files you staged, so they won't churn unrelated files. +repos: + # Render the chart templates and assert on the output. Mirrors the + # `unit-test` job in .github/workflows/helm.yaml. Requires the plugin: + # helm plugin install https://github.com/helm-unittest/helm-unittest + - repo: local + hooks: + - id: helm-unittest + name: helm unittest (kafka-ui) + entry: helm unittest charts/kafka-ui + language: system + files: '^charts/kafka-ui/(templates/.*|values\.yaml|Chart\.yaml|tests/.*\.yaml)$' + pass_filenames: false + verbose: true + + # Keep CONFIGURATION.md in sync with the @param metadata in values.yaml. + # Mirrors the "Update README from values.yaml metadata" workflow, which + # otherwise auto-commits this on the PR. + - repo: local + hooks: + - id: readme-generator-for-helm + name: regenerate CONFIGURATION.md from values.yaml + entry: npx --yes @bitnami/readme-generator-for-helm --values charts/kafka-ui/values.yaml --readme charts/kafka-ui/CONFIGURATION.md + language: system + files: '^charts/kafka-ui/(values\.yaml|CONFIGURATION\.md)$' + pass_filenames: false + + # General hygiene. These act only on staged files during a normal commit. + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + # Helm templates rely on significant whitespace in places; leave them. + exclude: '^charts/.*/templates/.*$' + - id: end-of-file-fixer + exclude: '^charts/.*/templates/.*$' + - id: check-merge-conflict + - id: check-added-large-files + - id: check-yaml + # Helm templates are Go templates, not plain YAML — skip them. + exclude: '^charts/.*/templates/.*$' diff --git a/charts/kafka-ui/CONFIGURATION.md b/charts/kafka-ui/CONFIGURATION.md index 7a4d3bd..5f4aca5 100644 --- a/charts/kafka-ui/CONFIGURATION.md +++ b/charts/kafka-ui/CONFIGURATION.md @@ -58,6 +58,9 @@ | `probes.readiness.initialDelaySeconds` | Initial delay seconds for readiness probe | `10` | | `probes.readiness.periodSeconds` | Period seconds for readiness probe | `30` | | `probes.readiness.timeoutSeconds` | Timeout seconds for readiness probe | `10` | +| `probes.startup.failureThreshold` | Failure threshold for startup probe | `5` | +| `probes.startup.periodSeconds` | Period seconds for startup probe | `40` | +| `probes.startup.timeoutSeconds` | Timeout seconds for startup probe | `10` | ### Security Context diff --git a/charts/kafka-ui/Chart.yaml b/charts/kafka-ui/Chart.yaml index 13a1a6c..58939ff 100644 --- a/charts/kafka-ui/Chart.yaml +++ b/charts/kafka-ui/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: kafka-ui description: A Helm chart for kafka-UI type: application -version: 1.6.4 +version: 1.6.6 appVersion: v1.5.0 icon: https://raw.githubusercontent.com/kafbat/kafka-ui/main/documentation/images/logo_new.png diff --git a/charts/kafka-ui/tests/README.md b/charts/kafka-ui/tests/README.md new file mode 100644 index 0000000..6e26dac --- /dev/null +++ b/charts/kafka-ui/tests/README.md @@ -0,0 +1,57 @@ +# Chart unit tests + +These suites use [`helm-unittest`](https://github.com/helm-unittest/helm-unittest) +to render the chart's templates and assert on the resulting manifests. They run +in milliseconds, need no Kubernetes cluster, and catch template regressions +(missing fields, broken conditionals, failed `fail`/`required` guards) before a +change is ever applied. + +## Running locally + +Install the plugin once: + +```bash +helm plugin install https://github.com/helm-unittest/helm-unittest +``` + +Then run the suites from the repository root: + +```bash +helm unittest charts/kafka-ui +``` + +## Layout + +One suite per template, named `