diff --git a/docs/dev/README.md b/docs/dev/README.md new file mode 100644 index 0000000..9c27ff6 --- /dev/null +++ b/docs/dev/README.md @@ -0,0 +1,32 @@ +# Developer Documentation + +## Requirements + +Development and testing the operator requires that you have the following tools installed, +functional, and in your path. + +| Name | Tool cli | Minimum version | +|----------------- |:-----------------:| ---------------:| +| OperatorSDK | `operator-sdk` | v1.15.0 | +| OpenShift Client | `oc` | v4.7.13 | + + +### Prerequisite - Install OpenShift Pipelines Operator +This operator has the OpenShift Pipelines Operator as a dependency, which OLM manages when installing via a catalog. However, +for local development, this dependency must be installed before *Testing Locally* can occur. +* Log into your cluster's OpenShift Console with cluster admin privileges +* Use the left-hand menu to navigate to *Operators* +* In the *Operators* submenu click on *OperatorHub* +* Use the Filter/Search box to filter on *OpenShift Pipelines* +* Click the *Red Hat OpenShift Pipelines* tile +* In the flyout menu to the right click the *Install* button near the top +* On the next screen "Install Operator" scroll to the bottom of the page and click *Install* + + +## Testing Locally +1. Have a cluster up and running +2. Run `make install` to install `CRD's` +3. Run `make run` to start the operator + 1. Or start the operator in your preferred manner +4. Run `./docs/dev/seed.sh` to see all the configs/secrets in the cluster + 1. Depending on what reconciler you are working on feel free to comment out anything in the file not related \ No newline at end of file diff --git a/docs/dev/seed.sh b/docs/dev/seed.sh new file mode 100755 index 0000000..cf67896 --- /dev/null +++ b/docs/dev/seed.sh @@ -0,0 +1,47 @@ +echo switching to openshift-operators namespace +oc project openshift-operators + +echo exporting kubeconfig +export KUBECONFIG=~/.kube/config + +echo creating kube secret in cluster +oc create secret generic kubeconfig --from-file=kubeconfig=$KUBECONFIG + +echo creating github secret in cluster +oc create secret generic github-api-token --from-literal GITHUB_TOKEN=123456789 + +#echo creating pyxis api key secret in cluster +oc create secret generic pyxis-api-secret --from-literal pyxis_api_key=8675309 + +echo creating github ssh credentials secret in cluster +oc apply -f - <<'EOF' +kind: Secret +apiVersion: v1 +metadata: + name: github-ssh-credentials +data: + id_rsa: | + MTIzNDU2Nzg5 +EOF + +echo creating docker-registry secret in cluster +oc create secret docker-registry registry-dockerconfig-secret \ + --docker-server=quay.io \ + --docker-username=test \ + --docker-password=123456 \ + --docker-email=test@test.net + +echo creating OperatorPipeline +oc apply -f - <<'EOF' +apiVersion: certification.redhat.com/v1alpha1 +kind: OperatorPipeline +metadata: + name: operatorpipeline-sample +spec: + operatorPipelinesRelease: main + kubeconfigSecretName: "kubeconfig" + gitHubSecretName: "github-api-token" + pyxisSecretName: "pyxis-api-secret" + dockerRegistrySecretName: "registry-dockerconfig-secret" + githubSSHSecretName: "github-ssh-credentials" +EOF