Skip to content

Commit e65ce84

Browse files
authored
Merge pull request #212 from Danil-Grigorev/autogenerate-full-spec-test
🐛 Add generate workflow for full-chart-install test case
2 parents 2de39b0 + 9876381 commit e65ce84

File tree

3 files changed

+43
-41
lines changed

3 files changed

+43
-41
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ PROD_REGISTRY ?= registry.k8s.io/capi-operator
124124

125125
# Image name
126126
IMAGE_NAME ?= cluster-api-operator
127+
PACKAGE_NAME = cluster-api-operator
127128
CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
128129
CONTROLLER_IMG_TAG ?= $(CONTROLLER_IMG)-$(ARCH):$(TAG)
129130

@@ -291,9 +292,10 @@ verify-gen: generate
291292
## --------------------------------------
292293

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

298300
.PHONY: generate-go
299301
generate-go: $(CONTROLLER_GEN) ## Runs Go related generate targets for the operator
@@ -434,7 +436,7 @@ chart-manifest-modification: # Set the manifest images to the staging/production
434436
.PHONY: release-manifests
435437
release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publish with a release
436438
$(KUSTOMIZE) build ./config/default > $(RELEASE_DIR)/operator-components.yaml
437-
439+
438440
.PHONY: release-chart
439441
release-chart: $(HELM) $(KUSTOMIZE) $(RELEASE_DIR) $(CHART_DIR) $(CHART_PACKAGE_DIR) ## Builds the chart to publish with a release
440442
cp -rf $(ROOT)/hack/charts/cluster-api-operator/. $(CHART_DIR)

test/e2e/helm_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ limitations under the License.
2020
package e2e
2121

2222
import (
23-
. "github.com/onsi/ginkgo/v2"
24-
. "github.com/onsi/gomega"
2523
"os"
2624
"path/filepath"
25+
26+
. "github.com/onsi/ginkgo/v2"
27+
. "github.com/onsi/gomega"
2728
. "sigs.k8s.io/cluster-api-operator/test/framework"
2829
)
2930

