Skip to content

Commit 3e9f0f8

Browse files
committed
adjust makefile and tiltfile for crd treatment
1 parent 3983e4d commit 3e9f0f8

3 files changed

Lines changed: 6397 additions & 23 deletions

File tree

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ compile-chart: version crds config
3232

3333
chart-clean:
3434
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
35-
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
3635

3736
version:
3837
cat "deploy/helm/${OPERATOR_NAME}/Chart.yaml" | yq ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" > "deploy/helm/${OPERATOR_NAME}/Chart.yaml.new"
@@ -44,9 +43,11 @@ config:
4443
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
4544
fi
4645

46+
## N.B. diverges from templating for operators that have CRD-versioning
47+
## implemented. @adwk67: Do *not* let this be overridden with templating!
4748
crds:
48-
mkdir -p deploy/helm/"${OPERATOR_NAME}"/crds
49-
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd | yq eval '.metadata.annotations["helm.sh/resource-policy"]="keep"' - > "deploy/helm/${OPERATOR_NAME}/crds/crds.yaml"
49+
mkdir -p extra
50+
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd > extra/crds.yaml
5051

5152
chart-lint: compile-chart
5253
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

Tiltfile

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ custom_build(
1717
outputs_image_ref_to='result/ref',
1818
)
1919

20-
# Load the latest CRDs from Nix
21-
watch_file('result')
22-
if os.path.exists('result'):
23-
k8s_yaml('result/crds.yaml')
24-
2520
# We need to set the correct image annotation on the operator Deployment to use e.g.
2621
# oci.stackable.tech/sandbox/opa-operator:7y19m3d8clwxlv34v5q2x4p7v536s00g instead of
2722
# oci.stackable.tech/sandbox/opa-operator:0.0.0-dev (which does not exist)
@@ -35,18 +30,14 @@ helm_values = settings.get('helm_values', None)
3530

3631
helm_override_image_repository = 'image.repository=' + registry + '/' + operator_name
3732

38-
# Exclude stale CRDs from Helm chart, and apply the rest
39-
helm_crds, helm_non_crds = filter_yaml(
40-
helm(
41-
'deploy/helm/' + operator_name,
42-
name=operator_name,
43-
namespace="stackable-operators",
44-
set=[
45-
helm_override_image_repository,
46-
],
47-
values=helm_values,
48-
),
49-
api_version = "^apiextensions\\.k8s\\.io/.*$",
50-
kind = "^CustomResourceDefinition$",
51-
)
52-
k8s_yaml(helm_non_crds)
33+
# N.B. diverges from templating for operators that have CRD-versioning
34+
# implemented. @adwk67: Do *not* let this be overridden with templating!
35+
k8s_yaml(helm(
36+
'deploy/helm/' + operator_name,
37+
name=operator_name,
38+
namespace="stackable-operators",
39+
set=[
40+
helm_override_image_repository,
41+
],
42+
values=helm_values,
43+
) )

0 commit comments

Comments
 (0)