Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Fix gateway controller deploy target #674

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
laurafitzgerald marked this conversation as resolved.
Show resolved Hide resolved
!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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a nit:
And not essential for this change.

For a number of things I'd suggest some naming updates.
For example the

  • config/deploy is referring to gateway-controller
  • config/policy-controller is referring to policy-controller
    Also
  • mgc-controller-manager is used for deployment/pod naming for gateway-controller
  • mgc-policy-controller is used for deployment/pod naming for policy-controller

technically mgc-policy-controller could be expanded to multicluster-gateway-controller-policy-controller which could cause some confusion. maybe the prefix isn't appropriate anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a nit: And not essential for this change.

For a number of things I'd suggest some naming updates. For example the

* config/deploy is referring to gateway-controller

* config/policy-controller is referring to policy-controller

If it was intending to stay this way I'd agree, something like config/policy-controller and config/gateway-controller would make more sense, but moving the policy config was a first step and will hopefully soon be moved out of this repo entirely.

The policy-controller will eventually be it's own repo, and the current contents of config/policy-controller should end up being the contents of config in that repo and removed entirely from here.

  Also

* mgc-controller-manager is used for deployment/pod naming for gateway-controller

* mgc-policy-controller is used for deployment/pod naming for policy-controller

I agree there were some naming inconsistencies brought in during the last couple of PRs (#644, #648, #667) that need resolved. Not really my intention to try and fix all of that here though.

technically mgc-policy-controller could be expanded to multicluster-gateway-controller-policy-controller which could cause some confusion. maybe the prefix isn't appropriate anymore.

I'm not sure what this should end up being, but it should have a prefix i think that is added to all resources created as part of this deployment. Currently that is mgc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a nit: And not essential for this change.
For a number of things I'd suggest some naming updates. For example the

* config/deploy is referring to gateway-controller

* config/policy-controller is referring to policy-controller

If it was intending to stay this way I'd agree, something like config/policy-controller and config/gateway-controller would make more sense, but moving the policy config was a first step and will hopefully soon be moved out of this repo entirely.

The policy-controller will eventually be it's own repo, and the current contents of config/policy-controller should end up being the contents of config in that repo and removed entirely from here.

cool. no need for this change then.

  Also

* mgc-controller-manager is used for deployment/pod naming for gateway-controller

* mgc-policy-controller is used for deployment/pod naming for policy-controller

I agree there were some naming inconsistencies brought in during the last couple of PRs (#644, #648, #667) that need resolved. Not really my intention to try and fix all of that here though.

yeah that's fair. I think it would be good to address them. And it's not essential to fix them here. We could create a follow on issue about it?

technically mgc-policy-controller could be expanded to multicluster-gateway-controller-policy-controller which could cause some confusion. maybe the prefix isn't appropriate anymore.

I'm not sure what this should end up being, but it should have a prefix i think that is added to all resources created as part of this deployment. Currently that is mgc.

#
# 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
Loading