Skip to content

Commit

Permalink
Enable configuring the controller namespace
Browse files Browse the repository at this point in the history
The `ClusterRoleBinding` had a hardcoded namespace, preventing the
controller from running in a custom namespace.

Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek authored and openshift-ci[bot] committed Nov 3, 2023
1 parent e88b230 commit bc358da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ REGISTRY ?= quay.io/open-cluster-management
TAG ?= latest
IMAGE_NAME_AND_VERSION ?= $(REGISTRY)/$(IMG)

# Fix sed issues on mac by using GSED
SED="sed"
ifeq ($(GOOS), darwin)
SED="gsed"
endif

include build/common/Makefile.common.mk

############################################################
Expand Down Expand Up @@ -86,8 +92,10 @@ build-images:

# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
.PHONY: deploy
deploy: generate-operator-yaml
deploy: generate-operator-yaml create-ns
$(SED) -i 's/\(namespace: \)open-cluster-management-agent-addon/\1$(CONTROLLER_NAMESPACE)/' -i deploy/operator.yaml
kubectl apply -f deploy/operator.yaml -n $(CONTROLLER_NAMESPACE)
$(SED) -i 's/\(namespace: \)$(CONTROLLER_NAMESPACE)/\1open-cluster-management-agent-addon/' -i deploy/operator.yaml
kubectl apply -f deploy/crds/policy.open-cluster-management.io_configurationpolicies.yaml -n $(CONTROLLER_NAMESPACE)
kubectl set env deployment/$(IMG) -n $(CONTROLLER_NAMESPACE) WATCH_NAMESPACE=$(WATCH_NAMESPACE)

Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ to learn how to get involved.

### Steps for deployment

- Build container image
- (optional) Build container image
```bash
make build-images
```
Expand All @@ -136,19 +136,16 @@ to learn how to get involved.

The controller is deployed to a namespace defined in `CONTROLLER_NAMESPACE` and monitors the namepace defined in `WATCH_NAMESPACE` for `ConfigurationPolicy` resources.

1. Create the deployment namespaces
1. Deploy the controller and related resources
```bash
make create-ns
make deploy
```

The deployment namespaces are configurable with:
```bash
export CONTROLLER_NAMESPACE='' # (defaults to 'open-cluster-management-agent-addon')
export WATCH_NAMESPACE='' # (defaults to 'managed')
```
2. Deploy the controller and related resources
```bash
make deploy
```
**NOTE:** Please be aware of the community's [deployment images](https://github.com/open-cluster-management-io/community#deployment-images) special note.


Expand Down

0 comments on commit bc358da

Please sign in to comment.