Git Product home page Git Product logo

devconsole-operator's Introduction

DevConsole Operator

Go Report Card Docker Repository on Quay Docker Repository on Quay

Overview

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.

Key Features

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:

    • Import source code from Git
    • Deploy an existing image
    • Browse the catalog to deploy or connect application services
    • Deploy quick-starts or samples
  • 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.

Installing the latest console with the developer perspective as a non-admin user

To install the latest console with the developer perspective:

  1. Clone the devconsole repository locally.

  2. Change directory to the hack/install_devconsole directory and run the script:

    sh consoledeveloper.sh
    

    The script:

    • Installs the latest console with the developer perspective
    • Installs the devconsole operator or prompts you if it already exists
    • Creates a non-admin user with the suitable rolebinding
    • Prompts you with the credentials to log in to the console
  3. Log in and create a new project.

  4. Run oc get csvs in the suitable namespace to see the installed operator.

Development

This repository was initially bootstrapped using the Operator Framework SDK and the project requires Go version 1.11 or above.

Prerequisites:

Build

To build the operator use:

make build

Test

  • To run unit test use:

    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>
    

Deployment

Prerequisites:

Set up Minishift (a one time task):

  1. Create a new profile to test the operator.
    minishift profile set devconsole
    
  2. Enable the admin-user add-on.
    minishift addon enable admin-user
    
  3. Start the instance.
    make minishift-start
    

NOTE: Eventually this setup will be deprecated in favor of Code Ready Containers installation.

Deploying the operator in dev mode

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

  2. Make sure minishift is running.

  3. Clean previously created resources:

    make deploy-clean
    
  4. Deploy the CR.

    make deploy-test
    
  5. Check the freshly created resources.

    oc get all,dc,svc,dc,bc,route,cp,gitsource,gitsourceanalysis
    

