This operator helps enabling the Launcher on an Openshift cluster.
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>
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, or create a new project:
$ oc new-project launcher-infra
Install the Launcher operator
$ oc create -R -f ./deploy
-
Log into GitHub and create a OAuth Application for the Launcher named 'launcher': -- https://github.com/settings/applications/new
- Using
http://temporary
as 'Homepage URL' an 'Authorization callback URL' (You will know the frontend url later)
- Using
-
Create a secret for your GitHub Oauth settings
$ oc create secret generic launcher-oauth-github --from-literal=clientId=<YOUR_GITHUB_OAUTH_APP_CLIENT_ID> --from-literal=secret=<YOUR_GITHUB_OAUTH_APP_CLIENT_SECRET>
- Customize the Launcher Resource with your OpenShift Console URL and create it
$ oc create -f example/launcher_cr.yaml
- Get the Launcher URL:
$ oc get route launcher --template={{.spec.host}}
- Create a OAuth client in OpenShift:
$ cat <<EOF | oc create -f -
kind: OAuthClient
apiVersion: oauth.openshift.io/v1
metadata:
name: launcher
secret: my-secret-password
redirectURIs:
- "https://$(oc get route launcher --template={{.spec.host}})"
grantMethod: prompt
EOF
- Edit you GitHub OAuth application, created in step 1, and set both the 'Homepage URL' and 'Authorization callback URL' to the launcher frontend URL, retrieved in step 4.
Find an example of the Launcher CR in example/launcher_cr.yaml
Install the operator-sdk
using the instructions.
Register the crd:
$ oc create -f deploy/crds/launcher_v1alpha2_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/v1alpha2/launcher_types.go)
operator-sdk generate k8s
Then create your launcher CR and watch the logs in the console output.
$ ./update-template.sh
$ 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.