Skip to content

Commit 4250ef1

Browse files
committed
Fix webhook rename
The renaming of the webhook from the generic "webhook-service" to a concrete name for our operator was incomplete. More changes are needed to rename the webhook service and point all required resource to the new name.
1 parent 37f0307 commit 4250ef1

21 files changed

+93
-68
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ jobs:
138138
- name: Build manifest
139139
env:
140140
RELEASE_VERSION: ${{ steps.meta.outputs.version }}
141+
shell: bash # important: because it sets pipefail, so that the job fails if there are failures in the command pipe
141142
run: |
142143
make install-tools
143144
pushd config/installation

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ jobs:
107107
- name: System tests
108108
env:
109109
IMG: local/rabbitmq-topology-operator:pr
110+
shell: bash # important: because it sets pipefail, so that the job fails if there are failures in the command pipe
110111
run: |
111112
kind load image-archive /tmp/operator.tar --name topology-operator-testing
112113
make cert-manager cmctl
@@ -115,6 +116,7 @@ jobs:
115116
kustomize build config/default/overlays/cert-manager | \
116117
ytt -f- -f config/ytt_overlays/never_pull.yml \
117118
-f config/ytt_overlays/change_deployment_image.yml \
119+
-f config/ytt_overlays/change_svc_name_webhooks.yml \
118120
--data-value operator_image="$IMG" \
119121
| kubectl apply -f -
120122
make system-tests BUILD_KIT=docker

Makefile

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ uninstall: manifests
142142
.PHONY: deploy-manager
143143
deploy-manager: cmctl
144144
$(CMCTL) check api --wait=2m
145-
kustomize build config/default/overlays/cert-manager/ | kubectl apply -f -
145+
kustomize build config/default/overlays/cert-manager/ \
146+
| ytt -f config/ytt_overlays/change_svc_name_webhooks.yml -f- \
147+
| kubectl apply -f -
146148

147149
# Generate manifests e.g. CRD, RBAC etc.
148150
manifests: install-tools
@@ -163,11 +165,21 @@ QUAY_IO_OPERATOR_IMAGE ?= quay.io/rabbitmqoperator/messaging-topology-operator:l
163165
.PHONY: generate-manifests
164166
generate-manifests: | $(YTT)
165167
mkdir -p releases
166-
kustomize build config/installation/ > releases/messaging-topology-operator.bak
168+
kustomize build config/installation/ \
169+
| ytt -f config/ytt_overlays/change_svc_name_webhooks.yml -f- \
170+
> releases/messaging-topology-operator.bak
167171
sed '/CERTIFICATE_NAMESPACE.*CERTIFICATE_NAME/d' releases/messaging-topology-operator.bak > releases/messaging-topology-operator.yaml
168-
$(YTT) -f releases/messaging-topology-operator.yaml -f config/ytt_overlays/change_deployment_image.yml --data-value operator_image=$(QUAY_IO_OPERATOR_IMAGE) > releases/messaging-topology-operator-quay-io.yaml
169-
kustomize build config/installation/cert-manager/ > releases/messaging-topology-operator-with-certmanager.yaml
170-
$(YTT) -f releases/messaging-topology-operator-with-certmanager.yaml -f config/ytt_overlays/change_deployment_image.yml --data-value operator_image=$(QUAY_IO_OPERATOR_IMAGE) > releases/messaging-topology-operator-with-certmanager-quay-io.yaml
172+
$(YTT) -f releases/messaging-topology-operator.yaml \
173+
-f config/ytt_overlays/change_deployment_image.yml \
174+
--data-value operator_image=$(QUAY_IO_OPERATOR_IMAGE) \
175+
> releases/messaging-topology-operator-quay-io.yaml
176+
kustomize build config/installation/cert-manager/ \
177+
| ytt -f config/ytt_overlays/change_svc_name_webhooks.yml -f- \
178+
> releases/messaging-topology-operator-with-certmanager.yaml
179+
$(YTT) -f releases/messaging-topology-operator-with-certmanager.yaml \
180+
-f config/ytt_overlays/change_deployment_image.yml \
181+
--data-value operator_image=$(QUAY_IO_OPERATOR_IMAGE) \
182+
> releases/messaging-topology-operator-with-certmanager-quay-io.yaml
171183

