Skip to content

Commit bb95800

Browse files
committed
Fix examples
The examples test.sh script was not exiting when an error was returned. Any error in the test.sh scripts should now stop the execution and return the exit code. __ Downscale vault-tls example The github runners struggles to run 3-node rabbit cluster due to resource constraints. __ Delete obsolete example Federation is better achieved using the Messaging Topology Operator. There's another example that covers how to setup TLS. The case of federation over TLS is a combination of using the Topology Operator in combination with the TLS example. __ Fix external secret example The test.sh file was missing, and this test was not excluded from the CI runs. Added a short script to validate that the external secret is used to seed the default user. __ Removed system tests in GKE They do not provide more value than local KinD system tests __ cmctl now waits watching the correct namespace Earlier, if the kubeconfig had a namespace that didn't exist as current ns, cmctl will always fail, even when cert-manager was ready __ Skip mtls internode example tests It requires a 3 node cluster, and this setup is not reliable inside a GitHub runner, given the resource constraints inside the runner. Typo in kubectl testss
1 parent 2a76670 commit bb95800

File tree

28 files changed

+149
-306
lines changed

28 files changed

+149
-306
lines changed

.github/workflows/build-test-publish.yml

+87-114
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ env:
2222

2323
jobs:
2424
kubectl_tests:
25-
# FIXME: do not sneaky build the operator. Use a built one
2625
name: kubectl rabbitmq tests
2726
runs-on: ubuntu-latest
2827
needs:
@@ -70,19 +69,21 @@ jobs:
7069
kubectl kustomize config/crd | kubectl apply -f-
7170
kubectl kustomize config/default/base | ytt -f- \
7271
-f config/ytt/overlay-manager-image.yaml \
73-
--data-value operator-image="$IMG" \
72+
--data-value operator_image="${IMG}" \
7473
-f config/ytt/never_pull.yaml \
7574
| kubectl apply -f-
7675
7776
make kubectl-plugin-tests
7877
79-
# - name: Notify Google Chat
78+
- name: Notify Google Chat
79+
# TODO: add back before PR
80+
if: false
8081
# if: ${{ failure() && github.event_name != 'pull_request' }}
81-
# uses: SimonScholz/google-chat-action@main
82-
# with:
83-
# webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}'
84-
# jobStatus: ${{ job.status }}
85-
# title: Cluster Operator - RabbitMQ kubectl tests
82+
uses: SimonScholz/google-chat-action@main
83+
with:
84+
webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}'
85+
jobStatus: ${{ job.status }}
86+
title: Cluster Operator - RabbitMQ kubectl tests
8687

8788
unit_integration_tests:
8889
name: unit and integration tests
@@ -278,15 +279,12 @@ jobs:
278279
id: single-arch-meta-amd64
279280
uses: docker/metadata-action@v5
280281
with:
281-
# list of Docker images to use as base name for tags
282282
images: |
283283
rabbitmqoperator/cluster-operator
284284
flavor: |
285285
latest=false
286-
# generate Docker tags based on the following events/attributes
287286
tags: |
288287
type=semver,pattern={{version}},suffix=-amd64,latest=false
289-
type=sha,suffix=-amd64,latest=false
290288
291289
- name: Build and push single-arch amd64 image
292290
uses: docker/build-push-action@v6
@@ -333,10 +331,9 @@ jobs:
333331
tags: ${{ steps.single-arch-meta-arm64.outputs.tags }}
334332
labels: ${{ steps.single-arch-meta-arm64.outputs.labels }}
335333

336-
system_tests_local:
334+
system_tests:
337335
name: Local system tests (stable k8s)
338336
runs-on: ubuntu-latest
339-
if: ${{ github.event_name == 'pull_request' }}
340337
needs: build_operator
341338
strategy:
342339
matrix:
@@ -354,16 +351,43 @@ jobs:
354351
- name: Check out code into the Go module directory
355352
uses: actions/checkout@v4
356353