3031
var _ = Describe("Create a proper set of manifests when using helm charts", func() {
3132
It("should deploy default manifest set for quick-start process", func() {
3233
fullInstallChart := &HelmChart{
33-
BinaryPath: helmChart.BinaryPath,
34-
Path: helmChart.Path,
35-
Name: helmChart.Name,
36-
Kubeconfig: helmChart.Kubeconfig,
37-
DryRun: helmChart.DryRun,
38-
Output: Manifests,
39-
AdditionalFlags: []string{"-n=capi-operator-system", "--create-namespace"},
34+
BinaryPath: helmChart.BinaryPath,
35+
Path: helmChart.Path,
36+
Name: helmChart.Name,
37+
Kubeconfig: helmChart.Kubeconfig,
38+
DryRun: helmChart.DryRun,
39+
Output: Manifests,
4040
}
4141
fullInstallChart.Output = Manifests
4242
manifests, err := fullInstallChart.InstallChart(nil)

test/e2e/resources/full-chart-install.yaml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
7+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
88
controller-gen.kubebuilder.io/version: v0.11.4
99
labels:
1010
clusterctl.cluster.x-k8s.io/core: capi-operator
@@ -17,7 +17,7 @@ spec:
1717
caBundle: Cg==
1818
service:
1919
name: capi-operator-webhook-service
20-
namespace: 'capi-operator-system'
20+
namespace: 'default'
2121
path: /convert
2222
conversionReviewVersions:
2323
- v1
@@ -1565,7 +1565,7 @@ apiVersion: apiextensions.k8s.io/v1
15651565
kind: CustomResourceDefinition
15661566
metadata:
15671567
annotations:
1568-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
1568+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
15691569
controller-gen.kubebuilder.io/version: v0.11.4
15701570
labels:
15711571
clusterctl.cluster.x-k8s.io/core: capi-operator
@@ -1578,7 +1578,7 @@ spec:
15781578
caBundle: Cg==
15791579
service:
15801580
name: capi-operator-webhook-service
1581-
namespace: 'capi-operator-system'
1581+
namespace: 'default'
15821582
path: /convert
15831583
conversionReviewVersions:
15841584
- v1
@@ -3128,7 +3128,7 @@ apiVersion: apiextensions.k8s.io/v1
31283128
kind: CustomResourceDefinition
31293129
metadata:
31303130
annotations:
3131-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
3131+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
31323132
controller-gen.kubebuilder.io/version: v0.11.4
31333133
labels:
31343134
clusterctl.cluster.x-k8s.io/core: capi-operator
@@ -3141,7 +3141,7 @@ spec:
31413141
caBundle: Cg==
31423142
service:
31433143
name: capi-operator-webhook-service
3144-
namespace: 'capi-operator-system'
3144+
namespace: 'default'
31453145
path: /convert
31463146
conversionReviewVersions:
31473147
- v1
@@ -4689,7 +4689,7 @@ apiVersion: apiextensions.k8s.io/v1
46894689
kind: CustomResourceDefinition
46904690
metadata:
46914691
annotations:
4692-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
4692+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
46934693
controller-gen.kubebuilder.io/version: v0.11.4
46944694
labels:
46954695
clusterctl.cluster.x-k8s.io/core: capi-operator
@@ -4702,7 +4702,7 @@ spec:
47024702
caBundle: Cg==
47034703
service:
47044704
name: capi-operator-webhook-service
4705-
namespace: 'capi-operator-system'
4705+
namespace: 'default'
47064706
path: /convert
47074707
conversionReviewVersions:
47084708
- v1
@@ -6311,7 +6311,7 @@ roleRef:
63116311
subjects:
63126312
- kind: ServiceAccount
63136313
name: default
6314-
namespace: 'capi-operator-system'
6314+
namespace: 'default'
63156315
---
63166316
# Source: cluster-api-operator/templates/operator-components.yaml
63176317
apiVersion: rbac.authorization.k8s.io/v1
@@ -6327,7 +6327,7 @@ roleRef:
63276327
subjects:
63286328
- kind: ServiceAccount
63296329
name: default
6330-
namespace: 'capi-operator-system'
6330+
namespace: 'default'
63316331
---
63326332
# Source: cluster-api-operator/templates/operator-components.yaml
63336333
apiVersion: rbac.authorization.k8s.io/v1
@@ -6336,7 +6336,7 @@ metadata:
63366336
labels:
63376337
clusterctl.cluster.x-k8s.io/core: capi-operator
63386338
name: capi-operator-leader-election-role
6339-
namespace: 'capi-operator-system'
6339+
namespace: 'default'
63406340
rules:
63416341
- apiGroups:
63426342
- ""
@@ -6384,15 +6384,15 @@ metadata:
63846384
labels:
63856385
clusterctl.cluster.x-k8s.io/core: capi-operator
63866386
name: capi-operator-leader-election-rolebinding
6387-
namespace: 'capi-operator-system'
6387+
namespace: 'default'
63886388
roleRef:
63896389
apiGroup: rbac.authorization.k8s.io
63906390
kind: Role
63916391
name: capi-operator-leader-election-role
63926392
subjects:
63936393
- kind: ServiceAccount
63946394
name: default
6395-
namespace: 'capi-operator-system'
6395+
namespace: 'default'
63966396
---
63976397
# Source: cluster-api-operator/templates/operator-components.yaml
63986398
apiVersion: v1
@@ -6402,7 +6402,7 @@ metadata:
64026402
clusterctl.cluster.x-k8s.io/core: capi-operator
64036403
control-plane: controller-manager
64046404
name: capi-operator-controller-manager-metrics-service
6405-
namespace: 'capi-operator-system'
6405+
namespace: 'default'
64066406
spec:
64076407
ports:
64086408
- name: https
@@ -6419,7 +6419,7 @@ metadata:
64196419
labels:
64206420
clusterctl.cluster.x-k8s.io/core: capi-operator
64216421
name: capi-operator-webhook-service
6422-
namespace: 'capi-operator-system'
6422+
namespace: 'default'
64236423
spec:
64246424
ports:
64256425
- port: 443
@@ -6433,7 +6433,7 @@ apiVersion: apps/v1
64336433
kind: Deployment
64346434
metadata:
64356435
name: capi-operator-cluster-api-operator
6436-
namespace: 'capi-operator-system'
6436+
namespace: 'default'
64376437
labels:
64386438
app: cluster-api-operator
64396439
app.kubernetes.io/name: cluster-api-operator
@@ -6555,11 +6555,11 @@ metadata:
65556555
labels:
65566556
clusterctl.cluster.x-k8s.io/core: capi-operator
65576557
name: capi-operator-serving-cert
6558-
namespace: 'capi-operator-system'
6558+
namespace: 'default'
65596559
spec:
65606560
dnsNames:
6561-
- capi-operator-webhook-service.capi-operator-system.svc
6562-
- capi-operator-webhook-service.capi-operator-system.svc.cluster.local
6561+
- capi-operator-webhook-service.default.svc
6562+
- capi-operator-webhook-service.default.svc.cluster.local
65636563
issuerRef:
65646564
kind: Issuer
65656565
name: capi-operator-selfsigned-issuer
@@ -6572,7 +6572,7 @@ metadata:
65726572
labels:
65736573
clusterctl.cluster.x-k8s.io/core: capi-operator
65746574
name: capi-operator-selfsigned-issuer
6575-
namespace: 'capi-operator-system'
6575+
namespace: 'default'
65766576
spec:
65776577
selfSigned: {}
65786578
---
@@ -6581,7 +6581,7 @@ apiVersion: admissionregistration.k8s.io/v1
65816581
kind: MutatingWebhookConfiguration
65826582
metadata:
65836583
annotations:
6584-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
6584+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
65856585
labels:
65866586
clusterctl.cluster.x-k8s.io/core: capi-operator
65876587
name: capi-operator-mutating-webhook-configuration
@@ -6592,7 +6592,7 @@ webhooks:
65926592
clientConfig:
65936593
service:
65946594
name: capi-operator-webhook-service
6595-
namespace: 'capi-operator-system'
6595+
namespace: 'default'
65966596
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-bootstrapprovider
65976597
failurePolicy: Fail
65986598
matchPolicy: Equivalent
@@ -6614,7 +6614,7 @@ webhooks:
66146614
clientConfig:
66156615
service:
66166616
name: capi-operator-webhook-service
6617-
namespace: 'capi-operator-system'
6617+
namespace: 'default'
66186618
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-controlplaneprovider
66196619
failurePolicy: Fail
66206620
matchPolicy: Equivalent
@@ -6636,7 +6636,7 @@ webhooks:
66366636
clientConfig:
66376637
service:
66386638
name: capi-operator-webhook-service
6639-
namespace: 'capi-operator-system'
6639+
namespace: 'default'
66406640
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-coreprovider
66416641
failurePolicy: Fail
66426642
matchPolicy: Equivalent
@@ -6658,7 +6658,7 @@ webhooks:
66586658
clientConfig:
66596659
service:
66606660
name: capi-operator-webhook-service
6661-
namespace: 'capi-operator-system'
6661+
namespace: 'default'
66626662
path: /mutate-operator-cluster-x-k8s-io-v1alpha1-infrastructureprovider
66636663
failurePolicy: Fail
66646664
matchPolicy: Equivalent
@@ -6680,7 +6680,7 @@ apiVersion: admissionregistration.k8s.io/v1
66806680
kind: ValidatingWebhookConfiguration
66816681
metadata:
66826682
annotations:
6683-
cert-manager.io/inject-ca-from: 'capi-operator-system/capi-operator-serving-cert'
6683+
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
66846684
labels:
66856685
clusterctl.cluster.x-k8s.io/core: capi-operator
66866686
name: capi-operator-validating-webhook-configuration
@@ -6691,7 +6691,7 @@ webhooks:
66916691
clientConfig:
66926692
service:
66936693
name: capi-operator-webhook-service
6694-
namespace: 'capi-operator-system'
6694+
namespace: 'default'
66956695
path: /validate-operator-cluster-x-k8s-io-v1alpha1-bootstrapprovider
66966696
failurePolicy: Fail
66976697
matchPolicy: Equivalent
@@ -6713,7 +6713,7 @@ webhooks:
67136713
clientConfig:
67146714
service:
67156715
name: capi-operator-webhook-service
6716-
namespace: 'capi-operator-system'
6716+
namespace: 'default'
67176717
path: /validate-operator-cluster-x-k8s-io-v1alpha1-controlplaneprovider
67186718
failurePolicy: Fail
67196719
matchPolicy: Equivalent
@@ -6735,7 +6735,7 @@ webhooks:
67356735
clientConfig:
67366736
service:
67376737
name: capi-operator-webhook-service
6738-
namespace: 'capi-operator-system'
6738+
namespace: 'default'
67396739
path: /validate-operator-cluster-x-k8s-io-v1alpha1-coreprovider
67406740
failurePolicy: Fail
67416741
matchPolicy: Equivalent
@@ -6757,7 +6757,7 @@ webhooks:
67576757
clientConfig:
67586758
service:
67596759
name: capi-operator-webhook-service
6760-
namespace: 'capi-operator-system'
6760+
namespace: 'default'
67616761
path: /validate-operator-cluster-x-k8s-io-v1alpha1-infrastructureprovider
67626762
failurePolicy: Fail
67636763
matchPolicy: Equivalent

0 commit comments

Comments
 (0)