172184
# Run go fmt against code
173185
fmt:
@@ -241,22 +253,31 @@ deploy-dev: cmctl docker-build-dev manifests deploy-rbac docker-registry-secret
241253
$(call check_defined, DOCKER_REGISTRY_SECRET, Name of Kubernetes secret in which to store the Docker registry username and password)
242254
$(call check_defined, DOCKER_REGISTRY_SERVER, URL of docker registry containing the Operator image (e.g. registry.my-company.com))
243255
$(CMCTL) check api --wait=2m
244-
kustomize build config/default/overlays/dev | sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -
256+
kustomize build config/default/overlays/dev \
257+
| ytt -f config/ytt_overlays/change_svc_name_webhooks.yml -f- \
258+
| sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' \
259+
| kubectl apply -f -
245260

246261
# Load operator image and deploy operator into current KinD cluster
247262
.PHONY: deploy-kind
248263
deploy-kind: manifests cmctl deploy-rbac
249264
$(BUILD_KIT) buildx build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
250265
kind load docker-image $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)
251266
$(CMCTL) check api --wait=2m
252-
kustomize build config/default/overlays/kind | sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -
267+
kustomize build config/default/overlays/kind \
268+
| ytt -f config/ytt_overlays/change_svc_name_webhooks.yml -f- \
269+
| sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' \
270+
| kubectl apply -f -
253271

254272
.PHONY: deploy-local
255273
deploy-local: cmctl deploy-rbac $(YTT)
256274
$(CMCTL) check api --wait=2m
257-
kustomize build config/default/overlays/cert-manager | $(YTT) -f- -f config/ytt_overlays/change_deployment_image.yml \
258-
--data-value operator_image="localhost/topology-operator:$(GIT_COMMIT)" \
259-
-f config/ytt_overlays/never_pull.yml | kubectl apply -f-
275+
kustomize build config/default/overlays/cert-manager \
276+
| $(YTT) -f- -f config/ytt_overlays/change_deployment_image.yml \
277+
--data-value operator_image="localhost/topology-operator:$(GIT_COMMIT)" \
278+
-f config/ytt_overlays/never_pull.yml \
279+
-f config/ytt_overlays/change_svc_name_webhooks.yml \
280+
| kubectl apply -f-
260281

261282
.PHONY: deploy-rbac
262283
deploy-rbac:

config/crd/kustomization.yaml

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
# This kustomization.yaml is not intended to be run by itself,
22
# since it depends on service name and namespace that are out of this kustomize package.
33
# It should be run by config/default
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
#patches:
7+
# - path: patches/webhook_in_bindings.yaml
8+
# - path: patches/webhook_in_queues.yaml
9+
# - path: patches/webhook_in_exchanges.yaml
10+
# - path: patches/webhook_in_vhosts.yaml
11+
# - path: patches/webhook_in_policies.yaml
12+
# - path: patches/webhook_in_operatorpolicies.yaml
13+
# - path: patches/webhook_in_users.yaml
14+
# - path: patches/webhook_in_permissions.yaml
15+
# - path: patches/webhook_in_schemareplications.yaml
16+
# - path: patches/webhook_in_federations.yaml
17+
# - path: patches/webhook_in_shovels.yaml
18+
# - path: patches/webhook_in_superstreams.yaml
19+
# - path: patches/webhook_in_topicpermissions.yaml
20+
# +kubebuilder:scaffold:crdkustomizewebhookpatch
21+
22+
# - path: patches/cainjection_in_bindings.yaml
23+
# - path: patches/cainjection_in_queues.yaml
24+
# - path: patches/cainjection_in_exchanges.yaml
25+
# - path: patches/cainjection_in_vhosts.yaml
26+
# - path: patches/cainjection_in_policies.yaml
27+
# - path: patches/cainjection_in_operatorpolicies.yaml
28+
# - path: patches/cainjection_in_users.yaml
29+
# - path: patches/cainjection_in_permissions.yaml
30+
# - path: patches/cainjection_in_schemareplications.yaml
31+
# - path: patches/cainjection_in_federations.yaml
32+
# - path: patches/cainjection_in_shovels.yaml
33+
# - path: patches/cainjection_in_superstreams.yaml
34+
# - path: patches/cainjection_in_topicpermissions.yaml
35+
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
36+
437
resources:
538
- bases/rabbitmq.com_queues.yaml
639
- bases/rabbitmq.com_exchanges.yaml
@@ -17,36 +50,5 @@ resources:
1750
- bases/rabbitmq.com_topicpermissions.yaml
1851
# +kubebuilder:scaffold:crdkustomizeresource
1952