354+
- name: Create KinD
355+
uses: helm/kind-action@v1
356+
with:
357+
cluster_name: system-testing
358+
node_image: ${{ env.KIND_NODE_IMAGE }}
359+
360+
- name: Download Operator manifest
361+
uses: actions/download-artifact@v4
362+
# This manifest was generated by the build_operator job, and it has the image tag for this specific execution.
363+
# Thanks to that, we don't have to make YAML modifications to deploy the right image.
364+
with:
365+
name: operator-manifests
366+
path: tmp/
367+
368+
- name: Download Operator artifact
369+
uses: actions/download-artifact@v4
370+
with:
371+
name: operator_image
372+
path: /tmp
373+
374+
- name: carvel-setup-action
375+
uses: carvel-dev/[email protected]
376+
with:
377+
only: ytt
378+
379+
- name: Install Operator build
380+
run: |
381+
kind load image-archive /tmp/operator.tar --name system-testing
382+
ytt -f tmp/cluster-operator.yml -f config/ytt/never_pull.yaml | kubectl apply -f-
383+
kubectl --namespace=rabbitmq-system wait --for=condition=Available deployment/rabbitmq-cluster-operator
384+
357385
- name: System tests
358386
env:
359387
KIND_NODE_IMAGE: ${{ env.KIND_NODE_IMAGE }}
360388
RABBITMQ_IMAGE: ${{ matrix.rabbitmq-image }}
361389
# make deploy-kind builds the image locally
362-
# TODO: we can build the image locally in Actions
363390
run: |
364-
make install-tools
365-
kind create cluster --image "$KIND_NODE_IMAGE"
366-
DOCKER_REGISTRY_SERVER=local-server OPERATOR_IMAGE=local-operator make deploy-kind
367391
make cert-manager
368392
SUPPORT_VOLUME_EXPANSION=false make system-tests
369393
@@ -379,7 +403,6 @@ jobs:
379403
system_tests_oldest_k8s:
380404
name: Local system tests (min k8s)
381405
runs-on: ubuntu-latest
382-
if: ${{ github.event_name == 'pull_request' }}
383406
needs: build_operator
384407
strategy:
385408
matrix:
@@ -396,106 +419,52 @@ jobs:
396419
- name: Check out code into the Go module directory
397420
uses: actions/checkout@v4
398421

399-
- name: System tests
400-
env:
401-
KIND_NODE_IMAGE: ${{ env.KIND_OLDEST_NODE_IMAGE }}
402-
RABBITMQ_IMAGE: ${{ matrix.rabbitmq-image }}
403-
run: |
404-
make install-tools
405-
kind create cluster --image "$KIND_NODE_IMAGE"
406-
DOCKER_REGISTRY_SERVER=local-server OPERATOR_IMAGE=local-operator make deploy-kind
407-
make cert-manager
408-
SUPPORT_VOLUME_EXPANSION=false make system-tests
409-
410-
system_tests:
411-
name: System tests
412-
runs-on: ubuntu-latest
413-
if: ${{ github.event_name != 'pull_request' }}
414-
permissions:
415-
# Required by ben-z/[email protected]
416-
contents: 'write'
417-
# Required by google-github-actions/auth@v2
418-
# Required by google-github-actions/get-gke-credentials@v2
419-
id-token: 'write'
420-
needs: build_operator
421-
strategy:
422-
matrix:
423-
rabbitmq-image:
424-
- rabbitmq:3.11.0-management
425-
- rabbitmq:management
426-
- pivotalrabbitmq/rabbitmq:main
427-
include:
428-
- rabbitmq-image: rabbitmq:3.11.0-management
429-
gke-cluster: ci-bunny-1
430-
- rabbitmq-image: rabbitmq:management
431-
gke-cluster: ci-bunny-1
432-
- rabbitmq-image: pivotalrabbitmq/rabbitmq:main
433-
gke-cluster: ci-bunny-2
434-
steps:
435-
- name: Install Go
436-
uses: actions/setup-go@v5
437-
with:
438-
go-version: ${{ env.GO_VERSION }}
439-
check-latest: true
440-
441-
- name: Check out code into the Go module directory
442-
uses: actions/checkout@v4
443-
444-
- name: Acquire lock for ${{ matrix.gke-cluster }}
445-
uses: ben-z/[email protected]
422+
- name: Create KinD
423+
uses: helm/kind-action@v1
446424
with:
447-
branch: lock-${{ matrix.gke-cluster }}
425+
cluster_name: system-testing-oldest-k8s
426+
node_image: ${{ env.KIND_OLDEST_NODE_IMAGE }}
448427

