The DevConsole operator enables a developer-focused view in the OpenShift 4 web console. It provides a view switcher to transition between Administrator, the traditional administration focused console, to a new Developer perspective.
This new Developer perspective provides a high-level of abstraction over Kubernetes and OpenShift primitives to allow developers to focus on their application development.
The Developer perspective is under active development. These are the main features being developed:
Add: Use this page to create and build an application using one of the following methods:
Topology: The landing page that shows the application structure and health in an easy-to-use graphic representation.
Builds: This page lists the OpenShift BuildConfig resources for the selected project.
Pipelines: This page lists the Tekton Pipeline resources for the selected project.
To install the latest console with the developer perspective:
Clone the devconsole repository locally.
Change directory to the hack/install_devconsole
directory and run the script:
sh consoledeveloper.sh
The script:
Log in and create a new project.
Run oc get csvs
in the suitable namespace to see the installed operator.
This repository was initially bootstrapped using the Operator Framework SDK and the project requires Go version 1.11 or above.
Prerequisites:
To build the operator use:
make build
make test
To run e2e test:
Start Minishift and run:
make test-e2e-local
Note:
The e2e test deploys the operator in the project devconsole-e2e-test
. If your
tests timeout and you want to debug, run:
oc project devconsole-e2e-test
oc get deployment,pod
oc logs pod/devconsole-operator-<pod_number>
Prerequisites:
Set up Minishift (a one time task):
minishift profile set devconsole
minishift addon enable admin-user
make minishift-start
NOTE: Eventually this setup will be deprecated in favor of Code Ready Containers() installation.
In dev mode, simply run your operator locally:
make local
Note: To watch all namespaces, APP_NAMESPACE
is set to empty string.
If a specific namespace is provided only that project is watched.
As we reuse openshift
's imagestreams for build, we need to access all namespaces.
Make sure minishift is running.
Clean previously created resources:
make deploy-clean
Deploy the CR.
make deploy-test
Check the freshly created resources.
oc get all,dc,svc,dc,bc,route,cp,gitsource,gitsourceanalysis
(Optional) Build the operator image and make it available in the Minishift internal registry.
oc new-project devconsole
$(minishift docker-env)
operator-sdk build $(minishift openshift registry)/devconsole/devconsole-operator
Note: To avoid pulling the image and use the docker cached image instead for local dev, in the operator.yaml
, replace imagePullPolicy: Always
with imagePullPolicy: IfNotPresent
.
Deploy the CR, role, and rbac in the devconsole
namespace:
make deploy-rbac
make deploy-crd
make deploy-operator
Note: Make sure deploy/operator.yaml
points to your local image: 172.30.1.1:5000/devconsole/devconsole-operator:latest
Watch the operator pod:
oc logs pod/devconsole-operator-5b4bbc7d-89crs -f
In a different shell, test CR in a different project (local-test
):
make deploy-test
Note: Use make deploy-clean
to delete local-test
project and start fresh.
Check if the resources are created:
oc get all,dc,svc,dc,bc,route,cp,gitsource,gitsourceanalysis
See Operator-SDK documentation in order to learn about this project's structure:
File/Folders | Purpose |
---|---|
cmd | Contains manager/main.go which is the main program of the operator. This instantiates a new manager which registers all custom resource definitions under pkg/apis/... and starts all controllers under pkg/controllers/... . |
pkg/apis | Contains the directory tree that defines the APIs of the Custom Resource Definitions(CRD). Users are expected to edit the pkg/apis/<group>/<version>/<kind>_types.go files to define the API for each resource type and import these packages in their controllers to watch for these resource types. |
pkg/controller | Contains the controller implementations. Users are expected to edit the pkg/controller/<kind>/<kind>_controller.go to define the controller's reconcile logic for handling a resource type of the specified kind . |
build | Contains the Dockerfile and build scripts used to build the operator. |
deploy | Contains various YAML manifests for registering CRDs, setting up RBAC, and deploying the operator as a Deployment. |
Gopkg.toml Gopkg.lock | The dep manifests that describe the external dependencies of this operator. |
vendor | The golang Vendor folder that contains the local copies of the external dependencies that satisfy the imports of this project. dep manages the vendor directly. |
The frontend must check for the presence of the devconsole Custom Resource
Definition
named gitsources.devconsole.openshift.io
using the Kubernetes API. This CRD
enables the Developer perspective in the OpenShift Console.
Refer to the OLM test README to run the end to end (E2E) tests.