Giter VIP home page Giter VIP logo

kabanero-operator's Introduction

kabanero-operator

The following README pertains to kabanero-operator development. If you are trying to use the operator to try Kabanero on your cluster, please see the install instructions.

We suggest you install from a release. However you can also install from master using deploy/install-master.sh. This is inherently unstable since master is rebuilt every time a PR is merged, and parts of Kabanero on your cluster may get out of sync over time.

Status

Build Status

The Kabanero operator is developed using:

  • operator-sdk version 0.17.1.
  • go version 1.13.x

Clone the Kabanero operator

git clone https://github.com/kabanero-io/kabanero-operator
cd kabanero-operator

Quickstart - OpenShift Container Platform (OCP) 4.4

We recommend you follow the install instructions referenced above to set up your cluster for the first time. If you would rather set it up manually, please continue with the following steps:

Login

(example)

oc login -u admin -p admin https://openshift.my.com:8443/

Deploy Prerequisite operators:

The following operators need to be installed at the cluster scope:

  • OpenShift Serverless Operator
  • OpenShift Pipelines Operator (from community-operators)
  • Appsody Operator (from certified-operators)
  • Open Liberty Operator (from certified-operators)
  • CodeReady Workspaces Operator (from redhat-operators)

Build images, create catalogsource and OLM subscription

You will need to examine the Makefile and set any necessary variables to push your container images to the correct repository.

make build-image
make push-image
make deploy-olm

Check that the operator pods are in Running state

kubectl get pods -n kabanero

(example command output)

[admin@openshift kabanero-operator]# kubectl get pods -n kabanero
NAME                                                       READY   STATUS    RESTARTS   AGE
kabanero-operator-659d7f84bb-v9jsp                         1/1     Running   0          3h5m

Deploy the sample

kubectl apply -n kabanero -f config/samples/default.yaml

kubectl get pods -n kabanero

(example command output)
[admin@openshift kabanero-operator]# kubectl get pods -n kabanero
NAME                                                       READY   STATUS    RESTARTS   AGE
kabanero-cli-58f96db965-j97gd                              1/1     Running   0          3h4m
kabanero-landing-84b99fbcbf-z8zvx                          1/1     Running   0          3h4m
kabanero-operator-659d7f84bb-v9jsp                         1/1     Running   0          3h5m
kabanero-operator-admission-webhook-775668455c-j4nkf       1/1     Running   1          3h4m
kabanero-operator-collection-controller-6757dbc9bc-4tsht   1/1     Running   0          33m

Quickstart - minikube

Kabanero is not currently supported on Minikube, due to the resource requirements of its dependencies (Istio, Knative and Tekton) and due to the Kabanero-operator's dependencies on OpenShift types like Routes.

Some folks have had success installing on Minishift. For example, see https://github.com/nastacio/kabanero-minishift.

Quickstart - OpenShift 3.11 / OKD 3.11

Please use the release-0.2 branch when using OpenShift or OKD v3.11. https://github.com/kabanero-io/kabanero-operator/tree/release-0.2

kabanero-operator's People

Contributors

alohr51 avatar brutif avatar dacleyra avatar ginnick avatar ianpartridge avatar johnmcollier avatar kaczyns avatar kidus60 avatar kiszk avatar kvijai82 avatar kyleschlosser avatar makandre avatar markusthoemmes avatar mezarin avatar plainchanter avatar rlcundiff avatar s1cyan avatar stevenschader avatar toshiyamamoto avatar tspewak 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  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  avatar  avatar  avatar  avatar

kabanero-operator's Issues

Enable continuous delivery of releases to public Docker registry

Building upon #10, when we create a new release in github, the Docker image should be built and published into the public Docker registry.

A Docker image can be pushed using the Travis deploy 'script' task. There are two cases to be considered:

Release

For a release build, this is identified as being a 'tag' build. See the documentation here: https://docs.travis-ci.com/user/deployment/releases/#deploying-only-on-tagged-builds

This would something like this:

deploy:
  provider: script
  ...
  draft: false
  on:
    tags: true

For a tagged build, the docker image tag should be kabanero-operator:<tag>

Draft Release

Travis also supports a subselector for "draft releases":

deploy:
  provider: script
  ...
  draft: true

When draft is set, this is considered a "release candidate" build, and the Docker tag should instead be: kabanero-operator:<version>-RC

