Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ PROD_REGISTRY ?= registry.k8s.io/capi-operator

# Image name
IMAGE_NAME ?= cluster-api-operator
PACKAGE_NAME = cluster-api-operator
CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
CONTROLLER_IMG_TAG ?= $(CONTROLLER_IMG)-$(ARCH):$(TAG)

Expand Down Expand Up @@ -291,9 +292,10 @@ verify-gen: generate
## --------------------------------------

.PHONY: generate
generate: $(CONTROLLER_GEN) ## Generate code
generate: $(CONTROLLER_GEN) $(HELM) release-chart ## Generate code
$(MAKE) generate-manifests
$(MAKE) generate-go
$(HELM) template capi-operator $(CHART_PACKAGE_DIR)/$(PACKAGE_NAME)-$(HELM_CHART_TAG).tgz > test/e2e/resources/full-chart-install.yaml

.PHONY: generate-go
generate-go: $(CONTROLLER_GEN) ## Runs Go related generate targets for the operator
Expand Down Expand Up @@ -434,7 +436,7 @@ chart-manifest-modification: # Set the manifest images to the staging/production
.PHONY: release-manifests
release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publish with a release
$(KUSTOMIZE) build ./config/default > $(RELEASE_DIR)/operator-components.yaml

.PHONY: release-chart
release-chart: $(HELM) $(KUSTOMIZE) $(RELEASE_DIR) $(CHART_DIR) $(CHART_PACKAGE_DIR) ## Builds the chart to publish with a release
cp -rf $(ROOT)/hack/charts/cluster-api-operator/. $(CHART_DIR)
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ limitations under the License.
package e2e

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"os"
"path/filepath"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "sigs.k8s.io/cluster-api-operator/test/framework"
)

var _ = Describe("Create a proper set of manifests when using helm charts", func() {
It("should deploy default manifest set for quick-start process", func() {
fullInstallChart := &HelmChart{
BinaryPath: helmChart.BinaryPath,
Path: helmChart.Path,
Name: helmChart.Name,
Kubeconfig: helmChart.Kubeconfig,
DryRun: helmChart.DryRun,
Output: Manifests,
AdditionalFlags: []string{"-n=capi-operator-system", "--create-namespace"},
BinaryPath: helmChart.BinaryPath,
Path: helmChart.Path,
Name: helmChart.Name,
Kubeconfig: helmChart.Kubeconfig,
DryRun: helmChart.DryRun,
Output: Manifests,
}
fullInstallChart.Output = Manifests
manifests, err := fullInstallChart.InstallChart(nil)
Expand Down
60 changes: 30 additions & 30 deletions test/e2e/resources/full-chart-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.11.4
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
Expand All @@ -17,7 +17,7 @@ spec:
caBundle: Cg==
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why is this needed for generating full chart?

Copy link
Member Author

@Danil-Grigorev Danil-Grigorev Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default state of the chart, instead of giving it some namespace I left out all variable substitutions on default. This is what user sees when they do helm install capi-operator capi-operator/cluster-api-operator

path: /convert
conversionReviewVersions:
- v1
Expand Down Expand Up @@ -1565,7 +1565,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.11.4
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
Expand All @@ -1578,7 +1578,7 @@ spec:
caBundle: Cg==
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /convert
conversionReviewVersions:
- v1
Expand Down Expand Up @@ -3128,7 +3128,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.11.4
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
Expand All @@ -3141,7 +3141,7 @@ spec:
caBundle: Cg==
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /convert
conversionReviewVersions:
- v1
Expand Down Expand Up @@ -4689,7 +4689,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.11.4
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
Expand All @@ -4702,7 +4702,7 @@ spec:
caBundle: Cg==
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /convert
conversionReviewVersions:
- v1
Expand Down Expand Up @@ -6311,7 +6311,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: default
namespace: 'capi-operator-system'
namespace: 'default'
---
# Source: cluster-api-operator/templates/operator-components.yaml
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -6327,7 +6327,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: default
namespace: 'capi-operator-system'
namespace: 'default'
---
# Source: cluster-api-operator/templates/operator-components.yaml
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -6336,7 +6336,7 @@ metadata:
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-leader-election-role
namespace: 'capi-operator-system'
namespace: 'default'
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -6384,15 +6384,15 @@ metadata:
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-leader-election-rolebinding
namespace: 'capi-operator-system'
namespace: 'default'
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: capi-operator-leader-election-role
subjects:
- kind: ServiceAccount
name: default
namespace: 'capi-operator-system'
namespace: 'default'
---
# Source: cluster-api-operator/templates/operator-components.yaml
apiVersion: v1
Expand All @@ -6402,7 +6402,7 @@ metadata:
clusterctl.cluster.x-k8s.io/core: capi-operator
control-plane: controller-manager
name: capi-operator-controller-manager-metrics-service
namespace: 'capi-operator-system'
namespace: 'default'
spec:
ports:
- name: https
Expand All @@ -6419,7 +6419,7 @@ metadata:
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
spec:
ports:
- port: 443
Expand All @@ -6433,7 +6433,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-operator-cluster-api-operator
namespace: 'capi-operator-system'
namespace: 'default'
labels:
app: cluster-api-operator
app.kubernetes.io/name: cluster-api-operator
Expand Down Expand Up @@ -6555,11 +6555,11 @@ metadata:
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-serving-cert
namespace: 'capi-operator-system'
namespace: 'default'
spec:
dnsNames:
- capi-operator-webhook-service.capi-operator-system.svc
- capi-operator-webhook-service.capi-operator-system.svc.cluster.local
- capi-operator-webhook-service.default.svc
- capi-operator-webhook-service.default.svc.cluster.local
issuerRef:
kind: Issuer
name: capi-operator-selfsigned-issuer
Expand All @@ -6572,7 +6572,7 @@ metadata:
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-selfsigned-issuer
namespace: 'capi-operator-system'
namespace: 'default'
spec:
selfSigned: {}
---
Expand All @@ -6581,7 +6581,7 @@ apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-mutating-webhook-configuration
Expand All @@ -6592,7 +6592,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-bootstrapprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6614,7 +6614,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-controlplaneprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6636,7 +6636,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-coreprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6658,7 +6658,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-infrastructureprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6680,7 +6680,7 @@ apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: capi-operator-validating-webhook-configuration
Expand All @@ -6691,7 +6691,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /validate-operator-cluster-x-k8s-io-v1alpha1-bootstrapprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6713,7 +6713,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /validate-operator-cluster-x-k8s-io-v1alpha1-controlplaneprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6735,7 +6735,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /validate-operator-cluster-x-k8s-io-v1alpha1-coreprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand All @@ -6757,7 +6757,7 @@ webhooks:
clientConfig:
service:
name: capi-operator-webhook-service
namespace: 'capi-operator-system'
namespace: 'default'
path: /validate-operator-cluster-x-k8s-io-v1alpha1-infrastructureprovider
failurePolicy: Fail
matchPolicy: Equivalent
Expand Down