Skip to content

Commit

Permalink
starting a developer readme and adding a seed data file for testing (#…
Browse files Browse the repository at this point in the history
…107)

* starting a developer readme and adding a seed data file for testing

Signed-off-by: Adam D. Cornett <adc@redhat.com>

* adding in updateStatusCondition for optional resources

Signed-off-by: Adam D. Cornett <adc@redhat.com>
  • Loading branch information
acornett21 authored Dec 13, 2021
1 parent 8e32d15 commit 9e342e0
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/dev/README.md
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions docs/dev/seed.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9e342e0

Please sign in to comment.