RBAC errors in the Kabanero operator log when applying the sample/default collection

The following RBAC errors are observed in the operator log when applying the default collection:

"error":"serviceaccounts \"appsody-sa\" is forbidden: User \"system:serviceaccount:kabanero:kabanero-operator\" cannot get serviceaccounts in the namespace \"kabanero\": no RBAC policy matched"

and

"error":"clusterrolebindings.rbac.authorization.k8s.io \"appsody-admin\" is forbidden: User \"system:serviceaccount:kabanero:kabanero-operator\" cannot get clusterrolebindings.rbac.authorization.k8s.io at the cluster scope: no RBAC policy matched"

Some consideration is needed as to how much authority the Kabanero operator service account should have, or whether someone should be pre-configuring some of these roles at the cluster scope so that the service account does not need cluster admin authority.

dep ensure to avoid build-image failure

avoid this problem with build-image

operator-sdk build kabanero-operator:latest
# github.com/kabanero-io/kabanero-operator/cmd/manager
cmd/manager/main.go:45:42: cannot use "github.com/operator-framework/operator-sdk/pkg/log/zap".FlagSet() (type *"github.com/operator-framework/operator-sdk/vendor/github.com/spf13/pflag".FlagSet) as type *"github.com/spf13/pflag".FlagSet in argument to "github.com/spf13/pflag".CommandLine.AddFlagSet
cmd/manager/main.go:61:27: cannot use "github.com/operator-framework/operator-sdk/pkg/log/zap".Logger() (type "github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/logr".Logger) as type "github.com/go-logr/logr".Logger in argument to "sigs.k8s.io/controller-runtime/pkg/runtime/log".SetLogger:
        "github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/logr".Logger does not implement "github.com/go-logr/logr".Logger (wrong type for V method)
                have V(int) "github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/logr".InfoLogger
                want V(int) "github.com/go-logr/logr".InfoLogger
cmd/manager/main.go:90:3: cannot use restmapper.NewDynamicRESTMapper (type func(*"github.com/operator-framework/operator-sdk/vendor/k8s.io/client-go/rest".Config) ("github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/api/meta".RESTMapper, error)) as type func(*"k8s.io/client-go/rest".Config) ("k8s.io/apimachinery/pkg/api/meta".RESTMapper, error) in field value
cmd/manager/main.go:113:11: undefined: metrics.ExposeMetricsPort
Error: failed to build operator binary: (failed to exec []string{"go", "build", "-o", "/home/dacleyra/go/src/github.com/kabanero-io/kabanero-operator/build/_output/bin/kabanero-operator", "-gcflags", "all=-trimpath=${GOPATH}", "-asmflags", "all=-trimpath=${GOPATH}", "github.com/kabanero-io/kabanero-operator/cmd/manager"}: exit status 2)

Add specific RBAC roles to the Kabanero Operator

The operator uses a wildcard role assignment right now, but the specific permissions need to be accounted for instead.

Work to be completed:

  • Update the RBAC generation annotations in the source
  • Run the operator-sdk scripts to regenerate the role yaml

Document RBAC kinds required for different use cases

We need to document that someone who is working with collections (activating, upgrading, etc) will require RBAC authority to create/modify the kind Collection. Likewise, someone wanting to configure a Kabanero instance will need access to the Kind Kabanero.

Kabanero CSV owned CRD resources is not correct

The kabanero-operator CSV says that the Kabanero CRD owns the following resources:

      resources:
      - kind: ConfigMap
        name: ""
        version: v1
      - kind: Deployment
        name: ""
        version: v1
      - kind: Pod
        name: ""
        version: v1
      - kind: Role
        name: ""
        version: v1
      - kind: RoleBinding
        name: ""
        version: v1
      - kind: ServiceAccount
        name: ""
        version: v1

This is not correct - the Kabanero operator creates a Tekton Install, a Knative KnativeEventing and a Knative KnativeServing.

The OKD / OpenShift console uses the resources section as a clue for what to display when viewing an instance of our CRD. It's not broken the way it is, but it's not useful either.

Evaluate test framework for integration/acceptance testing

Suggest a test framework for integration testing, likely building upon existing Kubernetes test capabilities already provided by the community. The test framework needs to be able to test such things as whether a migration between platform releases is successful through editing of the resource document.

We may or may not require a golang specific test framework, but please take a look at Ginkgo.