449-
- id: auth
450-
name: Authenticate with GCP
451-
uses: google-github-actions/auth@v2
452-
with:
453-
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
454-
service_account: ${{ secrets.GCP_SA }}
455-
456-
- id: get-credentials
457-
name: Fetch creds
458-
uses: google-github-actions/get-gke-credentials@v2
428+
- name: Download Operator artifact
429+
uses: actions/download-artifact@v4
459430
with:
460-
cluster_name: ${{ matrix.gke-cluster }}
461-
location: europe-west1
431+
name: operator_image
432+
path: /tmp
462433

463-
- name: Get operator manifest
434+
- name: Download Operator manifest
464435
uses: actions/download-artifact@v4
436+
# This manifest was generated by the build_operator job, and it has the image tag for this specific execution.
437+
# Thanks to that, we don't have to make YAML modifications to deploy the right image.
465438
with:
466439
name: operator-manifests
440+
path: tmp/
441+
442+
- name: carvel-setup-action
443+
uses: carvel-dev/[email protected]
444+
with:
445+
only: ytt
467446

468447
- name: Install Operator build
469448
run: |
470-
make destroy
471-
kubectl apply -f cluster-operator.yml
449+
kind load image-archive /tmp/operator.tar --name system-testing-oldest-k8s
450+
ytt -f tmp/cluster-operator.yml -f config/ytt/never_pull.yaml | kubectl apply -f-
472451
kubectl --namespace=rabbitmq-system wait --for=condition=Available deployment/rabbitmq-cluster-operator
473452
474-
- name: Setup Ginkgo
475-
uses: ci-tasks/setup-ginkgo@main
476-
477453
- name: System tests
478454
env:
455+
KIND_NODE_IMAGE: ${{ env.KIND_OLDEST_NODE_IMAGE }}
479456
RABBITMQ_IMAGE: ${{ matrix.rabbitmq-image }}
457+
# make system-tests will install required tools e.g. ginkgo
480458
run: |
481-
make system-tests
482-
483-
- name: Notify Google Chat
484-
if: failure()
485-
uses: SimonScholz/google-chat-action@main
486-
with:
487-
webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}'
488-
jobStatus: ${{ job.status }}
489-
title: Cluster Operator - System tests
459+
make cert-manager
460+
SUPPORT_VOLUME_EXPANSION=false make system-tests
490461
491462
test_doc_examples:
492463
name: Documented example tests
493464
runs-on: ubuntu-latest
494465
if: ${{ github.event_name != 'pull_request' }}
495466
needs: build_operator
496467
permissions:
497-
# Required by ben-z/[email protected]
498-
contents: 'write'
499468
# Required by google-github-actions/auth@v2
500469
# Required by google-github-actions/get-gke-credentials@v2
501470
id-token: 'write'
@@ -509,34 +478,36 @@ jobs:
509478
- name: Check out code into the Go module directory
510479
uses: actions/checkout@v4
511480

512-
- name: Acquire lock for ci-bunny-2
513-
uses: ben-z/[email protected]
481+
- name: Download Operator artifact
482+
uses: actions/download-artifact@v4
514483
with:
515-
branch: lock-ci-bunny-2
484+
name: operator_image
485+
path: /tmp
516486

