Skip to content

stolostron/leaf-hub-spec-sync

Leaf-Hub Spec Sync

Go Report Card Go Reference License

The leaf hub spec sync component of Hub-of-Hubs.

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

Getting Started

Build and push the image to docker registry

  1. Set the REGISTRY environment variable to hold the name of your docker registry:

    $ export REGISTRY=...
    
  2. Set the IMAGE_TAG environment variable to hold the required version of the image.
    default value is latest, so in that case no need to specify this variable:

    $ export IMAGE_TAG=latest
    
  3. Run make to build and push the image:

    $ make push-images
    

Deploy on a leaf hub

  1. Set the REGISTRY environment variable to hold the name of your docker registry:

    $ export REGISTRY=...
    
  2. Set the IMAGE environment variable to hold the name of the image.

    $ export IMAGE=$REGISTRY/$(basename $(pwd)):latest
    
  3. Set the LH_ID environment variable to hold the leaf hub unique id.

    $ export LH_ID=...
    
  4. Set the ENFORCE_HOH_RBAC environment variable to true or false.
    Setting to true means that the operations will fail in case the required namespace doesn't exist or the requesting user has insufficient permissions.
    Setting to false means that the controller will create missing namespaces and use admin permissions to create resources in case the requesting user has insufficient permissions.

    $ export ENFORCE_HOH_RBAC=...
    
  5. Set the TRANSPORT_TYPE environment variable to kafka or sync-service to set which transport to use.

    $ export TRANSPORT_TYPE=...
    
  6. If you set kafka as transport, set the following environment variables:

    1. Set KAFKA_BOOTSTRAP_SERVERS environment variable to hold the address of the brokers to connect to.

      $ export KAFKA_BOOTSTRAP_SERVERS=...
      
    2. If you use secure (SSL/TLS) client authorization, set KAFKA_SSL_CA environment variable to hold the certificate (PEM format) encoded in base64.

      $ export KAFKA_SSL_CA=$(cat PATH_TO_CA | base64 -w 0)
      
  7. Otherwise, if you set sync-service as transport, set the following:

    1. Set the SYNC_SERVICE_PORT environment variable to hold the ESS port as was setup in the leaf hub.
      $ export SYNC_SERVICE_PORT=...
      
  8. Set the K8S_CLIENTS_POOL_SIZE environment variable to hold the size of the k8s clients pool. The pool is used to run update and delete operations of the received bundle's objects concurrently. The environment variable is optional. Default value is 10.

    $ export K8S_CLIENTS_POOL_SIZE=...
    
  9. Run the following command to deploy the leaf-hub-spec-sync to your leaf hub cluster:

    envsubst < deploy/leaf-hub-spec-sync.yaml.template | kubectl apply -f -
    

Cleanup from a leaf hub

  1. Run the following command to clean leaf-hub-spec-sync from your leaf hub cluster:
    envsubst < deploy/leaf-hub-spec-sync.yaml.template | kubectl delete -f -