From 5457830e2b41c4aaa46b1237a1635b71ea3ebd40 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Thu, 14 Dec 2023 17:08:20 +0100 Subject: [PATCH] [refactor] Fixing policy controller manifests generation, bundle and samples --- Makefile | 16 +++++++++++++++- .../kustomization.template.yaml | 13 +++++++++++++ .../samples/kustomization.template.yaml | 3 +++ .../policy-controller/samples/kustomization.yaml | 2 ++ config/manifests/kustomization.yaml | 1 - config/samples/kustomization.yaml | 1 + 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 config/dependencies/policy-controller/kustomization.template.yaml create mode 100644 config/dependencies/policy-controller/samples/kustomization.template.yaml create mode 100644 config/dependencies/policy-controller/samples/kustomization.yaml diff --git a/Makefile b/Makefile index bdb0ab727..7ed902b97 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,18 @@ LIMITADOR_OPERATOR_GITREF = $(LIMITADOR_OPERATOR_BUNDLE_VERSION) endif LIMITADOR_OPERATOR_BUNDLE_IMG ?= quay.io/kuadrant/limitador-operator-bundle:$(LIMITADOR_OPERATOR_BUNDLE_IMG_TAG) +## policy-controller +POLICY_CONTROLLER_VERSION ?= latest +policy_controller_is_semantic := $(call is_semantic_version,$(POLICY_CONTROLLER_VERSION)) +ifeq (latest,$(POLICY_CONTROLLER_VERSION)) +POLICY_CONTROLLER_VERSION = 0.0.0 +POLICY_CONTROLLER_GITREF = main +else ifeq (true,$(policy_controller_is_semantic)) +POLICY_CONTROLLER_GITREF = v$(POLICY_CONTROLLER_VERSION) +else +POLICY_CONTROLLER_GITREF = $(POLICY_CONTROLLER_VERSION) +endif + ## wasm-shim WASM_SHIM_VERSION ?= latest shim_version_is_semantic := $(call is_semantic_version,$(WASM_SHIM_VERSION)) @@ -251,9 +263,11 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust .PHONY: dependencies-manifests dependencies-manifests: export AUTHORINO_OPERATOR_GITREF := $(AUTHORINO_OPERATOR_GITREF) dependencies-manifests: export LIMITADOR_OPERATOR_GITREF := $(LIMITADOR_OPERATOR_GITREF) +dependencies-manifests: export POLICY_CONTROLLER_GITREF := $(POLICY_CONTROLLER_GITREF) dependencies-manifests: ## Update kuadrant dependencies manifests. $(call patch-dependencies-config,authorino,config/dependencies/authorino/kustomization.template.yaml,config/dependencies/authorino/kustomization.yaml) $(call patch-dependencies-config,limitador,config/dependencies/limitador/kustomization.template.yaml,config/dependencies/limitador/kustomization.yaml) + $(call patch-dependencies-config,policy-controller,config/dependencies/policy-controller/kustomization.template.yaml,config/dependencies/policy-controller/kustomization.yaml) .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. @@ -432,7 +446,7 @@ rm -rf $$TMP_DIR ;\ endef .PHONY: bundle -bundle: $(OPM) $(YQ) manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. +bundle: $(OPM) $(YQ) manifests dependencies-manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. $(OPERATOR_SDK) generate kustomize manifests -q # Set desired operator image and related wasm shim image V="$(RELATED_IMAGE_WASMSHIM)" \ diff --git a/config/dependencies/policy-controller/kustomization.template.yaml b/config/dependencies/policy-controller/kustomization.template.yaml new file mode 100644 index 000000000..1d9e62f85 --- /dev/null +++ b/config/dependencies/policy-controller/kustomization.template.yaml @@ -0,0 +1,13 @@ +resources: +- github.com/Kuadrant/multicluster-gateway-controller/config/policy-controller/default?ref=${POLICY_CONTROLLER_GITREF} + +patchesStrategicMerge: +- delete-ns.yaml + +patches: +- patch: |- + - op: add + path: /spec/template/spec/containers/0/args/- + value: --ocm-hub=false + target: + kind: Deployment diff --git a/config/dependencies/policy-controller/samples/kustomization.template.yaml b/config/dependencies/policy-controller/samples/kustomization.template.yaml new file mode 100644 index 000000000..9f77aa4d5 --- /dev/null +++ b/config/dependencies/policy-controller/samples/kustomization.template.yaml @@ -0,0 +1,3 @@ +resources: +- github.com/Kuadrant/multicluster-gateway-controller/config/samples?ref=${POLICY_CONTROLLER_GITREF} + diff --git a/config/dependencies/policy-controller/samples/kustomization.yaml b/config/dependencies/policy-controller/samples/kustomization.yaml new file mode 100644 index 000000000..d02877fc8 --- /dev/null +++ b/config/dependencies/policy-controller/samples/kustomization.yaml @@ -0,0 +1,2 @@ +resources: +- github.com/Kuadrant/multicluster-gateway-controller/config/samples?ref=main diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml index 82148c68f..9356eeda7 100644 --- a/config/manifests/kustomization.yaml +++ b/config/manifests/kustomization.yaml @@ -4,7 +4,6 @@ resources: - bases/kuadrant-operator.clusterserviceversion.yaml - ../default - ../samples -- github.com/Kuadrant/multicluster-gateway-controller/config/samples - ../scorecard # [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix. diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 5202a04c9..3a0b01be5 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -3,4 +3,5 @@ resources: - kuadrant_v1beta1_kuadrant.yaml - kuadrant_v1beta2_authpolicy.yaml - kuadrant_v1beta2_ratelimitpolicy.yaml +- ../dependencies/policy-controller/samples #+kubebuilder:scaffold:manifestskustomizesamples