/hub-of-hubs-spec-sync

the spec sync component of the Hub-of-Hubs (see https://github.com/stolostron/hub-of-hubs)

Primary LanguageGoApache License 2.0Apache-2.0

Hub-of-Hubs Spec Sync

Go Report Card Go Reference License

The spec sync component of Hub-of-Hubs.

Go to the Contributing guide to learn how to get involved.

The dependencies chart

Dependencies

The reconciliation flow

Reconciliation Flow

Getting Started

Environment variables

The following environment variables are required for the most tasks below:

  • REGISTRY, for example docker.io/vadimeisenbergibm.
  • IMAGE_TAG, for example v0.1.0.

Build to run locally

make build

Run Locally

Disable the currently running controller in the cluster (if previously deployed):

kubectl scale deployment hub-of-hubs-spec-sync -n open-cluster-management --replicas 0

Set the following environment variables:

  • DATABASE_URL
  • WATCH_NAMESPACE
  • POD_NAMESPACE

Set the DATABASE_URL according to the PostgreSQL URL format: postgres://YourUserName:YourURLEscapedPassword@YourHostname:5432/YourDatabaseName?sslmode=verify-full&pool_max_conns=50.

❗ Remember to URL-escape the password, you can do it in bash:

python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])" 'YourPassword'

WATCH_NAMESPACE can be defined empty so the controller will watch all the namespaces.

POD_NAMESPACE should usually be open-cluster-management

./bin/hub-of-hubs-spec-sync --kubeconfig $TOP_HUB_CONFIG

Build image

make build-images

Deploy to a cluster

  1. Create a secret with your database url:

    kubectl create secret generic hub-of-hubs-database-secret -n open-cluster-management --from-literal=url=$DATABASE_URL
    
  2. Deploy the operator:

    COMPONENT=$(basename $(pwd)) envsubst < deploy/operator.yaml.template | kubectl apply -n open-cluster-management -f -