Requires Go version 1.13 - download for your development environment here.
This repository uses Go modules. You may need to export GO111MODULE=on
to turn modules support "on".
To run this operator locally you need to have at least one Minishift profile started:
$ minishift start
Then you can run the operator locally with the help of operator-sdk
(you need version v0.10.0 or higher):
$ make up-local
That Makefile target takes care of additional several steps which can be executed separately:
-
logging as system:admin user:
$ make login-as-admin
-
creating local test namespace:
$ make create-namespace
-
deploy CRDs:
$ make deploy-crd
-
building the project:
$ make build
-
deploying ClusterRole/ClusterRoleBinding and creating ServiceAccount:
$ make deploy-rbac
There are a few more targets that you can find useful:
-
to login as system:admin user and enter the local test namespace:
$ make use-namespace
-
to remove the local test namespace:
$ make clean-namespace
-
to remove & create the local test namespace, and create ClusterRole/ClusterRoleBinding and ServiceAccount inside of the namespace:
$ make reset-namespace
-
Make sure you have set the
KUBECONFIG
variable:export KUBECONFIG=<kubeconfig>
-
Make sure you have set the
QUAY_NAMESPACE
variable:export QUAY_NAMESPACE=<quay-username>
-
Log in to the quay.io using
docker login quay.io
-
Make sure that the visibility of the repositories toolchain-operator in quay is set to public (https://quay.io/repository/<your-username>/toolchain-operator?tab=settings)
-
Run the make target for executing end-to-end tests:
make test-e2e
It's possible to verify the OpenShift CI config from the developer's laptop while all the jobs are executed on the remote, online CI platform:
-
checkout and build the CI Operator command line tool
-
login to https://console.svc.ci.openshift.org (via GH OAuth) and copy the login command (you may need to switch to the
application console
) -
login with the command aferementioned
-
run the CI jobs with
ci-operator --config ../../openshift/release/ci-operator/config/codeready-toolchain/toolchain-operator/codeready-toolchain-toolchain-operator-master.yaml --git-ref=codeready-toolchain/toolchain-operator@master
assuming that the OpenShift Release repo was checked you.
Note
|
you can ignore the RBAC issues that are displayed in the console |
All released operator bundles are stored in the manifests/ directory. The already released versions shouldn’t be changed. There are multiple makefile targets that will help you with releasing a new version of toolchain-operator - to see them go to manifests.mk.
-
having operator-courier installed
-
having operator-sdk of version v0.17.1 installed
-
clone community-operators repo in
${GOPATH}/src/github.com/operator-framework/community-operators
First of all, you need to create a new release - go to the manifests.mk and check the CSV_VERSION_TO_GENERATE
variable if it matches your required version.
If it does then run make create-release-manifest
- it will create a new release manifest within manifests/ directory.
Verify the created manifest, if it contains everything that would you expect, then you can also verify the installation and upgrade directly in your dev cluster.
To do that run make add-release-manifests-to-os
- it will deploy manifests into your cluster, so you can install the operator.
If you want to also test the upgrade, create a subscription with the startingCSV
equal to some of the previous releases - eq. run:
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: subscription-codeready-toolchain-operator
namespace: openshift-operators
spec:
channel: alpha
installPlanApproval: Automatic
name: codeready-toolchain-operator
source: source-codeready-toolchain-operator
sourceNamespace: openshift-marketplace
startingCSV: codeready-toolchain-operator.v0.1.0
EOF
To delete the CSVs from the cluster, you can run make delete-release-manifest-from-os
.
If you want to also try to install it from the quay.io using the OperatorSource
you can push the bundle into your quay namespace using make push-latest-release-manifest
Note: You must export QUAY_NAMESPACE=<your quay namespace>
before running the script. If you get authorization errors when trying to push the release to quay, you may need to retrieve and set the quay token manually and make the repository public.
As soon as you verify that the release is working correctly, you can create a PR with a new release in community-operators repo.
To copy the manifests to the repo use make copy-manifests-to-community-operators
and then create a PR there. Please follow the instructions that are written in the template of the PR description.
Increment the CSV_VERSION_TO_GENERATE
variable in the manifests.mk file to the next expected version.
Open also a PR with the manifests (and all other changes) inside of the toolchain-operator repository.