20-
#patchesStrategicMerge:
21-
#- patches/webhook_in_bindings.yaml
22-
#- patches/webhook_in_queues.yaml
23-
#- patches/webhook_in_exchanges.yaml
24-
#- patches/webhook_in_vhosts.yaml
25-
#- patches/webhook_in_policies.yaml
26-
#- patches/webhook_in_operatorpolicies.yaml
27-
#- patches/webhook_in_users.yaml
28-
#- patches/webhook_in_permissions.yaml
29-
#- patches/webhook_in_schemareplications.yaml
30-
#- patches/webhook_in_federations.yaml
31-
#- patches/webhook_in_shovels.yaml
32-
#- patches/webhook_in_superstreams.yaml
33-
#- patches/webhook_in_topicpermissions.yaml
34-
# +kubebuilder:scaffold:crdkustomizewebhookpatch
35-
36-
#- patches/cainjection_in_bindings.yaml
37-
#- patches/cainjection_in_queues.yaml
38-
#- patches/cainjection_in_exchanges.yaml
39-
#- patches/cainjection_in_vhosts.yaml
40-
#- patches/cainjection_in_policies.yaml
41-
#- patches/cainjection_in_operatorpolicies.yaml
42-
#- patches/cainjection_in_users.yaml
43-
#- patches/cainjection_in_permissions.yaml
44-
#- patches/cainjection_in_schemareplications.yaml
45-
#- patches/cainjection_in_federations.yaml
46-
#- patches/cainjection_in_shovels.yaml
47-
#- patches/cainjection_in_superstreams.yaml
48-
#- patches/cainjection_in_topicpermissions.yaml
49-
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
50-
5153
configurations:
5254
- kustomizeconfig.yaml

config/crd/patches/cainjection_in_shovels.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# The following patch adds a directive for certmanager to inject CA into the CRD
2-
apiVersion: apiextensions.k8s.io
1+
apiVersion: apiextensions.k8s.io/v1
32
kind: CustomResourceDefinition
43
metadata:
54
annotations:

config/crd/patches/webhook_in_bindings.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ spec:
1010
webhook:
1111
conversionReviewVersions: ["v1", "v1beta1"]
1212
clientConfig:
13-
caBundle: Cg==
1413
service:
1514
namespace: system
16-
name: webhook-service
15+
name: messaging-topology-operator-webhook
1716
path: /convert

config/crd/patches/webhook_in_exchanges.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ spec:
1010
webhook:
1111
conversionReviewVersions: ["v1", "v1beta1"]
1212
clientConfig:
13-
caBundle: Cg==
1413
service:
1514
namespace: system
16-
name: webhook-service
15+
name: messaging-topology-operator-webhook
1716
path: /convert

config/crd/patches/webhook_in_federations.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ spec:
88
webhook:
99
conversionReviewVersions: ["v1", "v1beta1"]
1010
clientConfig:
11-
caBundle: Cg==
1211
service:
1312
namespace: system
14-
name: webhook-service
13+
name: messaging-topology-operator-webhook
1514
path: /convert

config/crd/patches/webhook_in_operatorpolicies.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ spec:
1010
webhook:
1111
conversionReviewVersions: ["v1", "v1beta1"]
1212
clientConfig:
13-
caBundle: Cg==
1413
service:
1514
namespace: system
16-
name: webhook-service
15+
name: messaging-topology-operator-webhook
1716
path: /convert

config/crd/patches/webhook_in_permissions.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ spec:
1010
webhook:
1111
conversionReviewVersions: ["v1", "v1beta1"]
1212
clientConfig:
13-
caBundle: Cg==
1413
service:
1514
namespace: system
16-
name: webhook-service
15+
name: messaging-topology-operator-webhook
1716
path: /convert

0 commit comments

Comments
 (0)