From 9d8eea55e2cdfb185e63c509b572a0017280d604 Mon Sep 17 00:00:00 2001 From: Casey Davenport Date: Mon, 26 Jan 2026 13:31:20 -0800 Subject: [PATCH] Remove CRDs from tigera-operator helm chart --- Makefile | 13 +++- charts/crd.projectcalico.org.v1/Chart.yaml | 12 ++++ charts/crd.projectcalico.org.v1/README.md | 6 ++ .../templates}/calico | 0 .../operator.tigera.io_apiservers.yaml | 0 .../operator.tigera.io_gatewayapis.yaml | 0 .../operator.tigera.io_goldmanes.yaml | 0 .../operator.tigera.io_imagesets.yaml | 0 .../operator.tigera.io_installations.yaml | 0 ...igera.io_managementclusterconnections.yaml | 0 .../operator.tigera.io_tigerastatuses.yaml | 0 .../operator.tigera.io_whiskers.yaml | 0 charts/crd.projectcalico.org.v1/values.yaml | 0 lib.Makefile | 5 +- manifests/generate.sh | 43 ++++++------- manifests/operator-crds.yaml | 62 +++++++++---------- node/Makefile | 6 +- .../k8st/deploy_resources_on_kind_cluster.sh | 2 + release/internal/utils/utils.go | 3 + release/pkg/manager/calico/manager.go | 18 +++++- 20 files changed, 107 insertions(+), 63 deletions(-) create mode 100644 charts/crd.projectcalico.org.v1/Chart.yaml create mode 100644 charts/crd.projectcalico.org.v1/README.md rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/calico (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_apiservers.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_gatewayapis.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_goldmanes.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_imagesets.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_installations.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_managementclusterconnections.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_tigerastatuses.yaml (100%) rename charts/{tigera-operator/crds => crd.projectcalico.org.v1/templates}/operator.tigera.io_whiskers.yaml (100%) create mode 100644 charts/crd.projectcalico.org.v1/values.yaml diff --git a/Makefile b/Makefile index 1fa06a131e9..423860cfc4c 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ get-operator-crds: var-require-all-OPERATOR_ORGANIZATION-OPERATOR_GIT_REPO-OPERA @echo ============================================================================================================== @echo === Pulling new operator CRDs from $(OPERATOR_ORGANIZATION)/$(OPERATOR_GIT_REPO) branch $(OPERATOR_BRANCH) === @echo ============================================================================================================== - cd ./charts/tigera-operator/crds/ && \ + cd ./charts/crd.projectcalico.org.v1/templates/ && \ for file in operator.tigera.io_*.yaml; do \ echo "downloading $$file from operator repo"; \ curl -fsSL https://raw.githubusercontent.com/$(OPERATOR_ORGANIZATION)/$(OPERATOR_GIT_REPO)/$(OPERATOR_BRANCH)/pkg/crds/operator/$${file} -o $${file}; \ @@ -135,7 +135,9 @@ $(DEP_FILES): go.mod go.sum $(shell find . -name '*.go') Makefile hack/cmd/deps/ CHART_DESTINATION ?= ./bin # Build helm charts. -chart: $(CHART_DESTINATION)/tigera-operator-$(GIT_VERSION).tgz +chart: $(CHART_DESTINATION)/tigera-operator-$(GIT_VERSION).tgz \ + $(CHART_DESTINATION)/crd.projectcalico.org.v1-$(GIT_VERSION).tgz + $(CHART_DESTINATION)/tigera-operator-$(GIT_VERSION).tgz: bin/helm $(shell find ./charts/tigera-operator -type f) mkdir -p $(CHART_DESTINATION) bin/helm package ./charts/tigera-operator \ @@ -143,6 +145,13 @@ $(CHART_DESTINATION)/tigera-operator-$(GIT_VERSION).tgz: bin/helm $(shell find . --version $(GIT_VERSION) \ --app-version $(GIT_VERSION) +$(CHART_DESTINATION)/crd.projectcalico.org.v1-$(GIT_VERSION).tgz: bin/helm $(shell find ./charts/crd.projectcalico.org.v1/ -type f) + mkdir -p $(CHART_DESTINATION) + bin/helm package ./charts/crd.projectcalico.org.v1/ \ + --destination $(CHART_DESTINATION)/ \ + --version $(GIT_VERSION) \ + --app-version $(GIT_VERSION) + # Build all Calico images for the current architecture. image: $(MAKE) -C pod2daemon image IMAGETAG=$(GIT_VERSION) VALIDARCHES=$(ARCH) diff --git a/charts/crd.projectcalico.org.v1/Chart.yaml b/charts/crd.projectcalico.org.v1/Chart.yaml new file mode 100644 index 00000000000..3eaa3b6b154 --- /dev/null +++ b/charts/crd.projectcalico.org.v1/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +name: crd.projectcalico.org.v1 +description: Installs crd.projectcalico.org and operator.tigera.io Custom Resource Definitions (CRDs) +home: https://docs.tigera.io/calico +icon: https://docs.tigera.io/img/calico-logo.png +sources: + - https://github.com/projectcalico/calico/tree/master/charts/crd.projectcalico.org.v1 + - https://github.com/tigera/operator + - https://github.com/projectcalico/calico + +# version will be overridden at chart compilation time via args, but still must exist in chart.yaml +version: v0.0 diff --git a/charts/crd.projectcalico.org.v1/README.md b/charts/crd.projectcalico.org.v1/README.md new file mode 100644 index 00000000000..fbfeb5b3030 --- /dev/null +++ b/charts/crd.projectcalico.org.v1/README.md @@ -0,0 +1,6 @@ +# Calico CRDs + +This chart contains the following Calico Custom Resource Definitions (CRDs), required for the tigera-operator helm chart to function properly: + +- crd.projectalico.org/v1 API group +- operator.tigera.io/v1 API group diff --git a/charts/tigera-operator/crds/calico b/charts/crd.projectcalico.org.v1/templates/calico similarity index 100% rename from charts/tigera-operator/crds/calico rename to charts/crd.projectcalico.org.v1/templates/calico diff --git a/charts/tigera-operator/crds/operator.tigera.io_apiservers.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_apiservers.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_apiservers.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_apiservers.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_gatewayapis.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_gatewayapis.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_gatewayapis.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_gatewayapis.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_goldmanes.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_goldmanes.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_goldmanes.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_goldmanes.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_imagesets.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_imagesets.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_imagesets.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_imagesets.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_installations.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_installations.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_installations.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_installations.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_managementclusterconnections.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_managementclusterconnections.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_managementclusterconnections.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_managementclusterconnections.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_tigerastatuses.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_tigerastatuses.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_tigerastatuses.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_tigerastatuses.yaml diff --git a/charts/tigera-operator/crds/operator.tigera.io_whiskers.yaml b/charts/crd.projectcalico.org.v1/templates/operator.tigera.io_whiskers.yaml similarity index 100% rename from charts/tigera-operator/crds/operator.tigera.io_whiskers.yaml rename to charts/crd.projectcalico.org.v1/templates/operator.tigera.io_whiskers.yaml diff --git a/charts/crd.projectcalico.org.v1/values.yaml b/charts/crd.projectcalico.org.v1/values.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib.Makefile b/lib.Makefile index 7cc305837f4..48b65198e5f 100644 --- a/lib.Makefile +++ b/lib.Makefile @@ -207,7 +207,7 @@ ifeq ($(GIT_USE_SSH),true) endif # Get version from git. We allow setting this manually for the hashrelease process. -# By default, includes commit count and hash (--long). During releases (RELEASE=true), +# By default, includes commit count and hash (--long). During releases (RELEASE=true), # only the tag is used without the commit count suffix. GIT_VERSION ?= $(shell git describe --tags --dirty --always --abbrev=12 --long) ifeq ($(RELEASE),true) @@ -1386,7 +1386,8 @@ $(REPO_ROOT)/.$(KIND_NAME).created: $(KUBECTL) $(KIND) # Wait for controller manager to be running and healthy, then create Calico CRDs. while ! KUBECONFIG=$(KIND_KUBECONFIG) $(KUBECTL) get serviceaccount default; do echo "Waiting for default serviceaccount to be created..."; sleep 2; done - while ! KUBECONFIG=$(KIND_KUBECONFIG) $(KUBECTL) create -f $(REPO_ROOT)/libcalico-go/config/crd; do echo "Waiting for CRDs to be created"; sleep 2; done + while ! KUBECONFIG=$(KIND_KUBECONFIG) $(KUBECTL) create -f $(REPO_ROOT)/charts/crd.projectcalico.org.v1/templates/; do echo "Waiting for operator CRDs to be created"; sleep 2; done + while ! KUBECONFIG=$(KIND_KUBECONFIG) $(KUBECTL) create -f $(REPO_ROOT)/charts/crd.projectcalico.org.v1/templates/calico/; do echo "Waiting for calico CRDs to be created"; sleep 2; done touch $@ kind-cluster-destroy: $(KIND) $(KUBECTL) diff --git a/manifests/generate.sh b/manifests/generate.sh index d75cfdf2cae..fabe1403642 100755 --- a/manifests/generate.sh +++ b/manifests/generate.sh @@ -75,15 +75,15 @@ for FILE in $(ls ../charts/calico/crds); do ${HELM} template ../charts/calico \ --include-crds \ --show-only $FILE \ - --set version=$CALICO_VERSION \ - --set node.registry=$REGISTRY \ - --set calicoctl.registry=$REGISTRY \ - --set typha.registry=$REGISTRY \ - --set cni.registry=$REGISTRY \ - --set kubeControllers.registry=$REGISTRY \ - --set flannelMigration.registry=$REGISTRY \ - --set dikastes.registry=$REGISTRY \ - --set csi-driver.registry=$REGISTRY \ + --set version=$CALICO_VERSION \ + --set node.registry=$REGISTRY \ + --set calicoctl.registry=$REGISTRY \ + --set typha.registry=$REGISTRY \ + --set cni.registry=$REGISTRY \ + --set kubeControllers.registry=$REGISTRY \ + --set flannelMigration.registry=$REGISTRY \ + --set dikastes.registry=$REGISTRY \ + --set csi-driver.registry=$REGISTRY \ -f ../charts/values/calico.yaml >> crds.yaml done @@ -91,22 +91,19 @@ done # Build manifest which includes both Calico and Operator CRDs. ########################################################################## echo "# CustomResourceDefinitions for Calico and Tigera operator" > operator-crds.yaml -for FILE in $(ls ../charts/tigera-operator/crds/*.yaml | xargs -n1 basename); do - ${HELM} -n tigera-operator template \ - --include-crds \ - --show-only $FILE \ - --set version=$CALICO_VERSION \ - ../charts/tigera-operator >> operator-crds.yaml +for FILE in $(ls ../charts/crd.projectcalico.org.v1/templates/*.yaml | xargs -n1 basename); do + ${HELM} template \ + --show-only templates/$FILE \ + --set version=$CALICO_VERSION \ + ../charts/crd.projectcalico.org.v1 >> operator-crds.yaml done -for FILE in $(ls ../charts/calico/crds); do - ${HELM} template ../charts/calico \ - --include-crds \ - --show-only $FILE \ - --set version=$CALICO_VERSION \ - -f ../charts/values/calico.yaml >> operator-crds.yaml +for FILE in $(ls ../charts/crd.projectcalico.org.v1/templates/calico/*.yaml | xargs -n1 basename); do + ${HELM} template \ + --show-only templates/calico/$FILE \ + --set version=$CALICO_VERSION \ + ../charts/crd.projectcalico.org.v1 >> operator-crds.yaml done - ########################################################################## # Build Calico manifests. # @@ -119,7 +116,7 @@ for FILE in $VALUES_FILES; do echo "Generating manifest from charts/values/$FILE" ${HELM} -n kube-system template \ ../charts/calico \ - --set version=$CALICO_VERSION \ + --set version=$CALICO_VERSION \ -f ../charts/values/$FILE > $FILE done diff --git a/manifests/operator-crds.yaml b/manifests/operator-crds.yaml index fc039383a71..94149e60a8b 100644 --- a/manifests/operator-crds.yaml +++ b/manifests/operator-crds.yaml @@ -1,6 +1,6 @@ # CustomResourceDefinitions for Calico and Tigera operator --- -# Source: crds/operator.tigera.io_apiservers.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_apiservers.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -1638,7 +1638,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_gatewayapis.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_gatewayapis.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -7105,7 +7105,7 @@ spec: served: true storage: true --- -# Source: crds/operator.tigera.io_goldmanes.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_goldmanes.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -8627,7 +8627,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_imagesets.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_imagesets.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -8707,7 +8707,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_installations.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_installations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -26557,7 +26557,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_managementclusterconnections.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_managementclusterconnections.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -26915,7 +26915,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_tigerastatuses.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_tigerastatuses.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -27033,7 +27033,7 @@ spec: subresources: status: {} --- -# Source: crds/operator.tigera.io_whiskers.yaml +# Source: crd.projectcalico.org.v1/templates/operator.tigera.io_whiskers.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -28562,7 +28562,7 @@ spec: subresources: status: {} --- -# Source: crds/crd.projectcalico.org_bgpconfigurations.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_bgpconfigurations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -28683,7 +28683,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_bgpfilters.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_bgpfilters.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -28837,7 +28837,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_bgppeers.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_bgppeers.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -28938,7 +28938,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_blockaffinities.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_blockaffinities.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -28987,7 +28987,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_caliconodestatuses.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_caliconodestatuses.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -29151,7 +29151,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_clusterinformations.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_clusterinformations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -29195,7 +29195,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_felixconfigurations.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_felixconfigurations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -30533,7 +30533,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_globalnetworkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_globalnetworkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -30908,7 +30908,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_globalnetworksets.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_globalnetworksets.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -30946,7 +30946,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_hostendpoints.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_hostendpoints.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31011,7 +31011,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_ipamblocks.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_ipamblocks.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31093,7 +31093,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_ipamconfigs.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_ipamconfigs.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31138,7 +31138,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_ipamhandles.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_ipamhandles.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31183,7 +31183,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_ippools.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_ippools.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31256,7 +31256,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_ipreservations.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_ipreservations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31294,7 +31294,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_kubecontrollersconfigurations.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_kubecontrollersconfigurations.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31512,7 +31512,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_networkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_networkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31879,7 +31879,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_networksets.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_networksets.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -31917,7 +31917,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_stagedglobalnetworkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_stagedglobalnetworkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -32294,7 +32294,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_stagedkubernetesnetworkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_stagedkubernetesnetworkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -32542,7 +32542,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_stagednetworkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_stagednetworkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -32911,7 +32911,7 @@ spec: served: true storage: true --- -# Source: crds/crd.projectcalico.org_tiers.yaml +# Source: crd.projectcalico.org.v1/templates/calico/crd.projectcalico.org_tiers.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -32968,7 +32968,7 @@ spec: served: true storage: true --- -# Source: crds/policy.networking.k8s.io_clusternetworkpolicies.yaml +# Source: crd.projectcalico.org.v1/templates/calico/policy.networking.k8s.io_clusternetworkpolicies.yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: diff --git a/node/Makefile b/node/Makefile index 3d3a37a39b3..7efa49fd9fb 100644 --- a/node/Makefile +++ b/node/Makefile @@ -355,9 +355,11 @@ test_image: .calico_test.created $(DOCKER_BUILD) --build-arg ETCD_VERSION=$(ETCD_VERSION) -f calico_test/Dockerfile -t $(TEST_CONTAINER_NAME) calico_test touch $@ -chart: ../bin/tigera-operator-$(GIT_VERSION).tgz +chart: ../bin/tigera-operator-$(GIT_VERSION).tgz ../bin/crd.projectcalico.org.v1-$(GIT_VERSION).tgz ../bin/tigera-operator-$(GIT_VERSION).tgz: make -C ../ bin/tigera-operator-$(GIT_VERSION).tgz +../bin/crd.projectcalico.org.v1-$(GIT_VERSION).tgz: + make -C ../ bin/crd.projectcalico.org.v1-$(GIT_VERSION).tgz # Tag to use for images built for e2e testing. This must match the image tag used in # tests/k8st/infra/calico_versions.yml @@ -442,7 +444,7 @@ k8s-test: $(MAKE) kind-k8st-cleanup .PHONY: kind-k8st-setup -kind-k8st-setup: $(K8ST_IMAGE_TARS) ../bin/tigera-operator-$(GIT_VERSION).tgz kind-cluster-create +kind-k8st-setup: $(K8ST_IMAGE_TARS) ../bin/tigera-operator-$(GIT_VERSION).tgz ../bin/crd.projectcalico.org.v1-$(GIT_VERSION).tgz kind-cluster-create KUBECONFIG=$(KIND_KUBECONFIG) KIND=$(KIND) ARCH=$(ARCH) GIT_VERSION=$(GIT_VERSION) ./tests/k8st/deploy_resources_on_kind_cluster.sh .PHONY: kind-k8st-run-test diff --git a/node/tests/k8st/deploy_resources_on_kind_cluster.sh b/node/tests/k8st/deploy_resources_on_kind_cluster.sh index 90e683ba719..f7c501be6d0 100755 --- a/node/tests/k8st/deploy_resources_on_kind_cluster.sh +++ b/node/tests/k8st/deploy_resources_on_kind_cluster.sh @@ -69,6 +69,8 @@ echo "Install additional permissions for BGP password" ${kubectl} apply -f $TEST_DIR/infra/additional-rbac.yaml echo +# CRDs are already created prior to reaching this script from within lib.Makefile as part +# of kind cluster creation. echo "Install Calico using the helm chart" $HELM install calico $CHART -f $TEST_DIR/infra/values.yaml -n tigera-operator --create-namespace diff --git a/release/internal/utils/utils.go b/release/internal/utils/utils.go index 6deb233e210..3e8ead2b625 100644 --- a/release/internal/utils/utils.go +++ b/release/internal/utils/utils.go @@ -54,6 +54,9 @@ const ( // TigeraOperatorChart is the name of the Tigera Operator Helm chart. TigeraOperatorChart = "tigera-operator" + // CalicoCRDsChart is the name of the crd.projectcalico.org/v1 CRD helm chart. + CalicoCRDsChart = "crd.projectcalico.org.v1" + // CalicoHelmRepoURL is the URL for the Calico Helm charts. CalicoHelmRepoURL = "https://docs.tigera.io/calico/charts" ) diff --git a/release/pkg/manager/calico/manager.go b/release/pkg/manager/calico/manager.go index d8078f53402..24b5d0f9c40 100644 --- a/release/pkg/manager/calico/manager.go +++ b/release/pkg/manager/calico/manager.go @@ -554,10 +554,19 @@ func (r *CalicoManager) buildHelmIndex(chartDir, chartURL string) error { if err := os.MkdirAll(tmpChartsDir, utils.DirPerms); err != nil { return fmt.Errorf("create temp dir for building helm index: %w", err) } + + // Copy the tigera-operator chart to the temp dir. srcChart := filepath.Join(chartDir, fmt.Sprintf("%s-%s.tgz", utils.TigeraOperatorChart, r.helmChartVersion())) destChart := filepath.Join(tmpChartsDir, fmt.Sprintf("%s-%s.tgz", utils.TigeraOperatorChart, r.helmChartVersion())) if err := utils.CopyFile(srcChart, destChart); err != nil { - return fmt.Errorf("copy chart to temp dir for building helm index: %w", err) + return fmt.Errorf("error copying tigera-operator chart to temp dir for building helm index: %w", err) + } + + // Copy the crd.projectcalico.org.v1 chart to the temp dir. + srcCRDsChart := filepath.Join(chartDir, fmt.Sprintf("%s-%s.tgz", utils.CalicoCRDsChart, r.helmChartVersion())) + destCRDsChart := filepath.Join(tmpChartsDir, fmt.Sprintf("%s-%s.tgz", utils.CalicoCRDsChart, r.helmChartVersion())) + if err := utils.CopyFile(srcCRDsChart, destCRDsChart); err != nil { + return fmt.Errorf("error copying CRD chart to temp dir for building helm index: %w", err) } // Build the new helm index. @@ -576,6 +585,7 @@ func (r *CalicoManager) buildHelmIndex(chartDir, chartURL string) error { // For hashreleases, copy the helm index to the upload dir. srcIndex := filepath.Join(tmpChartsDir, helmIndexFileName) destIndex := filepath.Join(r.uploadDir(), "charts", helmIndexFileName) + // Ensure destination directory exists. if err := os.MkdirAll(filepath.Dir(destIndex), utils.DirPerms); err != nil { return fmt.Errorf("create dest dir for helm index: %w", err) @@ -1280,6 +1290,9 @@ func (r *CalicoManager) publishHelmCharts() error { if err := r.publishHelmChart(filepath.Join(r.uploadDir(), fmt.Sprintf("%s-%s.tgz", utils.TigeraOperatorChart, r.helmChartVersion())), reg); err != nil { return err } + if err := r.publishHelmChart(filepath.Join(r.uploadDir(), fmt.Sprintf("%s-%s.tgz", utils.CalicoCRDsChart, r.helmChartVersion())), reg); err != nil { + return err + } } return nil } @@ -1326,13 +1339,12 @@ func (r *CalicoManager) updateHelmChartIndex() error { func (r *CalicoManager) assertReleaseNotesPresent(ver string) error { // Validate that the release notes for this version are present, // fail if not. - releaseNotesPath := filepath.Join(r.repoRoot, "release-notes", fmt.Sprintf("%s-release-notes.md", ver)) releaseNotesStat, err := os.Stat(releaseNotesPath) - // If we got an error, handle that? if err != nil { return fmt.Errorf("release notes file is invalid: %s", err.Error()) } + if releaseNotesStat.Size() == 0 { return fmt.Errorf("release notes file is invalid: file is 0 bytes") } else if releaseNotesStat.IsDir() {