Git Product home page Git Product logo

matousjobanek / devconsole-operator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redhat-developer/devconsole-operator

0.0 2.0 0.0 346 KB

The operator that enables the Developer perspective in OpenShift 4.x, and manages services/CRDs on OpenShift 4.x for application creation, import and association of Operator catalog services.

Dockerfile 3.40% Makefile 21.11% Shell 2.49% Go 72.99%

devconsole-operator's Introduction

Docker Repository on Quay

DevConsole Operator

This repository was initially bootstrapped using CoreOS operator.

Build

Pre-requisites

  • operator-sdk v0.5.0
  • dep version v0.5.0+.
  • git
  • go version v1.10+.
  • docker version 17.03+.
  • [kubectl][kubectl_tool] version v1.11.0+ or [oc] version 3.11
  • Access to a kubernetes v.1.11.0+ cluster or openshift cluster version 3.11

Build

make build

Test

  • run unit test:
make test
  • run e2e test: For running e2e tests, have minishift started.
make test-e2e-local

Note: e2e test will deploy operator in project devconsole-e2e-test, if your tests timeout and you wan to debug:

  • oc project devconsole-e2e-test
  • oc get deployment,pod
  • oc logs pod/devconsole-operator-5b4bbc7d-4p7hr

Deployment

Set up Minishift (one-off)

  • create a new profile to test the operator
minishift profile set devconsole
  • enable the admin-user add-on
minishift addon enable admin-user
  • start the instance
make minishift-start

NOTE: this setup should be deprecated in favor of OCP4 install.

Deploy the operator in dev mode

  • 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 will 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 CR
make deploy-test
  • See the newly created resources
oc get is,bc,svc,component.devconsole,build

Deploy the operator with Deployment yaml

  • (optional) minishift internal registry Build the operator's controller image and make it available in internal registry
oc new-project devconsole
eval $(minishift docker-env)
operator-sdk build $(minishift openshift registry)/devconsole/devconsole-operator

NOTE: In operator.yaml replace imagePullPolicy: Always with imagePullPolicy: IfNotPresent for local dev to avoid pulling image and be able to use docker cached image instead.

  • deploy cr, role and rbac
oc login -u system:admin
oc apply -f deploy/crds/devconsole_v1alpha1_component_crd.yaml
oc apply -f deploy/service_account.yaml
oc apply -f deploy/role.yaml
oc apply -f deploy/role_binding.yaml
oc apply -f deploy/operator.yaml

NOTE: make sure deploy/operator.yaml points to your local image: 172.30.1.1:5000/devconsole/devconsole-operator:latest

  • watch the operator's pod
oc logs pod/devconsole-operator-5b4bbc7d-89crs -f
  • in a different shell, test CR in different project
oc new-project tina
oc create -f examples/devconsole_v1alpha1_component_cr.yaml --namespace tina
  • check if the resources are created
oc get all,is,component,bc,build,deployment,pod

Directory layout

Please consult the 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 This pkg 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 can check for the presence of the devconsole CRDs using the Kubernetes API. Check for the existence of a Custom Resource Definitions with name as gitsources.devconsole.openshift.io. If it exists, it will enable the Developer perspective in the Openshift Console.

Refer to OLM test README to install the DevOps Console operator.

devconsole-operator's People

Contributors

sbose78 avatar alexeykazakov avatar baijum avatar corinnekrych avatar tinakurian avatar avni-sharma avatar jarifibrahim avatar kwk avatar dhritishikhar avatar michaelkleinhenz avatar

Watchers

James Cloos avatar Matous Jobanek avatar

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.