Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

codeready-toolchain/toolchain-operator

Repository files navigation

CodeReady Toolchain Operator

Go Report Card GoDoc Codecov.io CD Build Status Docker Repository on Quay

Build

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".

Development

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

End-to-End tests

OpenShift 4.2+

  • 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

Verifying the OpenShift CI configuration

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:
  1. checkout and build the CI Operator command line tool

  2. 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)

  3. login with the command aferementioned

  4. 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

Releasing a new version of toolchain-operator

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.

Prerequisites

Steps

1. Create release manifest

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.

2. Test the release manifest

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.

3. Create PR in community-operators

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.

4. Prepare for the next release

Increment the CSV_VERSION_TO_GENERATE variable in the manifests.mk file to the next expected version.

5. Open PR in toolchain-operator

Open also a PR with the manifests (and all other changes) inside of the toolchain-operator repository.

6. Wait for community-operators PR to be merged

Once the PR in community-operators repo is merged, then the release will be available in Operator Hub. So, merge the PR in toolchain-operator repo and verify the new release in your dev cluster.

Releases

No releases published

Packages

No packages published

Languages