You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2026/05/28 21:49:54 UTC

(superset-kubernetes-operator) branch main updated: chore: more pre-0.1.0 cleanup (#92)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/superset-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 6448438  chore: more pre-0.1.0 cleanup (#92)
6448438 is described below

commit 6448438b1bb60a2bd4de604622bb43cd2497d6fd
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Thu May 28 14:49:46 2026 -0700

    chore: more pre-0.1.0 cleanup (#92)
    
    * chore: more pre-0.1.0 cleanup
    
    * docs fixes
---
 CHANGELOG.md                                       |  29 +++
 Makefile                                           |  11 +-
 README.md                                          |   2 +-
 api/v1alpha1/shared_types.go                       |   4 +
 api/v1alpha1/zz_generated.deepcopy.go              |   5 +
 .../crds/superset.apache.org_supersets.yaml        |  42 +++++
 .../crd/bases/superset.apache.org_supersets.yaml   |  42 +++++
 docs/contributing/development-guidelines.md        |  31 ++++
 docs/contributing/development-setup.md             |   2 +-
 docs/contributing/releasing.md                     | 200 ++++++++++++++++++++-
 docs/reference/api-reference.md                    |   1 +
 docs/reference/security.md                         | 115 ++++++++----
 docs/user-guide/migration.md                       |  55 +++++-
 internal/controller/config_builder.go              |   3 +
 internal/controller/config_test.go                 |  31 ++++
 scripts/release-rc.sh                              |  38 +++-
 scripts/release-source.sh                          | 189 +++++++++++++++++++
 17 files changed, 740 insertions(+), 60 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1e9813a
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,29 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Changelog
+
+All notable changes to the Apache Superset Kubernetes Operator will be
+recorded here once the first release is cut. The format is based on
+[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
+adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The
+full git history is available on
+[GitHub](https://github.com/apache/superset-kubernetes-operator/commits/main).
+
+## [Unreleased]
diff --git a/Makefile b/Makefile
index 15d12f0..ba7a8fb 100644
--- a/Makefile
+++ b/Makefile
@@ -161,8 +161,8 @@ helm-sync-crds: ## Sync generated CRDs into the Helm chart.
 	cp config/crd/bases/*.yaml $(HELM_CHART_DIR)/crds/
 
 .PHONY: helm
-helm: manifests helm-sync-crds ## Sync CRDs into Helm chart and package it.
-	helm package $(HELM_CHART_DIR)
+helm: manifests helm-sync-crds ## Sync CRDs into Helm chart and package it. The chart `appVersion` is derived from VERSION at package time.
+	helm package $(HELM_CHART_DIR) --app-version $(VERSION)
 
 .PHONY: helm-lint
 helm-lint: helm-sync-crds ## Lint the Helm chart (syncs CRDs first).
@@ -206,10 +206,9 @@ test-unit: manifests generate fmt vet ## Run unit tests (no envtest or cluster r
 test-integration: manifests generate fmt vet setup-envtest ## Run integration tests (requires envtest).
 	KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -tags integration -coverprofile cover.out
 
-# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
-# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
-# CertManager is installed by default; skip with:
-# - CERT_MANAGER_INSTALL_SKIP=true
+# E2E tests live under test/e2e/ and assume Kind is pre-installed; the manager
+# image is built and side-loaded into the cluster. CertManager is installed by
+# default; skip with CERT_MANAGER_INSTALL_SKIP=true.
 KIND_CLUSTER ?= superset-kubernetes-operator-test-e2e
 # Derived from .github/supported-k8s.json (the canonical kindest/node pin,
 # regenerated from the kind release notes by `make sync-supported-versions`).
diff --git a/README.md b/README.md
index 4f93cb1..40eb418 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ spec:
 | Command | Description |
 |---|---|
 | `make helm-sync-crds` | Sync generated CRDs into the Helm chart. |
-| `make helm` | Sync CRDs into Helm chart and package it. |
+| `make helm` | Sync CRDs into Helm chart and package it. The chart `appVersion` is derived from VERSION at package time. |
 | `make helm-lint` | Lint the Helm chart (syncs CRDs first). |
 
 ### Development
diff --git a/api/v1alpha1/shared_types.go b/api/v1alpha1/shared_types.go
index fe31c0e..23c6d79 100644
--- a/api/v1alpha1/shared_types.go
+++ b/api/v1alpha1/shared_types.go
@@ -68,6 +68,10 @@ type ImageOverrideSpec struct {
 	// Override the image repository for this component; inherits from spec.image.repository if omitted.
 	// +optional
 	Repository *string `json:"repository,omitempty"`
+	// Override the image pull policy for this component; inherits from spec.image.pullPolicy if omitted.
+	// +optional
+	// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
+	PullPolicy *corev1.PullPolicy `json:"pullPolicy,omitempty"`
 }
 
 // ContainerImageSpec defines a generic container image. Unlike ImageSpec, it
diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go
index 4b928b5..21806af 100644
--- a/api/v1alpha1/zz_generated.deepcopy.go
+++ b/api/v1alpha1/zz_generated.deepcopy.go
@@ -843,6 +843,11 @@ func (in *ImageOverrideSpec) DeepCopyInto(out *ImageOverrideSpec) {
 		*out = new(string)
 		**out = **in
 	}
+	if in.PullPolicy != nil {
+		in, out := &in.PullPolicy, &out.PullPolicy
+		*out = new(v1.PullPolicy)
+		**out = **in
+	}
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOverrideSpec.
diff --git a/charts/superset-operator/crds/superset.apache.org_supersets.yaml b/charts/superset-operator/crds/superset.apache.org_supersets.yaml
index c7bb9df..8e6324c 100644
--- a/charts/superset-operator/crds/superset.apache.org_supersets.yaml
+++ b/charts/superset-operator/crds/superset.apache.org_supersets.yaml
@@ -373,6 +373,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -4296,6 +4302,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -8298,6 +8310,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -15674,6 +15692,12 @@ spec:
                     type: boolean
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -23334,6 +23358,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -31567,6 +31597,12 @@ spec:
                         || self.workerClass == ''gthread'''
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -35556,6 +35592,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
diff --git a/config/crd/bases/superset.apache.org_supersets.yaml b/config/crd/bases/superset.apache.org_supersets.yaml
index c7bb9df..8e6324c 100644
--- a/config/crd/bases/superset.apache.org_supersets.yaml
+++ b/config/crd/bases/superset.apache.org_supersets.yaml
@@ -373,6 +373,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -4296,6 +4302,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -8298,6 +8310,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -15674,6 +15692,12 @@ spec:
                     type: boolean
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -23334,6 +23358,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -31567,6 +31597,12 @@ spec:
                         || self.workerClass == ''gthread'''
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
@@ -35556,6 +35592,12 @@ spec:
                     type: object
                   image:
                     properties:
+                      pullPolicy:
+                        enum:
+                        - Always
+                        - IfNotPresent
+                        - Never
+                        type: string
                       repository:
                         type: string
                       tag:
diff --git a/docs/contributing/development-guidelines.md b/docs/contributing/development-guidelines.md
index 7705373..5b4958f 100644
--- a/docs/contributing/development-guidelines.md
+++ b/docs/contributing/development-guidelines.md
@@ -435,6 +435,37 @@ alternatives considered, or migration steps.
 
 The PR template (`PULL_REQUEST_TEMPLATE.md`) pre-fills these sections.
 
+### Changelog entry
+
+Add a bullet under `## [Unreleased]` in
+[`CHANGELOG.md`](https://github.com/apache/superset-kubernetes-operator/blob/main/CHANGELOG.md)
+for noteworthy changes — new features,
+new CRD fields, behavior changes, breaking changes, deprecations, and
+critical bug fixes. Skip the entry for routine work that a user wouldn't
+care about: dependency bumps, CI tweaks, internal refactors, test-only
+changes, and documentation-only updates.
+
+Group entries under `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, or
+`Security` (per [Keep a Changelog](https://keepachangelog.com/en/1.1.0/));
+create the subheading on first use. Lead each bullet with the user-facing
+effect, not the implementation:
+
+```markdown
+## [Unreleased]
+
+### Added
+- New `webServer.gunicorn.keepAlive` field for tuning Gunicorn keepalive timeouts.
+
+### Fixed
+- Lifecycle `migrate` task no longer retries indefinitely when the metastore
+  rejects credentials; the parent surfaces an `AuthenticationFailed` reason.
+```
+
+The release manager does a final review pass over `## [Unreleased]` before
+tagging — see [Releasing](releasing.md#reviewing-the-changelog) — so it's
+fine to err on the side of including an entry; missing or duplicate ones can
+be cleaned up there.
+
 ### Code coverage
 
 CI uploads test coverage to [Codecov](https://codecov.io) on every PR. The
diff --git a/docs/contributing/development-setup.md b/docs/contributing/development-setup.md
index b3bff19..0416090 100644
--- a/docs/contributing/development-setup.md
+++ b/docs/contributing/development-setup.md
@@ -154,7 +154,7 @@ kind delete cluster --name superset
 | Command | Description |
 |---|---|
 | `make helm-sync-crds` | Sync generated CRDs into the Helm chart. |
-| `make helm` | Sync CRDs into Helm chart and package it. |
+| `make helm` | Sync CRDs into Helm chart and package it. The chart `appVersion` is derived from VERSION at package time. |
 | `make helm-lint` | Lint the Helm chart (syncs CRDs first). |
 
 ### Development
diff --git a/docs/contributing/releasing.md b/docs/contributing/releasing.md
index 71a7f10..a7d142d 100644
--- a/docs/contributing/releasing.md
+++ b/docs/contributing/releasing.md
@@ -114,25 +114,182 @@ Before creating the first RC for a minor release, run or verify:
 - `make test-e2e` on a working Kind or equivalent Kubernetes cluster
 - The release workflow is using pinned/checksum-verified tool downloads
 
+## Reviewing the Changelog
+
+Contributors add bullets to `## [Unreleased]` in `CHANGELOG.md` as PRs land
+(see the
+[changelog convention](development-guidelines.md#changelog-entry)). Before
+tagging the RC, the release manager does one review pass to make sure the
+section accurately reflects the release:
+
+1. Skim `git log v<previous>..HEAD` for noteworthy changes that nobody added
+   an entry for, and add them. Skim for changes that were added but aren't
+   actually noteworthy (typo fixes, internal refactors that snuck in), and
+   drop them.
+2. Merge bullets that describe the same user-visible change — separate PRs
+   often touch on a single feature.
+3. Make sure each bullet leads with the user-facing effect and reads in a
+   consistent voice.
+4. Group bullets under the standard Keep a Changelog subheadings — `Added`,
+   `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security` — dropping any
+   that end up empty.
+5. Rename the section header from `## [Unreleased]` to
+   `## [<version>] — <YYYY-MM-DD>` and add a fresh empty `## [Unreleased]`
+   above it. Update the comparison links at the bottom of the file.
+
+Two flows depending on whether the release branch already exists:
+
+- **First RC of a minor release.** The `release/<version>` branch does not
+  exist yet, and `release-rc.sh` will create it from `main`. Land the
+  reviewed `CHANGELOG.md` on `main` first (a normal PR), then run
+  `release-rc.sh` so the new branch and RC tag pick it up.
+- **Subsequent RCs (`rc2`, `rc3`, …).** The `release/<version>` branch
+  already exists. Commit the `CHANGELOG.md` polish on that branch directly,
+  then run `release-rc.sh` to bump the RC number.
+
 ## Creating a Release Candidate
 
-The `scripts/release-rc.sh` script automates the full RC preparation: creates a
-release branch, bumps the operator version, regenerates manifests, runs tests
-and linting, commits, and tags.
+The `scripts/release-rc.sh` script automates the full RC preparation: creates
+the release branch (first RC only), bumps the operator and Helm chart
+versions, regenerates manifests, runs the lint/license/test/docs/helm-lint
+checks, commits, and tags.
 
 ```sh
-# First RC for 0.2.0 — creates release/0.2.0 branch and v0.2.0-rc1 tag
+# First RC for 0.2.0 — creates release/0.2.0 branch and v0.2.0-rc1 tag.
+# Chart version defaults to the operator version unless overridden.
 scripts/release-rc.sh 0.2.0
 
-# Optionally bump the Helm chart version too
-scripts/release-rc.sh 0.2.0 --chart-version 0.2.0
+# Pin the Helm chart to a different version (rare; only for chart-only fixes).
+scripts/release-rc.sh 0.2.0 --chart-version 0.2.1
 
 # Push branch + tag to trigger the release workflow
 git push origin release/0.2.0 v0.2.0-rc1
 ```
 
-Running the script again from the same release branch increments the RC number
-automatically (rc1, rc2, ...).
+Running the script again from the same release branch increments the RC
+number automatically (rc1, rc2, ...).
+
+## ASF Source Release Artifacts
+
+Per the [ASF Release Policy](https://www.apache.org/legal/release-policy.html),
+the **signed source archive is the official release**. The OCI images and
+Helm chart published to GHCR by the release workflow are convenience binaries
+and cannot be voted on in isolation.
+
+A release candidate therefore needs three artifacts staged on
+[dist.apache.org](https://dist.apache.org/repos/dist/dev/superset/):
+
+| Artifact | Filename pattern | Notes |
+|---|---|---|
+| Source archive | `apache-superset-kubernetes-operator-<version>-source.tar.gz` | A `git archive` of the RC tag, prefixed with the project directory. |
+| Detached PGP signature | `apache-superset-kubernetes-operator-<version>-source.tar.gz.asc` | Generated with a key in [`KEYS`](https://dist.apache.org/repos/dist/release/superset/KEYS). |
+| SHA-512 checksum | `apache-superset-kubernetes-operator-<version>-source.tar.gz.sha512` | `shasum -a 512` output, with a bare filename so verifiers can run `shasum -c` after a plain download. |
+
+### Pre-requisites for the release manager
+
+1. Be a Superset PMC member (binding vote), or coordinate with one if you are
+   a committer driving the release.
+2. Have a PGP key registered in
+   `https://dist.apache.org/repos/dist/release/superset/KEYS` and uploaded to
+   the public keyservers. To add a new key, append the output of
+   `gpg --list-sigs <fingerprint> && gpg --armor --export <fingerprint>` to
+   `KEYS` in the SVN checkout below and commit.
+3. Have `svn` checkouts of both ASF dist locations:
+
+   ```sh
+   svn co https://dist.apache.org/repos/dist/dev/superset/ ~/asf/dev-superset
+   svn co https://dist.apache.org/repos/dist/release/superset/ ~/asf/release-superset
+   ```
+
+### Producing the source tarball
+
+`scripts/release-source.sh` wraps `git archive`, `gpg`, and `shasum` and
+self-verifies before exiting:
+
+```sh
+scripts/release-source.sh 0.2.0 --rc 1
+# → dist/apache-superset-kubernetes-operator-0.2.0-rc1-source.tar.gz{,.asc,.sha512}
+```
+
+Pass `--gpg-key <id>` to pick a non-default signing key, and `--out-dir
+<path>` to write the artifacts somewhere other than `./dist/`.
+
+> **Why a script, not raw `git archive` + `gpg` + `shasum`.** The script
+> avoids a small set of subtle errors that are easy to make manually:
+>
+> - `shasum -a 512 path/to/file` writes the path into the checksum file. If
+>   the file is later renamed (RC → final), `shasum -c` fails. The script
+>   always runs `shasum` from the file's own directory so the checksum line
+>   contains a bare filename.
+> - Detached PGP signatures verify the tarball **contents**, not the
+>   filename. RC → final promotion only needs to copy the `.asc`; no
+>   re-signing is required. The `--finalize` mode below relies on this.
+
+### Staging the artifacts
+
+```sh
+cd ~/asf/dev-superset
+mkdir kubernetes-operator-${VERSION}-rc${RC}
+cp /path/to/dist/apache-superset-kubernetes-operator-${VERSION}-rc${RC}-source.tar.gz{,.asc,.sha512} \
+   kubernetes-operator-${VERSION}-rc${RC}/
+svn add kubernetes-operator-${VERSION}-rc${RC}
+svn commit -m "Stage Superset Kubernetes Operator ${VERSION}-rc${RC}"
+```
+
+After the commit lands, the artifacts appear at
+`https://dist.apache.org/repos/dist/dev/superset/kubernetes-operator-<version>-rc<n>/`.
+
+### Vote email template
+
+Send the vote thread to `dev@superset.apache.org` with `[VOTE]` in the
+subject. The thread must stay open for **at least 72 hours** and pass with at
+least three `+1` votes from PMC members and no `-1` votes (per
+[ASF voting rules](https://www.apache.org/foundation/voting.html#ReleaseVotes)).
+
+```text
+Subject: [VOTE] Release Apache Superset Kubernetes Operator <version>-rc<n>
+
+Hello,
+
+This is a vote to release Apache Superset Kubernetes Operator <version> based
+on candidate rc<n>.
+
+The release candidate artifacts are staged at:
+  https://dist.apache.org/repos/dist/dev/superset/kubernetes-operator-<version>-rc<n>/
+
+The git tag is:
+  https://github.com/apache/superset-kubernetes-operator/releases/tag/v<version>-rc<n>
+
+PGP keys used for signing are listed in:
+  https://dist.apache.org/repos/dist/release/superset/KEYS
+
+To verify the candidate (Go 1.26+, Helm, and Apache Rat must be installed
+locally; `make` will fetch additional Go modules and tools on first use):
+
+  curl -O https://dist.apache.org/repos/dist/dev/superset/kubernetes-operator-<version>-rc<n>/apache-superset-kubernetes-operator-<version>-rc<n>-source.tar.gz{,.asc,.sha512}
+  curl -O https://dist.apache.org/repos/dist/release/superset/KEYS
+  gpg --import KEYS
+  gpg --verify apache-superset-kubernetes-operator-<version>-rc<n>-source.tar.gz{.asc,}
+  shasum -a 512 -c apache-superset-kubernetes-operator-<version>-rc<n>-source.tar.gz.sha512
+  tar -xzf apache-superset-kubernetes-operator-<version>-rc<n>-source.tar.gz
+  cd apache-superset-kubernetes-operator-<version>/
+  make test-unit helm-lint check-license
+
+Notable changes are documented in:
+  https://github.com/apache/superset-kubernetes-operator/blob/v<version>-rc<n>/CHANGELOG.md
+
+The vote will be open for at least 72 hours.
+
+[ ] +1 release this package
+[ ]  0 no opinion
+[ ] -1 do not release this package because ...
+
+Thanks,
+<release manager>
+```
+
+After the vote thread closes, post a `[RESULT][VOTE]` summary to the same list
+with the tally and the binding/non-binding breakdown.
 
 ## Finalizing a Release
 
@@ -148,3 +305,30 @@ git push origin v0.2.0
 ```
 
 The release workflow pushes the `0.2.0` and `latest` images to GHCR.
+
+After the binary release workflow finishes, promote the source artifacts.
+`release-source.sh --finalize` reuses the staged RC tarball bytes (so the
+detached signature stays valid) and regenerates the SHA-512 file under the
+final filename:
+
+```sh
+scripts/release-source.sh 0.2.0 --finalize \
+  --rc-dir ~/asf/dev-superset/kubernetes-operator-0.2.0-rc${RC}
+# → dist/apache-superset-kubernetes-operator-0.2.0-source.tar.gz{,.asc,.sha512}
+
+cd ~/asf/release-superset
+mkdir kubernetes-operator-0.2.0
+cp /path/to/dist/apache-superset-kubernetes-operator-0.2.0-source.tar.gz{,.asc,.sha512} \
+   kubernetes-operator-0.2.0/
+svn add kubernetes-operator-0.2.0
+svn commit -m "Release Apache Superset Kubernetes Operator 0.2.0"
+
+# Clean up the dev/ staging area (and any earlier RCs).
+cd ~/asf/dev-superset
+svn rm kubernetes-operator-0.2.0-rc*
+svn commit -m "Clean up Superset Kubernetes Operator 0.2.0 release candidates"
+```
+
+The release announcement should go to `announce@apache.org` and
+`dev@superset.apache.org` after the artifacts have propagated to the ASF
+mirror network (typically within 24 hours).
diff --git a/docs/reference/api-reference.md b/docs/reference/api-reference.md
index d8becc4..ff1c8c4 100644
--- a/docs/reference/api-reference.md
+++ b/docs/reference/api-reference.md
@@ -512,6 +512,7 @@ _Appears in:_
 | --- | --- | --- | --- |
 | `tag` _string_ | Override the image tag for this component; inherits from spec.image.tag if omitted. |  | Optional: \{\} <br /> |
 | `repository` _string_ | Override the image repository for this component; inherits from spec.image.repository if omitted. |  | Optional: \{\} <br /> |
+| `pullPolicy` _[PullPolicy](https://pkg.go.dev/k8s.io/api/core/v1#PullPolicy)_ | Override the image pull policy for this component; inherits from spec.image.pullPolicy if omitted. |  | Enum: [Always IfNotPresent Never] <br />Optional: \{\} <br /> |
 
 
 #### ImageSpec
diff --git a/docs/reference/security.md b/docs/reference/security.md
index 27755f4..af1712c 100644
--- a/docs/reference/security.md
+++ b/docs/reference/security.md
@@ -71,18 +71,23 @@ accordingly.
 
 ## Security Model
 
-### Prod vs Dev Mode
-
-The operator enforces a strict separation between production and development
-modes:
-
-- **Prod mode** (default): Inline `secretKey`, `metastore.uri`,
-  `metastore.password`, and `valkey.password` are rejected by CRD CEL validation
-  rules. Users reference secrets via `secretKeyFrom`, `metastore.uriFrom`,
-  `metastore.passwordFrom`, or `valkey.passwordFrom` (which the operator wires
-  as `valueFrom.secretKeyRef` env vars).
-- **Dev mode** (`environment: Development`): Inline secrets are allowed for local
-  development convenience. Additionally, `lifecycle.init.adminUser` and
+### Production/Staging vs Development Mode
+
+The operator enforces a strict separation between hardened modes (Production
+and Staging) and Development:
+
+- **Production/Staging** (`environment: Production` is the default; `Staging`
+  keeps the same secret rules but allows the destructive `clone` task):
+  Inline `secretKey`, `previousSecretKey`, `metastore.uri`,
+  `metastore.password`, `valkey.password`, websocket `config`, and
+  `lifecycle.clone.source.password` are rejected by CRD CEL validation rules.
+  Users reference secrets via `secretKeyFrom`, `previousSecretKeyFrom`,
+  `metastore.uriFrom`, `metastore.passwordFrom`, `valkey.passwordFrom`,
+  websocket `configFrom`, and `lifecycle.clone.source.passwordFrom` — the
+  operator wires each of these as `valueFrom.secretKeyRef` env vars (or, for
+  websocket `configFrom`, mounts the referenced Secret key as a file).
+- **Development** (`environment: Development`): Inline secrets are allowed for
+  local development convenience. Additionally, `lifecycle.init.adminUser` and
   `lifecycle.init.loadExamples` are permitted — these create a default admin account and
   load sample data during initialization. Admin credentials from `adminUser`
   are stored as plain-text environment variables on the parent Superset CR and
@@ -90,9 +95,9 @@ modes:
   resources in the namespace). The admin password also appears in the Pod's
   process arguments via shell expansion.
 
-Dev mode is intentionally less secure. It exists for local development with Kind
-or Minikube where secret management infrastructure is not available. This is not
-a vulnerability — it is a documented design decision.
+Development mode is intentionally less secure. It exists for local development
+with Kind or Minikube where secret management infrastructure is not available.
+This is not a vulnerability — it is a documented design decision.
 
 ### Secret Handling
 
@@ -100,11 +105,13 @@ In Staging and Production modes, secrets follow this path:
 
 1. User creates a Kubernetes `Secret` containing the secret key and database
    credentials
-2. User references the Secret via `secretKeyFrom`, `metastore.uriFrom`,
-   `metastore.passwordFrom`, or `valkey.passwordFrom` on the Superset CR. The
-   operator injects the corresponding env vars with `valueFrom.secretKeyRef` —
-   the actual secret value is resolved by the kubelet at pod startup, not by
-   the operator.
+2. User references the Secret via `secretKeyFrom`, `previousSecretKeyFrom`,
+   `metastore.uriFrom`, `metastore.passwordFrom`, `valkey.passwordFrom`,
+   `lifecycle.clone.source.passwordFrom`, or `websocketServer.configFrom` on
+   the Superset CR. For env-var references the operator injects
+   `valueFrom.secretKeyRef`; for `websocketServer.configFrom` the operator
+   mounts the referenced Secret key as a file. In every case the secret value
+   is resolved by the kubelet at pod startup, not by the operator.
 3. The operator generates `superset_config.py` that renders
    `SECRET_KEY = os.environ['SUPERSET_OPERATOR__SECRET_KEY']` — the actual
    secret value is resolved at Python runtime from the env var, so it never
@@ -121,12 +128,13 @@ may appear in status. This only applies to the task container's own output, not
 to operator-managed secret references.
 
 **Scope of this guarantee:** The above applies to operator-managed secret
-references (`secretKeyFrom`, `metastore.uriFrom`, `metastore.passwordFrom`,
-`valkey.passwordFrom`). User-authored fields — raw Python in `spec.config`,
-component-level `config`, and `podTemplate.container.env` — are trusted input
-and may contain arbitrary values including secrets. Users with read access to
-Superset CRs or the generated ConfigMaps will see any values placed in these
-fields. These are out
+references (`secretKeyFrom`, `previousSecretKeyFrom`, `metastore.uriFrom`,
+`metastore.passwordFrom`, `valkey.passwordFrom`,
+`lifecycle.clone.source.passwordFrom`, and `websocketServer.configFrom`).
+User-authored fields — raw Python in `spec.config`, component-level `config`,
+and `podTemplate.container.env` — are trusted input and may contain arbitrary
+values including secrets. Users with read access to Superset CRs or the
+generated ConfigMaps will see any values placed in these fields. These are out
 of scope for the operator's secret handling guarantees
 (see [What Is Generally Out of Scope](#what-is-generally-out-of-scope)).
 
@@ -161,11 +169,23 @@ Key rules:
 - **Mutual exclusivity:** `secretKey`/`secretKeyFrom`, metastore URI vs
   structured fields, Valkey password inline vs Secret reference, websocket
   `config`/`configFrom`, gateway vs ingress
-- **Networking requires webServer:** Routes target the web server service
+- **Ingress requires webServer:** `spec.networking.ingress` rules target the
+  web server service, so a CR cannot enable Ingress without `webServer`
+- **Gateway requires at least one routable component:** `spec.networking.gateway`
+  routes to whichever of `webServer`, `websocketServer`, `mcpServer`, and
+  `celeryFlower` are configured; a CR with only Beat and Worker cannot enable
+  Gateway
 - **Monitoring requires webServer:** ServiceMonitor scrapes the web server service
 - **Defaulting:** `environment` defaults to `Production`, image repository and pull
   policy default via kubebuilder markers
 
+CEL is the operator's built-in validation layer. Cluster operators who want
+defense-in-depth — for example, restricting which `image.repository` values are
+allowed, forbidding `environment: Development` outside specific namespaces, or
+requiring particular labels on every Superset CR — can layer a policy engine
+such as Kyverno, OPA Gatekeeper, or the Validating Admission Policy API on top
+of these CRD-level rules.
+
 ## Design Decisions
 
 The following design choices are intentional and documented here to avoid
@@ -269,15 +289,21 @@ The operator does **not** request:
 
 The operator supports two install modes, selectable at deploy time:
 
-- **Cluster-scoped (default).** The manager ServiceAccount is bound to a
-  `ClusterRole` via a `ClusterRoleBinding`, and the cache watches every
-  namespace. Appropriate when a cluster admin administers the operator
-  centrally. Helm: `watch.scope: cluster`.
+- **Cluster-scoped (default).** The manager ServiceAccount is bound to the
+  generated `ClusterRole` (`manager-role`) via a `ClusterRoleBinding`
+  (`manager-rolebinding`), and the cache watches every namespace. Appropriate
+  when a cluster admin administers the operator centrally. Helm:
+  `watch.scope: cluster`.
 - **Namespace-scoped.** The manager watches only the namespaces listed in
   `WATCH_NAMESPACE` (comma-separated). Appropriate for restricted clusters
   that forbid `ClusterRole` creation, or for single-tenant installs that
   want a tighter blast radius.
 
+Leader election is namespace-scoped in both modes: the operator binds the
+namespace-local `Role` `leader-election-role` to the manager ServiceAccount via
+the `RoleBinding` `leader-election-rolebinding` in the operator's own
+namespace, and the lease/lock objects live there too.
+
 The RBAC shape differs between Helm and Kustomize for namespace-scoped
 installs:
 
@@ -331,6 +357,33 @@ configures via `podTemplate.podSecurityContext` and
 shows recommended settings. Workload pod security is the user's responsibility
 (see [What Is Generally Out of Scope](#what-is-generally-out-of-scope)).
 
+**Recommendation — Pod Security Admission:** The operator manager Pod is
+configured to satisfy the `restricted` Pod Security Standard (non-root,
+read-only root filesystem, all capabilities dropped, `seccompProfile:
+RuntimeDefault`, `allowPrivilegeEscalation: false`). For defense in depth,
+label the operator's namespace with
+`pod-security.kubernetes.io/enforce: restricted` so the apiserver rejects any
+Pod that drifts from this baseline.
+
+## Supply Chain
+
+The release pipeline produces signed multi-architecture artifacts:
+
+- **Base image:** [`gcr.io/distroless/static:nonroot`](https://github.com/GoogleContainerTools/distroless)
+  — no shell, no package manager, no unnecessary binaries. The Dockerfile
+  pins the digest and Renovate keeps it current.
+- **Architectures:** `linux/amd64` and `linux/arm64` are built and signed
+  identically.
+- **Image signatures:** The release workflow signs the manager image and the
+  packaged Helm chart with [Cosign](https://github.com/sigstore/cosign) using
+  GitHub Actions OIDC (keyless). Verify with
+  `cosign verify ghcr.io/apache/superset-kubernetes-operator@<digest>`.
+- **Dependency policy:** Go modules and GitHub Actions are kept current via
+  [Renovate](https://docs.renovatebot.com/) with a 7-day minimum age and
+  pinned action versions.
+- **Future work:** SBOM and SLSA build provenance generation are tracked as
+  enhancements for later releases.
+
 ## What Is Generally Out of Scope
 
 The following areas are usually outside this project's security scope. Reports
diff --git a/docs/user-guide/migration.md b/docs/user-guide/migration.md
index 7713d86..05da69d 100644
--- a/docs/user-guide/migration.md
+++ b/docs/user-guide/migration.md
@@ -23,6 +23,12 @@ This guide helps translate a deployment from the official Apache Superset Helm
 chart to a `Superset` custom resource. It focuses on feature parity and on the
 places where the operator intentionally uses a different model.
 
+> **Comparison target:** This guide is written against the upstream
+> [`apache/superset` Helm chart](https://github.com/apache/superset/tree/master/helm/superset)
+> at chart version `0.15.5` / `appVersion: 5.0.0`. Older Helm releases share
+> the same field names, but a few values (notably `featureFlags` and
+> `supersetWebsockets`) only exist in recent chart versions.
+
 The operator covers the chart's core application features: web server, Celery
 workers, Celery Beat, Celery Flower, websocket server, database migration,
 application initialization, Python configuration, env vars, services, ingress,
@@ -40,7 +46,9 @@ The main differences are deliberate:
   Helm hook Job. This gives the operator status, retries, upgrade gating, and
   maintenance-page support.
 - Gateway API is the preferred way to route multiple Superset services. The
-  built-in Ingress reconciler targets the web server service only.
+  built-in Ingress reconciler targets the web server service only — see
+  [Known Parity Gaps](#known-parity-gaps) for the implications when the
+  Helm chart's websocket Ingress path was in use.
 
 ## Migration Workflow
 
@@ -108,11 +116,11 @@ The main differences are deliberate:
 |---|---|---|
 | `nameOverride`, `fullnameOverride` | `metadata.name` | The operator derives workload names from the CR name. Generated names are not independently overridden. |
 | `extraLabels` | Resource-specific labels | Use `podTemplate.labels`, component `service.labels`, `networking.ingress.labels`, or `networking.gateway.labels`. There is no single global label field for every generated object. |
-| `image.repository`, `image.tag`, `image.pullPolicy` | `spec.image.repository`, `spec.image.tag`, `spec.image.pullPolicy` | Per-component image overrides are available under each component's `image` field. |
+| `image.repository`, `image.tag`, `image.pullPolicy` | `spec.image.repository`, `spec.image.tag`, `spec.image.pullPolicy` | Per-component image overrides — including `pullPolicy` — are available under each component's `image` field; unset fields inherit from `spec.image`. |
 | `imagePullSecrets` | `spec.image.pullSecrets` | Applied to all component pods. |
 | `runAsUser` | `spec.podTemplate.podSecurityContext.runAsUser` | Prefer a full pod or container security context for production hardening. |
-| `serviceAccountName`, `serviceAccount.create`, `serviceAccount.annotations` | `spec.serviceAccount.name`, `spec.serviceAccount.create`, `spec.serviceAccount.annotations` | The operator can create or reference a ServiceAccount. |
-| `bootstrapScript` | Custom image, init container, or command override | The operator does not generate a bootstrap script. Build dependencies into the image when possible. |
+| `serviceAccountName`, `serviceAccount.create`, `serviceAccount.annotations` | `spec.serviceAccount.name`, `spec.serviceAccount.create`, `spec.serviceAccount.annotations` | The operator can create or reference a ServiceAccount. With `create: false` you must set `name` to an existing ServiceAccount in the namespace; the operator does not silently fall back to `default`. |
+| `bootstrapScript` | Custom image, `podTemplate.initContainers`, or component `command` override | The operator does not render an arbitrary script into a ConfigMap and execute it. Bake extra Python dependencies into a custom image, or run an init container that prepares a shared volume. |
 | `forceReload` on chart components | `spec.forceReload` | Operator `forceReload` is global. For component-only restarts, change a component pod annotation. |
 
 ### Secrets, Env Vars, and Config Files
@@ -177,6 +185,8 @@ default DB and key prefix. To preserve Helm-like sharing, set the relevant
 | Component `podSecurityContext`, `containerSecurityContext` | Component `podTemplate.podSecurityContext`, `podTemplate.container.securityContext` | Can also be set top-level. |
 | Component `extraContainers` | Component `podTemplate.sidecars` | Sidecars merge by container name. |
 | Component `initContainers` | Component `podTemplate.initContainers` | Init containers merge by container name. |
+| Default `wait-for-postgres` / `wait-for-postgres-redis` initContainers | Component `podTemplate.initContainers` | The chart injects `dockerize` initContainers that wait for the metastore and Redis before each component starts. The operator does not inject these because the metastore lifecycle and `migrate` task gate component startup independently. If you rely on this behavior — for example, on environments where the database may briefly be unavailable — re-add the same `dockerize` ini [...]
+| `automountServiceAccountToken` | Not surfaced on `podTemplate` | The operator inherits the Kubernetes default (`true`). If your policy disables SA token auto-mount, configure it on the referenced ServiceAccount via `spec.serviceAccount.create: false` plus `spec.serviceAccount.name` pointing at a ServiceAccount you manage. |
 
 ### Services and Networking
 
@@ -235,6 +245,43 @@ spec:
 | Component `podDisruptionBudget.*` | Component `podDisruptionBudget` | Supported for web server, Celery worker, Flower, websocket server, and MCP server. |
 | `supersetCeleryBeat.podDisruptionBudget.*` | No direct equivalent | Celery Beat is a singleton in the operator and currently has no PDB field. |
 
+## Known Parity Gaps
+
+The operator covers the chart's commonly used features. The items below have
+no direct equivalent today; each lists the recommended workaround:
+
+- **Built-in Ingress for the websocket service.** The Helm chart's
+  `supersetWebsockets.ingress` injects a `/ws` rule into the same Ingress as
+  the web server. The operator's `spec.networking.ingress` reconciler targets
+  the web server service only. On clusters with Gateway API, use
+  `spec.networking.gateway` — the operator routes web, websocket, Flower, and
+  MCP backends from a single `HTTPRoute`. On clusters without Gateway API,
+  create a separate Ingress that points at the
+  `<supersetName>-websocket-server` Service. See
+  [Websocket Routing](#websocket-routing) for an example.
+- **Celery Beat PDB.** The chart exposes `supersetCeleryBeat.podDisruptionBudget`.
+  The operator pins Beat to a single replica and does not surface a PDB field;
+  a PDB on a 1-replica workload is advisory only. If Beat downtime during
+  voluntary disruptions is unacceptable, use `priorityClassName` and node
+  affinity to influence scheduling instead.
+- **Deployment-level `labels` and `annotations`.** The chart exposes
+  `deploymentLabels` and `deploymentAnnotations` per component. The operator
+  surfaces pod, service, and route metadata, but not Deployment-object
+  metadata. If you need Deployment annotations (for example, to drive a
+  third-party controller), apply them with a cluster policy mutator
+  (Kyverno/OPA) or `kubectl annotate` until the operator grows a
+  `deploymentTemplate.labels`/`annotations` field.
+- **`automountServiceAccountToken`.** Not surfaced on `podTemplate`; configure
+  on a managed ServiceAccount instead (see the row in
+  [Pod and Deployment Customization](#pod-and-deployment-customization)).
+- **`bootstrapScript`.** No managed equivalent; use a custom image or an init
+  container (see the row in [Global Settings](#global-settings)).
+- **Bundled PostgreSQL and Redis subcharts.** Intentional — the operator does
+  not provision external dependencies. Use a managed database service,
+  CloudNativePG, or a Redis/Valkey operator.
+- **`loadBalancerIP`.** Intentional — the Kubernetes field is deprecated. Use
+  cloud-provider Service annotations to influence load-balancer placement.
+
 ## Example Translation
 
 Helm values:
diff --git a/internal/controller/config_builder.go b/internal/controller/config_builder.go
index a72162b..eb2b9bc 100644
--- a/internal/controller/config_builder.go
+++ b/internal/controller/config_builder.go
@@ -408,6 +408,9 @@ func flatSpecFromResolution(flat *resolution.FlatSpec, parentImage *supersetv1al
 		if imageOverride.Repository != nil {
 			image.Repository = *imageOverride.Repository
 		}
+		if imageOverride.PullPolicy != nil {
+			image.PullPolicy = *imageOverride.PullPolicy
+		}
 	}
 	return supersetv1alpha1.FlatComponentSpec{
 		Image:               image,
diff --git a/internal/controller/config_test.go b/internal/controller/config_test.go
index e852491..5eb532b 100644
--- a/internal/controller/config_test.go
+++ b/internal/controller/config_test.go
@@ -383,6 +383,37 @@ func TestFlatSpecFromResolution_ImageOverride(t *testing.T) {
 			t.Errorf("expected parent repository preserved, got %s", result.Image.Repository)
 		}
 	})
+
+	t.Run("pull policy override", func(t *testing.T) {
+		imageWithPolicy := &supersetv1alpha1.ImageSpec{
+			Repository: "apache/superset",
+			Tag:        "4.0.0",
+			PullPolicy: corev1.PullIfNotPresent,
+		}
+		always := corev1.PullAlways
+		override := &supersetv1alpha1.ImageOverrideSpec{PullPolicy: &always}
+		result := flatSpecFromResolution(flat, imageWithPolicy, override, "")
+		if result.Image.PullPolicy != corev1.PullAlways {
+			t.Errorf("expected component override PullAlways, got %s", result.Image.PullPolicy)
+		}
+		// Repository and Tag should still inherit from parent.
+		if result.Image.Repository != "apache/superset" || result.Image.Tag != "4.0.0" {
+			t.Errorf("expected parent repo/tag preserved, got %s:%s", result.Image.Repository, result.Image.Tag)
+		}
+	})
+
+	t.Run("pull policy inherits when override unset", func(t *testing.T) {
+		imageWithPolicy := &supersetv1alpha1.ImageSpec{
+			Repository: "apache/superset",
+			Tag:        "4.0.0",
+			PullPolicy: corev1.PullIfNotPresent,
+		}
+		override := &supersetv1alpha1.ImageOverrideSpec{Tag: common.Ptr("custom-tag")}
+		result := flatSpecFromResolution(flat, imageWithPolicy, override, "")
+		if result.Image.PullPolicy != corev1.PullIfNotPresent {
+			t.Errorf("expected parent PullIfNotPresent preserved, got %s", result.Image.PullPolicy)
+		}
+	})
 }
 
 func TestCollectSecretEnvVars_FromFields(t *testing.T) {
diff --git a/scripts/release-rc.sh b/scripts/release-rc.sh
index b9189c5..560ff94 100755
--- a/scripts/release-rc.sh
+++ b/scripts/release-rc.sh
@@ -37,6 +37,14 @@ die()  { echo -e "${RED}error:${RESET} $*" >&2; exit 1; }
 info() { echo -e "${GREEN}==>${RESET} $*"; }
 warn() { echo -e "${YELLOW}warning:${RESET} $*"; }
 
+# Cross-platform in-place sed. BSD sed (macOS) requires `-i ''`; GNU sed (Linux)
+# rejects an empty string after `-i`. Detect once and dispatch.
+if sed --version >/dev/null 2>&1; then
+  sed_inplace() { sed -i "$@"; }
+else
+  sed_inplace() { sed -i '' "$@"; }
+fi
+
 # --- parse args ---
 VERSION=""
 CHART_VERSION=""
@@ -96,23 +104,35 @@ info "Preparing ${TAG}"
 CURRENT_VERSION=$(grep -E '^VERSION \?=' Makefile | head -1 | awk '{print $3}')
 if [[ "$CURRENT_VERSION" != "$VERSION" ]]; then
   info "Updating Makefile VERSION: ${CURRENT_VERSION} → ${VERSION}"
-  sed -i '' "s/^VERSION ?= .*/VERSION ?= ${VERSION}/" Makefile
+  sed_inplace "s/^VERSION ?= .*/VERSION ?= ${VERSION}/" Makefile
 else
   info "Makefile VERSION already set to ${VERSION}"
 fi
 
-# --- optionally bump chart version ---
-if [[ -n "$CHART_VERSION" ]]; then
-  info "Updating Chart.yaml version: → ${CHART_VERSION}"
-  sed -i '' "s/^version: .*/version: ${CHART_VERSION}/" charts/superset-operator/Chart.yaml
+# --- bump chart version ---
+# Default to the operator version when not explicitly overridden, so the source
+# release archive does not capture a stale "0.0.0-dev" Chart.yaml.
+: "${CHART_VERSION:=${VERSION}}"
+CURRENT_CHART_VERSION=$(grep -E '^version:' charts/superset-operator/Chart.yaml | head -1 | awk '{print $2}')
+if [[ "$CURRENT_CHART_VERSION" != "$CHART_VERSION" ]]; then
+  info "Updating Chart.yaml version: ${CURRENT_CHART_VERSION} → ${CHART_VERSION}"
+  sed_inplace "s/^version: .*/version: ${CHART_VERSION}/" charts/superset-operator/Chart.yaml
+else
+  info "Chart.yaml version already set to ${CHART_VERSION}"
 fi
 
-# --- regenerate manifests ---
-info "Regenerating manifests and code"
-make manifests generate
+# --- regenerate generated artifacts ---
+info "Regenerating generated artifacts (manifests, deepcopy, helm CRDs, API docs, supported-versions, make-commands)"
+make codegen
 
 # --- run checks ---
-info "Running tests"
+info "Verifying Apache license headers"
+make check-license
+
+info "Running golangci-lint"
+make lint
+
+info "Running unit and integration tests"
 make test-unit test-integration
 
 info "Linting Helm chart"
diff --git a/scripts/release-source.sh b/scripts/release-source.sh
new file mode 100755
index 0000000..0be9c17
--- /dev/null
+++ b/scripts/release-source.sh
@@ -0,0 +1,189 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Generate ASF source-release artifacts (tarball, detached signature,
+# SHA-512 checksum) for an operator release candidate or final release.
+#
+# Usage:
+#   scripts/release-source.sh <version> --rc <n>     # produce RC artifacts
+#   scripts/release-source.sh <version> --finalize \
+#       --rc-dir <dir>                                # promote RC → final
+#
+# In RC mode the script:
+#   1. Archives the v<version>-rc<n> git tag into
+#      apache-superset-kubernetes-operator-<version>-rc<n>-source.tar.gz
+#   2. Detached-signs it with the user's default GPG key (override with
+#      --gpg-key <id>)
+#   3. Writes a SHA-512 checksum file with a *bare* filename so verifiers can
+#      run `shasum -a 512 -c <file>.sha512` after a plain download.
+#
+# In --finalize mode the script:
+#   1. Re-derives the final filenames from the RC-staged artifacts in
+#      <rc-dir>: copies the tarball + .asc (detached signatures verify file
+#      contents, not the filename, so the same signature stays valid) and
+#      regenerates the .sha512 file (since shasum embeds the filename).
+#   2. Verifies the result before exiting.
+#
+# Run from the repository root.
+
+set -euo pipefail
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[0;33m'
+BOLD='\033[1m'
+RESET='\033[0m'
+
+die()  { echo -e "${RED}error:${RESET} $*" >&2; exit 1; }
+info() { echo -e "${GREEN}==>${RESET} $*"; }
+warn() { echo -e "${YELLOW}warning:${RESET} $*"; }
+
+usage() {
+  cat <<EOF
+Usage:
+  $0 <version> --rc <n> [--gpg-key <id>] [--out-dir <dir>]
+  $0 <version> --finalize --rc-dir <dir> [--gpg-key <id>] [--out-dir <dir>]
+
+Options:
+  --rc <n>          Build artifacts for v<version>-rc<n>.
+  --finalize        Promote RC artifacts in --rc-dir to final filenames.
+  --rc-dir <dir>    Directory containing the staged RC artifacts.
+  --gpg-key <id>    GPG key id/fingerprint for the .asc signature.
+                    Required for --finalize when re-signing is needed; in RC
+                    mode the GPG default is used when this is omitted.
+  --out-dir <dir>   Output directory (default: ./dist).
+EOF
+}
+
+VERSION=""
+RC=""
+MODE=""
+RC_DIR=""
+GPG_KEY=""
+OUT_DIR="dist"
+
+while [[ $# -gt 0 ]]; do
+  case "$1" in
+    --rc)        RC="$2"; MODE="rc"; shift 2 ;;
+    --finalize)  MODE="finalize"; shift ;;
+    --rc-dir)    RC_DIR="$2"; shift 2 ;;
+    --gpg-key)   GPG_KEY="$2"; shift 2 ;;
+    --out-dir)   OUT_DIR="$2"; shift 2 ;;
+    -h|--help)   usage; exit 0 ;;
+    -*)          die "unknown flag: $1" ;;
+    *)           VERSION="$1"; shift ;;
+  esac
+done
+
+[[ -n "$VERSION" ]] || { usage >&2; die "version is required"; }
+[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || die "version must be semver (e.g., 0.2.0), got: $VERSION"
+[[ -n "$MODE" ]] || { usage >&2; die "either --rc <n> or --finalize is required"; }
+
+command -v gpg     >/dev/null 2>&1 || die "gpg is required"
+command -v shasum  >/dev/null 2>&1 || die "shasum is required"
+command -v git     >/dev/null 2>&1 || die "git is required"
+
+mkdir -p "$OUT_DIR"
+PROJECT="apache-superset-kubernetes-operator"
+
+# Compute the SHA-512 with a bare filename inside the file (no path) so
+# downstream `shasum -a 512 -c <file>.sha512` works after a plain download.
+write_sha512() {
+  local file="$1"
+  local dir base
+  dir=$(dirname "$file")
+  base=$(basename "$file")
+  ( cd "$dir" && shasum -a 512 "$base" > "${base}.sha512" )
+}
+
+verify_artifacts() {
+  local dir="$1"
+  local base="$2"
+  info "Verifying ${base}"
+  ( cd "$dir" && shasum -a 512 -c "${base}.sha512" )
+  ( cd "$dir" && gpg --verify "${base}.asc" "${base}" )
+}
+
+case "$MODE" in
+  rc)
+    [[ -n "$RC" ]] || die "--rc requires a number"
+    [[ "$RC" =~ ^[0-9]+$ ]] || die "rc must be a positive integer"
+
+    TAG="v${VERSION}-rc${RC}"
+    BASE="${PROJECT}-${VERSION}-rc${RC}-source.tar.gz"
+    OUT="${OUT_DIR}/${BASE}"
+
+    git rev-parse --verify "${TAG}^{tag}" >/dev/null 2>&1 \
+      || die "git tag ${TAG} does not exist; create it with scripts/release-rc.sh first"
+
+    info "Archiving ${TAG} → ${OUT}"
+    git archive --format=tar.gz \
+      --prefix="${PROJECT}-${VERSION}/" \
+      -o "${OUT}" "${TAG}"
+
+    info "Signing ${BASE}"
+    if [[ -n "$GPG_KEY" ]]; then
+      gpg --armor --local-user "$GPG_KEY" \
+          --output "${OUT}.asc" --detach-sig "${OUT}"
+    else
+      gpg --armor --output "${OUT}.asc" --detach-sig "${OUT}"
+    fi
+
+    info "Computing SHA-512"
+    write_sha512 "${OUT}"
+
+    verify_artifacts "${OUT_DIR}" "${BASE}"
+
+    echo ""
+    echo -e "${BOLD}Source artifacts ready in ${OUT_DIR}/${RESET}"
+    echo "  ${BASE}"
+    echo "  ${BASE}.asc"
+    echo "  ${BASE}.sha512"
+    ;;
+
+  finalize)
+    [[ -n "$RC_DIR" ]] || die "--finalize requires --rc-dir"
+    [[ -d "$RC_DIR" ]] || die "rc directory does not exist: ${RC_DIR}"
+
+    # Locate the RC tarball and derive the final filename from the version arg.
+    RC_TARBALL=$(find "$RC_DIR" -maxdepth 1 -type f \
+                  -name "${PROJECT}-${VERSION}-rc*-source.tar.gz" | head -1)
+    [[ -n "$RC_TARBALL" ]] || die "no RC tarball found in ${RC_DIR}"
+    RC_BASE=$(basename "$RC_TARBALL")
+    [[ -f "${RC_TARBALL}.asc" ]]    || die "missing detached signature: ${RC_BASE}.asc"
+    [[ -f "${RC_TARBALL}.sha512" ]] || die "missing checksum file: ${RC_BASE}.sha512"
+
+    FINAL_BASE="${PROJECT}-${VERSION}-source.tar.gz"
+    FINAL_OUT="${OUT_DIR}/${FINAL_BASE}"
+
+    info "Copying ${RC_BASE} → ${FINAL_BASE} (bytes preserved)"
+    cp "${RC_TARBALL}" "${FINAL_OUT}"
+
+    info "Copying detached signature (signature verifies contents, not filename)"
+    cp "${RC_TARBALL}.asc" "${FINAL_OUT}.asc"
+
+    info "Regenerating SHA-512 for the renamed file"
+    write_sha512 "${FINAL_OUT}"
+
+    verify_artifacts "${OUT_DIR}" "${FINAL_BASE}"
+
+    echo ""
+    echo -e "${BOLD}Final source artifacts ready in ${OUT_DIR}/${RESET}"
+    echo "  ${FINAL_BASE}"
+    echo "  ${FINAL_BASE}.asc"
+    echo "  ${FINAL_BASE}.sha512"
+    ;;
+esac