Skip to content

Commit f71831c

Browse files
committed
feat(template): Support registry-specific Helm values
1 parent b578baf commit f71831c

2 files changed

Lines changed: 38 additions & 27 deletions

File tree

template/Makefile.j2

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,75 +10,81 @@
1010
.PHONY: build publish
1111

1212
OPERATOR_NAME := {[ operator.name }]
13-
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}") | .version')
13+
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}")
14+
| .version')
1415

1516
OCI_REGISTRY_HOSTNAME := oci.stackable.tech
1617
OCI_REGISTRY_PROJECT_IMAGES := sdp
1718

1819
SHELL=/usr/bin/env bash -euo pipefail
1920

2021
render-readme:
21-
scripts/render_readme.sh
22+
scripts/render_readme.sh
2223

2324
render-docs:
24-
scripts/docs_templating.sh
25+
scripts/docs_templating.sh
2526

2627
## Docker related targets
2728
docker-build:
28-
docker build --force-rm --build-arg VERSION=${VERSION} -t "${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-${ARCH}" -f docker/Dockerfile .
29+
docker build --force-rm --build-arg VERSION=${VERSION} -t
30+
"${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}-${ARCH}" -f docker/Dockerfile .
2931

3032
## Chart related targets
3133
compile-chart: version crds config
3234

3335
chart-clean:
34-
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
35-
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
36+
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
37+
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
3638

3739
version:
38-
cat "deploy/helm/${OPERATOR_NAME}/Chart.yaml" | yq ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" > "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new"
39-
mv "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new" "deploy/helm/${OPERATOR_NAME}/Chart.yaml"
40+
cat "deploy/helm/${OPERATOR_NAME}/Chart.yaml" | yq ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" >
41+
"deploy/helm/${OPERATOR_NAME}/Chart.yaml.new"
42+
mv "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new" "deploy/helm/${OPERATOR_NAME}/Chart.yaml"
4043

4144
config:
42-
if [ -d "deploy/config-spec/" ]; then\
43-
mkdir -p "deploy/helm/${OPERATOR_NAME}/configs";\
44-
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
45-
fi
45+
if [ -d "deploy/config-spec/" ]; then\
46+
mkdir -p "deploy/helm/${OPERATOR_NAME}/configs";\
47+
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
48+
fi
4649

4750
# We generate a crds.yaml, so that the effect of code changes are visible.
4851
# The operator will take care of the CRD rollout itself.
4952
crds:
50-
mkdir -p extra
51-
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml
53+
mkdir -p extra
54+
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml
5255

5356
chart-lint: compile-chart
54-
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint --config deploy/helm/ct.yaml
57+
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint
58+
--config deploy/helm/ct.yaml
5559

5660
clean: chart-clean
57-
cargo clean
58-
docker rmi --force '${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}'
61+
cargo clean
62+
docker rmi --force '${OCI_REGISTRY_HOSTNAME}/${OCI_REGISTRY_PROJECT_IMAGES}/${OPERATOR_NAME}:${VERSION}'
5963

6064
regenerate-charts: chart-clean compile-chart
6165

6266
regenerate-nix:
63-
nix run --extra-experimental-features "nix-command flakes" -f . regenerateNixLockfiles
67+
nix run --extra-experimental-features "nix-command flakes" -f . regenerateNixLockfiles
6468

6569
build: regenerate-charts regenerate-nix docker-build
6670

6771
check-nix:
68-
@which nix || (echo "Error: 'nix' is not installed. Please install it to proceed."; exit 1)
72+
@which nix || (echo "Error: 'nix' is not installed. Please install it to proceed."; exit 1)
6973

7074
check-kubernetes:
71-
@kubectl cluster-info > /dev/null 2>&1 || (echo "Error: Kubernetes is not running or kubectl is not properly configured."; exit 1)
75+
@kubectl cluster-info > /dev/null 2>&1 || (echo "Error: Kubernetes is not running or kubectl is not properly
76+
configured."; exit 1)
7277

7378
run-dev: check-nix check-kubernetes
74-
kubectl apply -f deploy/stackable-operators-ns.yaml
75-
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- up --port {[5430 + operator_index}] --namespace stackable-operators
79+
kubectl apply -f deploy/stackable-operators-ns.yaml
80+
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- up --port {[5430 + operator_index}] --namespace
81+
stackable-operators
7682

7783
stop-dev: check-nix check-kubernetes
78-
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- down
84+
nix run --extra-experimental-features "nix-command flakes" -f. tilt -- down
7985

8086
helm-install:
81-
helm install \
82-
--values deploy/helm/${OPERATOR_NAME}/values.yaml \
83-
--values deploy/helm/${OPERATOR_NAME}/values/$(OCI_REGISTRY_HOSTNAME).yaml \
84-
${OPERATOR_NAME} deploy/helm/${OPERATOR_NAME}
87+
helm install \
88+
--values deploy/helm/${OPERATOR_NAME}/values.yaml \
89+
--values deploy/helm/${OPERATOR_NAME}/values/$(OCI_REGISTRY_HOSTNAME).yaml \
90+
${OPERATOR_NAME} deploy/helm/${OPERATOR_NAME}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
# Values overlay for chart packages published to oci.stackable.tech.
3+
image:
4+
registry: oci.stackable.tech
5+
repository: sdp/airflow-operator

0 commit comments

Comments
 (0)