@@ -20,11 +20,30 @@ jobs:
20
20
- name : Checkout repository
21
21
uses : actions/checkout@v5
22
22
23
+ - name : Enable Prometheus in kustomize (testdata sample)
24
+ run : |
25
+ sed -i 's/^#- \.\.\/prometheus/- ..\/prometheus/' testdata/project-v4-with-plugins/config/default/kustomization.yaml
26
+
27
+ - name : Build kubebuilder CLI
28
+ run : make build
29
+
23
30
- name : Setup Go
24
31
uses : actions/setup-go@v6
25
32
with :
26
33
go-version-file : go.mod
27
34
35
+ - name : Prepare project-v4-with-plugins
36
+ run : |
37
+ cd testdata/project-v4-with-plugins/
38
+ go mod tidy
39
+ make all
40
+
41
+ - name : Rebuild installer and regenerate Helm chart (v2-alpha)
42
+ working-directory : testdata/project-v4-with-plugins
43
+ run : |
44
+ make build-installer
45
+ ../../bin/kubebuilder edit --plugins=helm/v2-alpha --force
46
+
28
47
- name : Install the latest version of kind
29
48
run : |
30
49
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
37
56
- name : Create kind cluster
38
57
run : kind create cluster
39
58
40
- - name : Prepare project-v4-with-plugins
41
- run : |
42
- cd testdata/project-v4-with-plugins/
43
- go mod tidy
44
- make docker-build IMG=project-v4-with-plugins:v0.1.0
45
- kind load docker-image project-v4-with-plugins:v0.1.0
46
-
47
59
- name : Install Helm
48
60
run : |
49
61
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
@@ -55,39 +67,50 @@ jobs:
55
67
run : |
56
68
helm lint testdata/project-v4-with-plugins/dist/chart
57
69
70
+ - name : Build project-v4-with-plugins
71
+ run : |
72
+ cd testdata/project-v4-with-plugins/
73
+ go mod tidy
74
+ make docker-build IMG=project-v4-with-plugins:v0.1.0
75
+ kind load docker-image project-v4-with-plugins:v0.1.0
76
+
58
77
- name : Install Prometheus Operator CRDs
59
78
run : |
60
79
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
61
80
helm repo update
62
81
helm install prometheus-crds prometheus-community/prometheus-operator-crds
63
82
64
- - name : Install cert-manager via Helm
83
+ - name : Install cert-manager via Helm (wait for readiness)
65
84
run : |
66
85
helm repo add jetstack https://charts.jetstack.io
67
86
helm repo update
68
- helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set crds.enabled=true
69
-
70
- - name : Wait for cert-manager to be ready
71
- run : |
72
- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
73
- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
74
- kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
87
+ helm install cert-manager jetstack/cert-manager \
88
+ --namespace cert-manager \
89
+ --create-namespace \
90
+ --set crds.enabled=true \
91
+ --wait \
92
+ --timeout 300s
75
93
76
94
- name : Render Helm chart for project-v4-with-plugins
77
95
run : |
78
96
helm template testdata/project-v4-with-plugins/dist/chart --namespace=project-v4-with-plugins-system
79
97
80
98
- name : Install Helm chart for project-v4-with-plugins
81
99
run : |
82
- helm install my-release testdata/project-v4-with-plugins/dist/chart --create-namespace --namespace project-v4-with-plugins-system --set prometheus.enable=true
100
+ helm install my-release \
101
+ testdata/project-v4-with-plugins/dist/chart \
102
+ --namespace project-v4-with-plugins-system \
103
+ --create-namespace \
104
+ --set prometheus.enable=true
83
105
84
106
- name : Check Helm release status
85
107
run : |
86
108
helm status my-release --namespace project-v4-with-plugins-system
87
109
88
- - name : Check Presence of ServiceMonitor
110
+ - name : Delete kind cluster
111
+ if : always()
89
112
run : |
90
- kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor
113
+ kind delete cluster || true
91
114
92
115
# Test scenario:
93
116
# - scaffold project without creating webhooks,
97
120
# Command to use to scaffold project without creating webhooks and so no need to install cert manager:
98
121
# - kubebuilder init
99
122
# - kubebuilder create api --group example.com --version v1 --kind App --controller=true --resource=true
100
- # - kubebuilder edit --plugins=helm.kubebuilder.io/v1 -alpha
123
+ # - kubebuilder edit --plugins=helm.kubebuilder.io/v2 -alpha
101
124
test-helm-no-webhooks :
102
125
runs-on : ubuntu-latest
103
126
if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -149,9 +172,18 @@ jobs:
149
172
150
173
- name : Deploy Helm chart without cert-manager
151
174
working-directory : test-helm-no-webhooks
152
- run : helm install my-release ./dist/chart --create-namespace --namespace test-helm-no-webhooks-system
175
+ run : |
176
+ helm install my-release \
177
+ ./dist/chart \
178
+ --create-namespace \
179
+ --namespace test-helm-no-webhooks-system
153
180
154
181
- name : Verify deployment is working
155
182
working-directory : test-helm-no-webhooks
156
183
run : |
157
184
helm status my-release --namespace test-helm-no-webhooks-system
185
+
186
+ - name : Delete kind cluster
187
+ if : always()
188
+ run : |
189
+ kind delete cluster || true
0 commit comments