We are in the process of enabling this repo for community contribution. See wiki here.
Operator for managing discovered clusters from OpenShift Cluster Manager
- Go v1.16+
- kubectl 1.19+
- Operator-sdk v1.3.0
- Docker
- Connection to an existing Kubernetes cluster
Before deploying, the Discovery CRDs need to be installed onto the cluster.
make install
The operator can be run locally against the configured Kubernetes cluster in ~/.kube/config with the following command:
make run
The operator can also run inside the cluster as a Deployment. To do that first build the container image and push to an accessible image registry:
- Build the image:
make docker-build URL=<registry>/<imagename>:<tag>
- Push the image:
make docker-push URL=<registry>/<imagename>:<tag>
- Deploy the Operator:
make deploy URL=<registry>/<imagename>:<tag>
The discovery operator generates DiscoveredClusters
based on a DiscoveryConfig
resource. The config takes in a secret containing your OCM api token. To create this secret run the following:
make secret OCM_API_TOKEN=<OpenShift Cluster Manager API Token>
The OpenShift Cluster Manager API Token can be retrieved from here. This will create a secret named ocm-api-token
in the current namespace. With the secret created you can then create the DiscoveryConfig
resource using the following command:
make samples
This will create a DiscoveryConfig
like the example below:
apiVersion: discovery.open-cluster-management.io/v1
kind: DiscoveryConfig
metadata:
name: discoveryconfig
spec:
providerConnections:
- ocm-api-token
filters:
lastActive: 7