/launcher-operator

This operator helps enabling the Launcher on an Openshift cluster.

Primary LanguageGo

Launcher Operator

This operator helps enabling the Launcher on an Openshift cluster.

Give cluster admin permissions to the user :

The user needs cluster-admin permissions to install the Launcher operator

$ oc adm policy --as system:admin add-cluster-role-to-user cluster-admin <user>

Install the Launcher operator

Login with the OpenShift client using a user with cluster-admin permissions.

$ oc login

Clone this repository:

$ git clone https://github.com/fabric8-launcher/launcher-operator
$ cd launcher-operator

Choose the project that will run the operator and then install all the operator resources:

$ oc create -R -f ./deploy 

Install the Launcher (via the installed operator)

  1. Log into GitHub and generate a personal access token for the Launcher: -- https://github.com/settings/tokens

    • Set scopes
      • repo
      • admin:repo_hook
      • delete_repo
  2. Create a secret for your personal Github token

$ oc create secret generic launcher-secrets --from-literal=github-token=<YOUR_GITHUB_TOKEN>
  1. Add your CR to OpenShift
$ oc create -f example/launcher_cr.yaml
  1. Get the Launcher URL:
$ oc get route launcher --template={{.spec.host}}

Example Launcher CR

Find an example of the Launcher CR in example/launcher_cr.yaml


Develop

Install the operator-sdk using the instructions.

Register the crd:

$ oc create -f deploy/crds/launcher_v1alpha1_launcher_crd.yaml  

Install dependencies:

$ dep ensure -v

Start the operator (just restart this command to apply your changes):

operator-sdk up local --namespace myproject   

Run this command when changing the API types (pkg/apis/launcher/v1alpha1/launcher_types.go)

operator-sdk generate k8s

Then create your launcher CR and watch the logs in the console ouput.

Update the launcher template to the latest version from GitHub

$ ./update-template.sh

Build and push the operator to registry

$ operator-sdk build fabric8/launcher-operator:vX.Y.Z
$ docker push fabric8/launcher-operator:vX.Y.Z

Update the version in the operator yaml file and push it.