To start with, I suggest that we try to incorporate the following types of tests:

  1. Unit. These will be those tests which do not have any golang build flags (see this answer. Simple, fast running tests.
  2. Integration. These tests may call the API server. I suggest setting up an API server using: the envtest package in controller-runtime. These need a build flag so that they are not normally run with go test
  3. Acceptance. This requires more thought.

Subtasks:

  • Add makefile tasks for unit and integration tests. Unit tests will run go test with no tags, integration will run go test -tags=integration. There are a few tests tagged as integration that might need their flag updated.
  • Run unit tests in the Travis build by calling the above make target
  • Investigate and report on Ginkgo
  • Investigate how we can setup the API server using envtest and tear it down at the end of some number of tests. One example of how to do this is here and another is using a test main but there are other ways and there may be some specific ways in Ginkgo.

Investigate CSV "required" stanza to install dependent operators

The CSV allows you to list "required" CRDs. The documentation is not clear about how these should be processed. Our initial test seems to show that OLM will ignore any CSV that required CRDs, even if they are installed. This should be investigated further. Is it that:

  1. The Operator will not be read from the catalog until all its required CRDs are defined?
  2. The Operator will not be read from the catalog unless its required CRSs were installed by OLM?
  3. The Operator will not be read from the catalog unless the Operator which owns the required CRDs is available to be installed in/by some other available catalog (such as operator-marketplace)?

This may involve testing on Open Shift 4 to realize the expected behavior, and then coming back to OKD 3.11 to see if it can be duplicated there.

The ideal behavior would be for the user to click on the Kabanero operator in the catalog, and have the dependent operators (Tekton Pipeline, Knative Eventing and Knative Serving) be installed automatically if they are not already installed. This may not be possible, but, we'd like to understand what the actual behavior is.

config/reconciler/knative-eventing: no such file or directory

{"level":"info","ts":1561734576.4221,"logger":"controller_kabaneroplatform","msg":"Tekton is currently enabled"}
{"level":"info","ts":1561734576.7278454,"logger":"manifestival","msg":"Reading file","name":"config/reconciler/knative-eventing"}
{"level":"error","ts":1561734576.7279148,"logger":"kubebuilder.controller","msg":"Reconciler error","controller":"kabaneroplatform-controller","request":"kabanero/kabanero","error":"stat config/reconciler/knative-eventing: no such file or directory","stacktrace":"github.com/dacleyra/kabanero-operator/vendor/github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/dacleyra/kabanero-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:217\ngithub.com/dacleyra/kabanero-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158\ngithub.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\ngithub.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134\ngithub.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\t/home/dacleyra/go/src/github.com/dacleyra/kabanero-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}

Update the collection status

The collection needs a status which reflects both the current state, version and digests of the collection but also any errors applying collection contents. A common error applying collection contents results from RBAC limitations within the collection contents. Some of the status recording needs to be per resource, while other parts are per collection.

Example:

status:
    # Here available version > current reflects an available update
    availableVersion: 1.0.0.1
    currentVersion: 1.0.0.0
    resources:
    - name: <resource name or path>
      currentDigest: <digest>
      status: applied
    - name: <resource name or path>
      currentDigest: <digest>
      status: failed
      statusMessage: "role" is forbidden from creating objects of kind

Phases and Conditions
Some Kubernetes objects are treated as a state machine and record their status using "phases and conditions" concepts. This allows the status to record such things as whether it is initializing, ready, failed, etc. The use of phases and conditions is advanced and optional at this point, however, some of this idea is present in the above modeling in order to account for individual resource application failures.

For an example of this, see:

Kabanero operator should prevent a 2nd instance in the namespace

It is not valid to have two kabanero instances in the same namespace, since some of the dependencies cannot be installed twice in the same namespace. The kabanero operator should prevent a second instance from being processed, if a first instance already exists in the namespace.

Implement an admission webhook in the Kabanero Operator

We have several actions which can only occur in an admission webhook:

  • Defaulting of resource values
  • Ensuring only one instance of Kabanero in a given namespace context
  • Setting the relational reference between a collection and a Kabanero instance

The controller runtime supports admission webhooks which requires that you implement a handler for the admission action.

TLS
Since a webhook introduces an HTTP listener endpoint, this should be secured with TLS which will require valid certificates be generated. If other examples cannot be found, I would suggest looking at how this was done in the Service Catalog project.

Duplicate KnativeEventing instance when deploying a Kabanero instance

When deploying a Kabanero instance, a KnativeEventing instance is created. The status of that instance reports:

    - lastTransitionTime: '2019-07-09T14:53:32Z'
      message: >-
        Install not attempted: The only KnativeEventing resource that matters is
        knative-eventing/knative-eventing
      reason: Ignored
      status: 'False'
      type: Ready

We probably need to stop creating that resource by default, and if we have something specific we need, patch the existing resource in the knative-eventing namespace rather than try to create our own resource.

Implement digest checking in the collection event loop

The collections controller is a minimal implementation which when applied retrieves the remote contents and applies these contents. Any modification of the resource results in re-execution of this logic.

Digest data is available in the remote repository for both the collection as well as the individual resources. The digest for either one or both of these should be recorded in the status, and then application of the collection be limited to the case where the digest is new.

There is an additional case where the digests changing which may lead to re-application of the collection. This is a bit like "SNAPSHOTS" in a Maven repository, where the HEAD of the repository is changing but the version is not fully committed. This probably should not be supported as a base case, but perhaps could be recognized when a Kabanero instance configuration attribute is present. If no resolution on this is made within the current issue, we should fork this into a separate issue.

Update collection status to reflect version update availability

In addition to the enhancement to digest checking mentioned in #60, the collection status should have an indicator that a version update is available. The update could be qualified using the semantic version, for example be tagged as a "major" update, but this behavior is optional at this time.

Kabanero Collections lifecycle management on a Kubernetes cluster

Add the ability to install versioned collections from a collections repository and manage the version of the collection that is installed, view errors in the status, etc.

This epic is complete once we arrive at an 'MVP' level of function which is to be determined by the team.

manifestival needs to work with vfs

manifestival needs to be able to access the vfs that contains
config/reconciler/knative-eventing
config/reconciler/knative-serving

until so, workaround by copying config to the filesystem using an additional Dockerfile & docker build

Errors installing tekton resources defined in default collection

There appears to be an ordering and/or timing problem when creating the default collection. Sometimes, Pipeline and Task resources cannot be created by the collection controller, presumably because the Tekton operator has not finished processing the Install resource yet (this causes Tekton to register the Pipeline and Task CRDs). The error can happen in several ways, some of which include (from the Kabanero operator log):

"error":"no matches for kind \"Task\" in version \"tekton.dev/v1alpha1\""

or

"error":"the server could not find the requested resource"

Eventually, the CRDs are registered, but the operator does not seem to always detect this, and so future loops of the collection controller continue to receive the error. We should investigate whether we can fix the timing here... perhaps if the Kabanero controller is going to create a Install, it could wait until the Pipeline and Task CRDs are available before trying to create the Collection instance. It may be that the particular collection does not define a Pipeline or Task, but that's a harder problem to solve.

Upgrade a collection to a new version and roll back to a prior

When the version identifier specified in a collection changes, the resources found in the version need to be applied and the status updated. This needs to be done such that the version can later be "rolled back" to the prior. For example, if resources are removed from the collection, those resources need to be removed. This should likely also be recorded in the status so that you can see what resources changed when a version was applied and what the current version is.

Enable travis builds for this project

Enable travis ci builds for this project.

Work to be completed:

  • Enable travis in a fork by visiting travis-ci.org, in the upper right corner by your username, click settings, then click the 'enable' check for kabanero-operator
  • Work through any build failures, committing to the fork, and observing the build results
  • Enable travis for github.com/kabanero-io/kabanero-operator (awaiting authorization)

Allow featured collections installation to be specified on a per repository basis

Currently whether to install the featured collections is on a per Kabanero instance basis, but this should ideally be modeled as per repository. Featured collections are to be installed by default -- if the configuration value is unspecified, then featured collection installation is enabled.

The existing repository modeling is:

repositories: 
- name: myrepo
  url: http://....

Proposed:

repositories: 
- name: myrepo
  url: http://....
  installFeaturedCollections: true

Consider separation of lifecycle concerns with the collection controller

One of the philosophical points of view with the operator pattern is that the operator has a separate lifecycle from the software it manages. This lets you upgrade the operator without disturbing and of the existing software instances, and lets the operator orchestrate roll forward/roll back of a software instance.

The Kabanero instance controller adheres to this point of view, but the collection controller seemingly violates this point of view. We might consider factoring the collection controller off into another deployment at some point in the future.

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.