Deploying the operator with Deployment yaml

  1. (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.

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

  3. Watch the operator pod:

    oc logs pod/devconsole-operator-5b4bbc7d-89crs -f
    
  4. 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.

  5. Check if the resources are created:

    oc get all,dc,svc,dc,bc,route,cp,gitsource,gitsourceanalysis
    

Directory layout

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.

Enabling the Developer perspective in OpenShift

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.

devconsole-operator's People

Contributors

akashshinde avatar alexeykazakov avatar avni-sharma avatar baijum avatar corinnekrych avatar dhritishikhar avatar dipak-pawar avatar jarifibrahim avatar kwk avatar ldimaggi avatar matousjobanek avatar michaelkleinhenz avatar pmacik avatar preeticp avatar sbose78 avatar tinakurian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devconsole-operator's Issues

[Discussion] Move git Controllers into devconsole-operator repo

Proposal

Move Git-Service[1] controllers into dev-console-operator[2]. Effectively, merge the git-service repo into the dev-console-operator repo.

[1] https://github.com/redhat-developer/git-service
[2] https://github.com/redhat-developer/devconsole-operator.

Context

When we started out building operators, we decided to not go for a monolithic architecture, and build small operators and be able to install them together using one of them.

However, it turns out that 'operator' dependency resolution happens for those operators 'released' to olm/marketplace only. Since, only one of our operators would be on olm/marketplace, any dependency management needs to be down on our own without any assistance from the framework.

We wanted to have an 'app service' and a 'git service' , which would be APIs services( good-old REST style or aggregated ) to enhance the user's import/export experience, and then it turned out that both are not easy in the current framework of things - which is why we are falling back to CRD/Controllers for everything in the git-service ( at least for now! )

Why

I was looking at 'installing' the Git-Service operator as part of devconsole-operator by adding it to
https://github.com/redhat-developer/devconsole-operator/tree/master/manifests/devconsole/0.1.0/devconsole-operator.v0.1.0.clusterserviceversion.yaml

install:
    spec:
      deployments:
      - name: devconsole-operator
      ....
      ....
      - name: git-service
      ...
      ...

However, I hit a 'process' wall when..

  1. I realized that
  • one would have to manually keep the RBAC permissions in sync across both git-service and devconsole-operator repositories. ( you could automate a PR though...) . Every commit to git-service which has RBAC changes would need a commit to devconsole-operator with the cumulative list of rolebindings
  • .. and possibly, tagged image with specific version ( because old images wouldn't need those rbac changes )
  1. I looked up operators on https://github.com/operator-framework/community-operators and did not find any that uses multiple deployments in the manifest.
    Example:
    https://github.com/operator-framework/community-operators/blob/5fc3763d6a074e6aafbd6dd64cea07593994d764/community-operators/elasticsearch-operator/elasticsearch-operator.v4.1.0.clusterserviceversion.yaml

I don't wish to end up doing something which is different from the 'common' way of doing things as that could well lead us into unsupported territories.

In the near future, once we build a lot of capabilities into the Git Service controllers, we could publish it separately on the marketplace and consume it using the high-level dependency model. However, that is a lot of overhead to take care of, at this point.

decouple find-tools requirements

$ make lint
Searching for required executables: go gofmt dep git oc operator-sdk sed yamllint find grep...

If I wanted to checkout source code and run a make lint , why should I have operator-sdk ? :)

Example listed in README fails

The example as listed inthe README fails:

$ operator-sdk add controller --api-version=devopsconsole.openshift.io/v1alpha1 --kind=AppService
(success)

$ kubectl apply -f deploy/crds/devopsconsole_v1alpha1_appservice_crd.yaml
(success)

$export OPERATOR_NAME=app-operator
(success)

$ operator-sdk up local --namespace myproject
INFO[0000] Running the operator locally.                
INFO[0000] Using namespace myproject.                   
cmd/manager/main.go:10:2: cannot find package "github.com/openshift/api/apps/v1" in any of:
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/devopsconsole-operator/vendor/github.com/openshift/api/apps/v1 (vendor tree)
	/home/ldimaggi/local/go/src/github.com/openshift/api/apps/v1 (from $GOROOT)
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/openshift/api/apps/v1 (from $GOPATH)
cmd/manager/main.go:11:2: cannot find package "github.com/openshift/api/build/v1" in any of:
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/devopsconsole-operator/vendor/github.com/openshift/api/build/v1 (vendor tree)
	/home/ldimaggi/local/go/src/github.com/openshift/api/build/v1 (from $GOROOT)
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/openshift/api/build/v1 (from $GOPATH)
cmd/manager/main.go:12:2: cannot find package "github.com/openshift/api/image/v1" in any of:
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/devopsconsole-operator/vendor/github.com/openshift/api/image/v1 (vendor tree)
	/home/ldimaggi/local/go/src/github.com/openshift/api/image/v1 (from $GOROOT)
	/home/ldimaggi/local/redhat_git/go_path/src/github.com/openshift/api/image/v1 (from $GOPATH)
Error: failed to build operator to run locally: (failed to exec []string{"go", "build", "-o", "build/_output/bin/devopsconsole-operator-local", "cmd/manager/main.go"}: exit status 1)

The issue is that this dir was not created:
$GO_PATH/src/github.com/devopsconsole-operator/vendor/github.com/openshift

Use Pure Go for creating kube resource v/s templatize'd yamls

Do we want to create a kube object as

_, err = c.serviceCatalogClient.ServiceInstances(c.Namespace).Create(
		&scv1beta1.ServiceInstance{
			TypeMeta: metav1.TypeMeta{
				Kind:       "ServiceInstance",
				APIVersion: "servicecatalog.k8s.io/v1beta1",
			},
			ObjectMeta: metav1.ObjectMeta{
				Name:      serviceName,
				Namespace: c.Namespace,
				Labels:    labels,
			},
			Spec: scv1beta1.ServiceInstanceSpec{
				PlanReference: scv1beta1.PlanReference{
					ClusterServiceClassExternalName: serviceType,
					ClusterServicePlanExternalName:  servicePlan,
				},
				Parameters: serviceInstanceParameters,
			},
		})

in our code, or do we want to use templatized yaml files to generate objects ?

[Questions] Component CRD / Tool integration

Questions

Component CRD

As SpringBoot team has invested a lot around the development of a Component CRD able to support inner = dev loop or outer = build loop, I'm wondering if you plan to merge our fields into the new Component CRD that you prepare to develop into this project ? @sbose78 @corinnekrych @metacosm

Integration

Have you discussed with the concerned architects the possibility to generate such Component CRD using odo - Thomas Kral, fmp tool - Alex Sotto, ap4k - Ioannis Canellos ? @sbose78 @corinnekrych @metacosm

e2e tests against openshift 4

In OpenShift 4,

  • olm would already be installed
  • the namespaces olm and operators probably aren't present.

The make test-olm-integration target needs to be refactored to read an env var OPENSHIFT_VERSION=4 make test-olm-integration or OPENSHIFT_VERSION=3 make make test-olm-integration and accordingly create resources.

https://jira.coreos.com/browse/ODC-402

Fix build

docker exec -t -i "devopsconsole-operator-local-build" bash -ec 'make build'
Putting child 0x22a9790 (docker-build) PID 5567 on the chain.
Live child 0x22a9790 (docker-build) PID 5567 
building /tmp/go/src/github.com/redhat-developer/devopsconsole-operator/bin/devconsole-operator...
operator-sdk generate k8s
make: operator-sdk: Command not found
make: *** [build] Error 127

https://ci.centos.org/job/devtools-devopsconsole-operator/13/console

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.