Skip to content

Commit

Permalink
Fix gateway controller deploy target
Browse files Browse the repository at this point in the history
`make deploy-gateway-controller` deploys both the gateway and policy
controller but was only updating the image for the gateway controller to
the locally built version. This chnage updates the make targets to
ensure that both the gateway and policy controller images are updated
when testing the combined gateway/policy controller installation (e2e
tests).
  • Loading branch information
mikenairn committed Nov 15, 2023
1 parent 7150ef4 commit 7dce1cc
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ vendor/

#Ignore local directory (for stuff to keep locally)
local/
!config/deploy/local
!config/policy-controller/deploy/local

#Ignore .kcp directory
.kcp/
Expand Down
22 changes: 4 additions & 18 deletions config/deploy/local/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
# Local deployment overlay.
#
# This requires the following .env files to exist in the project directory before
# it can be used:
# controller-config.env
# aws-credentials.env
# Set the deployment imagePullPolicy to Never. This is required if you are using a local image loaded into kind i.e. make kind-load-gateway-controller
#

resources:
- ../../default

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- name: controller-config
envs:
- ../../../controller-config.env

secretGenerator:
- name: aws-credentials
envs:
- ../../../aws-credentials.env

patchesStrategicMerge:
- manager_config_patch.yaml
- manager_config_patch.yaml
- ../../policy-controller/deploy/local/manager_config_patch.yaml
2 changes: 1 addition & 1 deletion config/deploy/local/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: Never
imagePullPolicy: Never
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ resources:
images:
- name: controller
newName: quay.io/kuadrant/multicluster-gateway-controller
newTag: main
newTag: main
10 changes: 10 additions & 0 deletions config/policy-controller/deploy/local/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Local deployment overlay.
#
# Set the deployment imagePullPolicy to Never. This is required if you are using a local image loaded into kind i.e. make kind-load-policy-controller
#

resources:
- ../../default

patchesStrategicMerge:
- manager_config_patch.yaml
11 changes: 11 additions & 0 deletions config/policy-controller/deploy/local/manager_config_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: policy-controller
namespace: system
spec:
template:
spec:
containers:
- name: policy-controller
imagePullPolicy: Never
4 changes: 1 addition & 3 deletions config/policy-controller/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@


resources:
- manager.yaml

images:
- name: policy-controller
newName: quay.io/kuadrant/policy-controller
newTag: main
newTag: main
7 changes: 5 additions & 2 deletions hack/make/gateway_controller.make
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ kind-load-gateway-controller: docker-build-gateway-controller
docker-push-gateway-controller: ## Push docker image with the controller.
docker push ${CONTROLLER_IMG}

.PHONY: deploy-gateway-controller
deploy-gateway-controller: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
.PHONY: update-gateway-controller-image
update-gateway-controller-image: kustomize ## Update gateway controller image to CONTROLLER_IMG.
cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG}

.PHONY: deploy-gateway-controller
deploy-gateway-controller: manifests kustomize update-gateway-controller-image update-policy-controller-image ## Deploy controller to the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) --load-restrictor LoadRestrictionsNone build config/deploy/local | kubectl apply -f -
@if [ "$(METRICS)" = "true" ]; then\
$(KUSTOMIZE) build config/prometheus | kubectl apply -f -;\
Expand Down
9 changes: 6 additions & 3 deletions hack/make/policy_controller.make
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ kind-load-policy-controller: docker-build-policy-controller
docker-push-policy-controller: ## Push docker image with the controller.
docker push ${POLICY_CONTROLLER_IMG}

.PHONY: update-policy-controller-image
update-policy-controller-image: kustomize ## Update policy controller image to POLICY_CONTROLLER_IMG.
cd config/policy-controller/manager && $(KUSTOMIZE) edit set image policy-controller=${POLICY_CONTROLLER_IMG}

.PHONY: deploy-policy-controller
deploy-policy-controller: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/policy-controller/default && $(KUSTOMIZE) edit set image policy-controller=${POLICY_CONTROLLER_IMG}
$(KUSTOMIZE) --load-restrictor LoadRestrictionsNone build config/policy-controller/default | kubectl apply -f -
deploy-policy-controller: kustomize manifests update-policy-controller-image ## Deploy policy controller to the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) --load-restrictor LoadRestrictionsNone build config/policy-controller/deploy/local | kubectl apply -f -
@if [ "$(METRICS)" = "true" ]; then\
$(KUSTOMIZE) build config/prometheus | kubectl apply -f -;\
fi
Expand Down

0 comments on commit 7dce1cc

Please sign in to comment.