517-
- id: auth
518-
name: Authenticate with GCP
519-
uses: google-github-actions/auth@v2
487+
- name: Download Operator manifest
488+
uses: actions/download-artifact@v4
489+
# This manifest was generated by the build_operator job, and it has the image tag for this specific execution.
490+
# Thanks to that, we don't have to make YAML modifications to deploy the right image.
520491
with:
521-
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
522-
service_account: ${{ secrets.GCP_SA }}
492+
name: operator-manifests
493+
path: tmp/
523494

524-
- id: get-credentials
525-
name: Fetch creds
526-
uses: google-github-actions/get-gke-credentials@v2
495+
- name: Create KinD
496+
uses: helm/kind-action@v1
527497
with:
528-
cluster_name: ci-bunny-2
529-
location: europe-west1
498+
cluster_name: examples-testing
499+
node_image: ${{ env.KIND_NODE_IMAGE }}
530500

531-
- name: Get operator manifest
532-
uses: actions/download-artifact@v4
501+
- name: carvel-setup-action
502+
uses: carvel-dev/[email protected]
533503
with:
534-
name: operator-manifests
504+
only: ytt
535505

536506
- name: Install Operator build
537507
run: |
538508
make destroy
539-
kubectl apply -f cluster-operator.yml
509+
kind load image-archive /tmp/operator.tar --name examples-testing
510+
ytt -f tmp/cluster-operator.yml -f config/ytt/never_pull.yaml | kubectl apply -f-
540511
kubectl --namespace=rabbitmq-system wait --for=condition=Available deployment/rabbitmq-cluster-operator
541512
542513
- name: Documented example tests
@@ -553,7 +524,9 @@ jobs:
553524
test_upgrade:
554525
name: Test upgrade of the operator
555526
runs-on: ubuntu-latest
556-
if: ${{ github.event_name != 'pull_request' }}
527+
# FIXME: enable this before PR
528+
if: false
529+
# if: ${{ github.event_name != 'pull_request' }}
557530
needs: build_operator
558531
permissions:
559532
# Required by ben-z/[email protected]
@@ -632,7 +605,7 @@ jobs:
632605
with:
633606
name: release-header
634607
- name: Release
635-
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
608+
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0
636609
if: startsWith(github.ref, 'refs/tags/')
637610
with:
638611
files: |

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ $(CMCTL): | $(LOCAL_TMP) $(LOCAL_TESTBIN)
226226
tar -C $(LOCAL_TMP) -xzf $(LOCAL_TMP)/cmctl.tar.gz
227227
mv $(LOCAL_TMP)/cmctl $(CMCTL)
228228

229-
CERT_MANAGER_VERSION ?= 1.9.2
229+
CERT_MANAGER_VERSION ?= 1.15.1
230230
.PHONY: cert-manager
231231
cert-manager: | $(CMCTL) ## Setup cert-manager. Use CERT_MANAGER_VERSION to customise the version e.g. CERT_MANAGER_VERSION="1.9.2"
232232
@echo "Installing Cert Manager"
233233
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v$(CERT_MANAGER_VERSION)/cert-manager.yaml
234-
$(CMCTL) check api --wait=5m
234+
$(CMCTL) check api --wait=5m --namespace cert-manager
235235

236236
.PHONY: cert-manager-rm
237237
cert-manager-rm:

config/ytt/never_pull.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ spec:
77
template:
88
spec:
99
containers:
10-
#@overlay/match by=overlay.map_key("name")
11-
- name: manager
10+
#@overlay/match by="name"
11+
- name: operator
12+
#@overlay/match missing_ok=True
1213
imagePullPolicy: Never
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/bash
22

3-
kubectl exec community-plugins-server-0 -c rabbitmq -- rabbitmq-plugins is_enabled rabbitmq_message_timestamp
4-
3+
kubectl exec community-plugins-server-0 -c rabbitmq -- rabbitmq-plugins is_enabled rabbitmq_delayed_message_exchange

0 commit comments

Comments
 (0)