Git Product home page Git Product logo

kn-plugin-operator's Introduction

kn-plugin-operator

kn-plugin-operator is a plugin of Knative Client, for managing Knative with Knative Operator from the command line.

Description

With this plugin, you can install/uninstall Knative Operator, install/uninstall Knative components, and configure Knative.

Build and Install

You must set up your development environment before you build.

Building:

Once you've set up your development environment, let's build the plugin.

$ go build -o kn-operator ./cmd/kn-operator.go

You'll get an executable plugin binary namely kn-operator in your current dir. You're ready to use kn-operator as a stand alone binary, check the available commands ./kn-operator -h.

Installing:

If you'd like to use the plugin with kn CLI, install the plugin by simply copying the executable file under kn plugins directory as:

mkdir -p ~/.config/kn/plugins
cp kn-operator ~/.config/kn/plugins

Note: The plugins directory defaults to $base_dir/plugins relative to your kn config file location.

On Windows, the default plugins directory is in %APPDATA%\kn\plugins

Check if plugin is loaded

kn -h

Run it

kn operator -h

You can use the built binary to run the commands. You can also use the bash scripts directly to run your commands. All the bash scripts are available under the directory scripts.

kn-plugin-operator's People

Contributors

dprotaso avatar dsimansk avatar evankanderson avatar houshengbo avatar joshualyon avatar knative-automation avatar psschwei avatar rhuss avatar upodroid avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kn-plugin-operator's Issues

Help menu shows `kn operation` instead of `kn operator`

When running kn operator --help, the example commands are listed as kn operation rather than kn operator. It also lists the parent kn commands, which I don't think is the standard behavior.

$ kn operator --help
kn operation: a plugin of kn client to operate Knative components.
For example:
kn operation install
kn operation install -c serving
kn operation install -c eventing

Usage:
  kn [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  configure   Configure the Knative Serving or Eventing
  enable      Enable the ingress for Knative Serving
  help        Help about any command
  install     Install Knative Operator or Knative components
  remove      Remove the ingress for Knative Serving
  uninstall   Uninstall Knative Operator or Knative components

Flags:
  -h, --help   help for kn

Use "kn [command] --help" for more information about a command.

Uninstall command is not complete

uninstall command only removes the operator deployment. Install command, uses the overlay to install many other resources including the webhook.

here, we should just use the same overlay and remove the resources.

Support of uninstalling knative operator, serving and eventing

This plugin needs to implement the following commands to uninstall knative operator or knative component:

To remove the knative operator

kn operation uninstall

To remove Knative Serving

kn operation uninstall -c serving

To remove Knative Eventing

kn operation uninstall -c eventing

The namespace can be specified with the flag --namespace for each command.

Proposal: rename install to init for initializing the operator on the cluster

The install command is currently confusing at it is used for doing fundamentally two different things. Instead I propose to clearly separate the first time initialization of the operator on the server side from installing Knative components.

The proposed new commands are init, to initialize the operator, and reset to delete the operator.

Check the existing knative components, when installing or upgrading

  1. Check the version in the knativeserving or knativeeventing. whether they exist and what namespace they are under. Check whether the existing ns is consistent with the target ns.
  2. If knativeserving or knativeeventing does not exist, check whether the deployments of knative exists. check whether ns is consistent.
  3. if the ns is not consistent, return an error.

The command does not work on the installating operator under a certain namespace

  status:
    conditions:
    - lastTransitionTime: "2022-07-14T22:27:16Z"
      status: Unknown
      type: DependenciesInstalled
    - lastTransitionTime: "2022-07-14T22:27:16Z"
      status: Unknown
      type: DeploymentsAvailable
    - lastTransitionTime: "2022-07-14T22:30:07Z"
      message: |-
        Install failed with message: clusterrolebindings.rbac.authorization.k8s.io "knative-serving-controller-admin" is forbidden: user "system:serviceaccount:knative-operator:knative-operator" (groups=["system:serviceaccounts" "system:serviceaccounts:knative-operator" "system:authenticated"]) is attempting to grant RBAC permissions not currently held:
        {APIGroups:[""], Resources:["endpoints/restricted"], Verbs:["create"]}
        {APIGroups:["apiextensions.k8s.io"], Resources:["customresourcedefinitions/status"], Verbs:["create" "delete"]}
        {APIGroups:["apps"], Resources:["deployments/finalizers"], Verbs:["get" "list" "create" "delete" "patch" "watch"]}
        {APIGroups:["autoscaling"], Resources:["horizontalpodautoscalers"], Verbs:["patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["destinationrules"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["gateways"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["virtualservices"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
      reason: Error
      status: "False"
      type: InstallSucceeded
    - lastTransitionTime: "2022-07-14T22:30:07Z"
      message: |-
        Install failed with message: clusterrolebindings.rbac.authorization.k8s.io "knative-serving-controller-admin" is forbidden: user "system:serviceaccount:knative-operator:knative-operator" (groups=["system:serviceaccounts" "system:serviceaccounts:knative-operator" "system:authenticated"]) is attempting to grant RBAC permissions not currently held:
        {APIGroups:[""], Resources:["endpoints/restricted"], Verbs:["create"]}
        {APIGroups:["apiextensions.k8s.io"], Resources:["customresourcedefinitions/status"], Verbs:["create" "delete"]}
        {APIGroups:["apps"], Resources:["deployments/finalizers"], Verbs:["get" "list" "create" "delete" "patch" "watch"]}
        {APIGroups:["autoscaling"], Resources:["horizontalpodautoscalers"], Verbs:["patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["autoscaling.internal.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.internal.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["destinationrules"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["gateways"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["networking.istio.io"], Resources:["virtualservices"], Verbs:["get" "list" "create" "update" "delete" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*/finalizers"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
        {APIGroups:["serving.knative.dev"], Resources:["*/status"], Verbs:["get" "list" "create" "update" "delete" "deletecollection" "patch" "watch"]}
      reason: Error
      status: "False"
      type: Ready
    - lastTransitionTime: "2022-07-14T22:27:16Z"
      status: "True"
      type: VersionMigrationEligible
    observedGeneration: 1

Support of enabling the ingresses and eventing sources

Based on the description in the design document: https://docs.google.com/document/d/1OzYKB75ZaaXzLTpCuccYj2Pbb_3KQ5BANOg7acylrzQ/edit Search for the section "Enable/install the ingress plugin and the event sources" to read the details.

The operator plugin is about to implement the installation/enablement of ingresses and eventing sources.
To enable a certain ingress, e.g. istio, we run the command:

kn-operator enable ingress --istio --namespace <namespace>

To enable a certain eventing source, like github, we can run the command:

kn-operator enable eventing-source --github --namespace <namespace>

Multiple sources can be enabled as follows:

kn-operator enable eventing-source --ceph --couchdb --github … --namespace <namespace>

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.