From 6b89c6e51f44dc83e2676ee4e05cd635fe495bd7 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Tue, 26 May 2026 20:42:17 +0200 Subject: [PATCH] feat: add namespace override --- .gitea/workflows/deploy.yaml | 10 ++++++++-- .gitea/workflows/validate.yaml | 8 +++++++- README.md | 28 +++++++++++++++------------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index cf0f6a9..12d3940 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -28,6 +28,11 @@ on: required: false default: "{}" type: string + namespace: + description: "Override the default namespace (extracted from repository name)" + required: false + default: "" + type: string jobs: detect-service-type: @@ -76,7 +81,7 @@ jobs: - name: Set restic backup secret uses: azure/k8s-create-secret@5e49ad902ac755e0815974a44904c728da961747 # v6.0.0 with: - namespace: ${{ steps.namespace.outputs.namespace }} + namespace: ${{ inputs.namespace || steps.namespace.outputs.namespace }} secret-name: backupsidecar-secret secret-type: generic data: | @@ -108,7 +113,7 @@ jobs: action: deploy manifests: "${{ inputs.k8s_dir }}" strategy: basic - namespace: ${{ steps.namespace.outputs.namespace }} + namespace: ${{ inputs.namespace || steps.namespace.outputs.namespace }} deploy-helm: runs-on: ubuntu-latest @@ -133,6 +138,7 @@ jobs: uses: helmfile/helmfile-action@f6f7844b9e6d9f5ac8cf4cdae8ada1a42755c036 # v2.4.4 with: helmfile-args: apply + namespace: ${{ inputs.namespace || steps.namespace.outputs.namespace }} env: ${{ fromJSON(inputs.helmfile_env) }} # Summary job that always runs to show what was deployed diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml index 9633778..3f8fb7e 100644 --- a/.gitea/workflows/validate.yaml +++ b/.gitea/workflows/validate.yaml @@ -23,6 +23,11 @@ on: required: false default: "{}" type: string + namespace: + description: "Override the default namespace (extracted from repository name)" + required: false + default: "" + type: string jobs: detect-service-type: @@ -71,7 +76,7 @@ jobs: - name: Validate k8s manifests uses: azure/k8s-lint@e4234c50ea835112e72b145bdecd00a94bad42fd # v4.0.0 with: - namespace: ${{ steps.namespace.outputs.namespace }} + namespace: ${{ inputs.namespace || steps.namespace.outputs.namespace }} lintType: dryrun manifests: "${{ inputs.k8s_dir }}" @@ -98,6 +103,7 @@ jobs: uses: helmfile/helmfile-action@f6f7844b9e6d9f5ac8cf4cdae8ada1a42755c036 # v2.4.4 with: helmfile-args: diff + namespace: ${{ inputs.namespace || steps.namespace.outputs.namespace }} env: ${{ fromJSON(inputs.helmfile_env) }} # Summary job that always runs to show what was validated diff --git a/README.md b/README.md index 5cd0e4a..8794202 100644 --- a/README.md +++ b/README.md @@ -50,22 +50,24 @@ jobs: ### CI (`.gitea/workflows/ci.yaml`) -| Parameter | Description | Default | Required | -| ---------------------- | -------------------------------------------- | --------------- | -------- | -| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No | -| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No | -| `skip_helm_validation` | Skip Helm validation even if helmfile exists | `false` | No | -| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No | +| Parameter | Description | Default | Required | +| ---------------------- | --------------------------------------------------------------- | --------------- | -------- | +| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No | +| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No | +| `skip_helm_validation` | Skip Helm validation even if helmfile exists | `false` | No | +| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No | +| `namespace` | Override the default namespace (extracted from repository name) | `""` | No | ### CD (`.gitea/workflows/cd.yaml`) -| Parameter | Description | Default | Required | -| -------------------------------- | -------------------------------------------- | --------------- | -------- | -| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No | -| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No | -| `skip_helm_deployment` | Skip Helm deployment even if helmfile exists | `false` | No | -| `skip_shared_secrets_deployment` | Skip shared secrets deployment | `false` | No | -| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No | +| Parameter | Description | Default | Required | +| -------------------------------- | --------------------------------------------------------------- | --------------- | -------- | +| `k8s_dir` | Path to Kubernetes manifests directory | `k8s/` | No | +| `helmfile_path` | Path to helmfile.yaml | `helmfile.yaml` | No | +| `skip_helm_deployment` | Skip Helm deployment even if helmfile exists | `false` | No | +| `skip_shared_secrets_deployment` | Skip shared secrets deployment | `false` | No | +| `helmfile_env` | JSON object string passed as env to helmfile | `{}` | No | +| `namespace` | Override the default namespace (extracted from repository name) | `""` | No | ## Directory Structure Requirements -- 2.52.0