Skip to content

Commit c773386

Browse files
committed
fix: split provider CRs from operator deployment
This commit splits the cluster-api-operator Helm chart into two separate charts to resolve flaky installations caused by webhook validation timing issues. Problem: - Provider Custom Resources (CoreProvider, BootstrapProvider, etc.) were applied at the same time as the operator deployment. - The webhook service was not yet ready, leading to validation errors: "no endpoints available for service 'capi-operator-webhook-service'". Solution: - Create two charts: 1. cluster-api-operator: contains only the operator deployment and its resources. 2. cluster-api-operator-providers: contains all provider Custom Resources. - Installing the operator first allows the webhook to start before provider CRs are applied. Installation now requires: 1. Install operator: helm install capi-operator capi-operator/cluster-api-operator \ --create-namespace -n capi-operator-system --wait --timeout 90s 2. Install providers: helm install capi-providers \ capi-operator/cluster-api-operator-providers \ -n capi-operator-system \ --set infrastructure.docker.enabled=true \ --set cert-manager.enabled=true \ --set configSecret.name=${CREDENTIALS_SECRET_NAME} \ --set configSecret.namespace=${CREDENTIALS_SECRET_NAMESPACE} Fixes: #534 Signed-off-by: kahirokunn <[email protected]>
1 parent 95adca5 commit c773386

File tree

16 files changed

+314
-78
lines changed

16 files changed

+314
-78
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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,16 @@ 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+
# cluster-api-operator チャートの処理
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+
# cluster-api-operator-providers チャートの処理
499+
cp -rf $(ROOT)/hack/charts/cluster-api-operator-providers/. $(CHART_PROVIDERS_DIR)
500+
$(HELM) package $(CHART_PROVIDERS_DIR) --app-version=$(HELM_CHART_TAG) --version=$(HELM_CHART_TAG) --destination=$(CHART_PACKAGE_DIR)
501+
493502
.PHONY: release-staging
494503
release-staging: ## Builds and push container images and manifests to the staging bucket.
495504
$(MAKE) docker-build-all
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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"
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)