Skip to content

Commit 8911e2f

Browse files
authored
Merge pull request #4383 from monteiro-renato/patch-4378
🐛 fix: (helm/v1alpha1): install the prometheus-operator CRDs before installing a chart which configures a ServiceMonitor
2 parents c141fac + 256de94 commit 8911e2f

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

.github/workflows/test-helm-samples.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: Helm Testdata Sample
33
on:
44
push:
55
paths:
6-
- 'testdata/project-v4-with-plugins/**'
7-
- '.github/workflows/test-helm-samples.yml'
6+
- "testdata/project-v4-with-plugins/**"
7+
- ".github/workflows/test-helm-samples.yml"
88
pull_request:
99
paths:
10-
- 'testdata/project-v4-with-plugins/**'
11-
- '.github/workflows/test-helm-samples.yml'
10+
- "testdata/project-v4-with-plugins/**"
11+
- ".github/workflows/test-helm-samples.yml"
1212

1313
jobs:
1414
helm-test-project-v4-with-plugins:
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Go
2424
uses: actions/setup-go@v5
2525
with:
26-
go-version: '~1.22'
26+
go-version: "~1.22"
2727

2828
- name: Install the latest version of kind
2929
run: |
@@ -55,6 +55,12 @@ jobs:
5555
run: |
5656
helm lint testdata/project-v4-with-plugins/dist/chart
5757
58+
- name: Install Prometheus Operator CRDs
59+
run: |
60+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
61+
helm repo update
62+
helm install prometheus-crds prometheus-community/prometheus-operator-crds
63+
5864
- name: Install cert-manager via Helm
5965
run: |
6066
helm repo add jetstack https://charts.jetstack.io
@@ -69,8 +75,12 @@ jobs:
6975
7076
- name: Install Helm chart for project-v4-with-plugins
7177
run: |
72-
helm install my-release testdata/project-v4-with-plugins/dist/chart --create-namespace --namespace project-v4-with-plugins-system
78+
helm install my-release testdata/project-v4-with-plugins/dist/chart --create-namespace --namespace project-v4-with-plugins-system --set prometheus.enable=true
7379
7480
- name: Check Helm release status
7581
run: |
7682
helm status my-release --namespace project-v4-with-plugins-system
83+
84+
- name: Check Presence of ServiceMonitor
85+
run: |
86+
kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor

pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/github/test_chart.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
8484
- name: Install Helm
8585
run: |
86-
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
86+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
8787
8888
- name: Verify Helm installation
8989
run: helm version
@@ -106,6 +106,12 @@ jobs:
106106
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
107107
108108
# TODO: Uncomment if Prometheus is enabled
109+
# - name: Install Prometheus Operator CRDs
110+
# run: |
111+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
112+
# helm repo update
113+
# helm install prometheus-crds prometheus-community/prometheus-operator-crds
114+
#
109115
# - name: Install Prometheus via Helm
110116
# run: |
111117
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
@@ -123,4 +129,9 @@ jobs:
123129
- name: Check Helm release status
124130
run: |
125131
helm status my-release --namespace {{ .ProjectName }}-system
132+
133+
# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created
134+
# - name: Check Presence of ServiceMonitor
135+
# run: |
136+
# kubectl wait --namespace {{ .ProjectName }}-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/{{ .ProjectName }}-controller-manager-metrics-monitor
126137
`

testdata/project-v4-with-plugins/.github/workflows/test-chart.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
- name: Install Helm
3939
run: |
40-
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
40+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
4141
4242
- name: Verify Helm installation
4343
run: helm version
@@ -60,6 +60,12 @@ jobs:
6060
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
6161

6262
# TODO: Uncomment if Prometheus is enabled
63+
# - name: Install Prometheus Operator CRDs
64+
# run: |
65+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
66+
# helm repo update
67+
# helm install prometheus-crds prometheus-community/prometheus-operator-crds
68+
#
6369
# - name: Install Prometheus via Helm
6470
# run: |
6571
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
@@ -77,3 +83,8 @@ jobs:
7783
- name: Check Helm release status
7884
run: |
7985
helm status my-release --namespace project-v4-with-plugins-system
86+
87+
# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created
88+
# - name: Check Presence of ServiceMonitor
89+
# run: |
90+
# kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor

0 commit comments

Comments
 (0)