Skip to content

Commit 99e1122

Browse files
committed
⚠ Split Helm chart into operator and providers charts with dependency
Separate cluster-api-operator into two charts to fix webhook timing issues: - cluster-api-operator: operator deployment only - cluster-api-operator-providers: provider Custom Resources with optional operator dependency This ensures webhook readiness before applying provider CRs, preventing "no endpoints available" errors during installation. The providers chart includes cluster-api-operator as a conditional dependency (install: true by default), maintaining backward compatibility while allowing flexible deployment scenarios: **Recommended: Two-step installation (no errors):** ```sh helm install capi-operator capi-operator/cluster-api-operator \ --create-namespace -n capi-operator-system --wait helm install capi-providers capi-operator/cluster-api-operator-providers \ -n capi-operator-system --set cluster-api-operator.install=false \ --set infrastructure.docker.enabled=true ``` **Backward compatibility: Single-step installation (may require retry):** ```sh helm install capi-providers capi-operator/cluster-api-operator-providers \ --create-namespace -n capi-operator-system \ --set infrastructure.docker.enabled=true helm upgrade --install capi-providers capi-operator/cluster-api-operator-providers \ -n capi-operator-system --set infrastructure.docker.enabled=true ``` Signed-off-by: kahirokunn <[email protected]>
1 parent dbd48bb commit 99e1122

File tree

20 files changed

+393
-106
lines changed

20 files changed

+393
-106
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ _releasenotes
8080

8181
# Helm
8282
.helm
83+
Chart.lock
84+
hack/charts/cluster-api-operator-providers/charts

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ PROD_REGISTRY ?= registry.k8s.io/capi-operator
149149

150150
# Image name
151151
IMAGE_NAME ?= cluster-api-operator
152-
PACKAGE_NAME = cluster-api-operator
152+
PACKAGE_NAME = cluster-api-operator-providers
153153
CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
154154
CONTROLLER_IMG_TAG ?= $(CONTROLLER_IMG)-$(ARCH):$(TAG)
155155

@@ -180,6 +180,7 @@ endif
180180
RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF)
181181
RELEASE_DIR := $(ROOT)/out
182182
CHART_DIR := $(RELEASE_DIR)/charts/cluster-api-operator
183+
CHART_PROVIDERS_DIR := $(RELEASE_DIR)/charts/cluster-api-operator-providers
183184
CHART_PACKAGE_DIR := $(RELEASE_DIR)/package
184185

185186
# Set --output-base for conversion-gen if we are not within GOPATH
@@ -455,6 +456,9 @@ $(CHART_DIR):
455456
$(CHART_PACKAGE_DIR):
456457
mkdir -p $(CHART_PACKAGE_DIR)
457458

459+
$(CHART_PROVIDERS_DIR):
460+
mkdir -p $(CHART_PROVIDERS_DIR)/templates
461+
458462
.PHONY: release
459463
release: clean-release $(RELEASE_DIR) ## Builds and push container images using the latest git tag for the commit.
460464
@if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi
@@ -485,11 +489,17 @@ release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publis
485489
$(KUSTOMIZE) build ./config/default > $(RELEASE_DIR)/operator-components.yaml
486490

487491
.PHONY: release-chart
488-
release-chart: $(HELM) $(KUSTOMIZE) $(RELEASE_DIR) $(CHART_DIR) $(CHART_PACKAGE_DIR) ## Builds the chart to publish with a release
492+
release-chart: $(HELM) $(KUSTOMIZE) $(RELEASE_DIR) $(CHART_DIR) $(CHART_PROVIDERS_DIR) $(CHART_PACKAGE_DIR) ## Builds the chart to publish with a release
493+
# Processing the cluster-api-operator chart
489494
cp -rf $(ROOT)/hack/charts/cluster-api-operator/. $(CHART_DIR)
490495
$(KUSTOMIZE) build ./config/chart > $(CHART_DIR)/templates/operator-components.yaml
491496
$(HELM) package $(CHART_DIR) --app-version=$(HELM_CHART_TAG) --version=$(HELM_CHART_TAG) --destination=$(CHART_PACKAGE_DIR)
492497

498+
# Processing the cluster-api-operator-providers chart
499+
cp -rf $(ROOT)/hack/charts/cluster-api-operator-providers/. $(CHART_PROVIDERS_DIR)
500+
$(HELM) dependency update $(CHART_PROVIDERS_DIR)
501+
$(HELM) package $(CHART_PROVIDERS_DIR) --app-version=$(HELM_CHART_TAG) --version=$(HELM_CHART_TAG) --destination=$(CHART_PACKAGE_DIR)
502+
493503
.PHONY: release-staging
494504
release-staging: ## Builds and push container images and manifests to the staging bucket.
495505
$(MAKE) docker-build-all
@@ -561,7 +571,7 @@ test-e2e-run: $(GINKGO) $(ENVSUBST) $(HELM) ## Run e2e tests
561571
-e2e.artifacts-folder="$(ARTIFACTS)" \
562572
-e2e.config="$(E2E_CONF_FILE_ENVSUBST)" -e2e.components=$(RELEASE_DIR)/operator-components.yaml \
563573
-e2e.skip-resource-cleanup=$(SKIP_CLEANUP) -e2e.use-existing-cluster=$(SKIP_CREATE_MGMT_CLUSTER) \
564-
-e2e.helm-binary-path=$(HELM) -e2e.chart-path=$(CHART_PACKAGE_DIR)/cluster-api-operator-$(HELM_CHART_TAG).tgz $(E2E_ARGS)
574+
-e2e.helm-binary-path=$(HELM) -e2e.chart-path=$(CHART_PACKAGE_DIR)/cluster-api-operator-providers-$(HELM_CHART_TAG).tgz $(E2E_ARGS)
565575

566576
go-version: ## Print the go version we use to compile our binaries and images
567577
@echo $(GO_VERSION)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: cluster-api-operator-providers
3+
description: Cluster API Provider Custom Resources
4+
type: application
5+
version: 0.0.0
6+
appVersion: "0.0.0"
7+
dependencies:
8+
- name: cluster-api-operator
9+
repository: file://../cluster-api-operator
10+
version: 0.0.0
11+
condition: cluster-api-operator.install
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "capi-operator.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
*/}}
13+
{{- define "capi-operator.fullname" -}}
14+
{{- if .Values.fullnameOverride -}}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
16+
{{- else -}}
17+
{{- $name := default .Chart.Name .Values.nameOverride -}}
18+
{{- if contains $name .Release.Name -}}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
20+
{{- else -}}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
22+
{{- end -}}
23+
{{- end -}}
24+
{{- end -}}

0 commit comments

Comments
 (0)