kozmopropeller

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: Apache-2.0

README

Kozmo Propeller

Current Release Master GoDoc License CodeCoverage Go Report Card Commit activity Commit since last release Slack

Kubernetes operator to executes Kozmo graphs natively on kubernetes

Components

Propeller

Propeller is a K8s native operator that executes Kozmo workflows. Workflow Spec is written in Protobuf for cross-compatibility.

Propeller Webhook

A Mutating Webhook that can be optionally deployed to extend Kozmo Propeller's functionality. It currently supports enables injecting secrets into pods launched directly or indirectly through Kozmo backend plugins.

kubectl-kozmo

A Kubectl-plugin to interact with Kozmo Workflow CRDs. It enables retrieving and rendering Kozmo Workflows in CLI as well as safely aborting running workflows.

Getting Started

kubectl-kozmo tool

kubectl-kozmo is an command line tool that can be used as an extension to kubectl. It is a separate binary that is built from the propeller repo.

Install

This command will install kubectl-kozmo and kozmopropeller to ~/go/bin

   $ make compile

You can also use Krew to install the kubectl-kozmo CLI:

   $ kubectl krew install kozmo

Use

Two ways to execute the command, either standalone kubectl-kozmo or as a subcommand of kubectl

    $ kubectl-kozmo --help
    OR
    $ kubectl kozmo --help
    Kozmo is a serverless workflow processing platform built for native execution on K8s.
          It is extensible and flexible to allow adding new operators and comes with many operators built in

    Usage:
      kubectl-kozmo [flags]
      kubectl-kozmo [command]

    Available Commands:
      compile     Compile a workflow from core proto-buffer files and output a closure.
      config      Runs various config commands, look at the help of this command to get a list of available commands..
      create      Creates a new workflow from proto-buffer files.
      delete      delete a workflow
      get         Gets a single workflow or lists all workflows currently in execution
      help        Help about any command
      visualize   Get GraphViz dot-formatted output.

Observing running workflows

To retrieve all workflows in a namespace use the --namespace option, --namespace = "" implies all namespaces.

   $ kubectl-kozmo get --namespace kozmokit-development
    workflows
    ├── kozmokit-development/kozmokit-development-f01c74085110840b8827 [ExecId: ... ] (2m34s Succeeded) - Time SinceCreation(30h1m39.683602s)
    ...
    Found 19 workflows
    Success: 19, Failed: 0, Running: 0, Waiting: 0

To retrieve a specific workflow, namespace can either be provided in the format namespace/name or using the --namespace argument

   $ kubectl-kozmo get kozmokit-development/kozmokit-development-ff806e973581f4508bf1
    Workflow
    └── kozmokit-development/kozmokit-development-ff806e973581f4508bf1 [ExecId: project:"kozmokit" domain:"development" name:"ff806e973581f4508bf1" ] (2m32s Succeeded )
        ├── start-node start 0s Succeeded
        ├── c task 0s Succeeded
        ├── b task 0s Succeeded
        ├── a task 0s Succeeded
        └── end-node end 0s Succeeded

Deleting workflows

To delete a specific workflow

   $ kubectl-kozmo delete --namespace kozmokit-development kozmokit-development-ff806e973581f4508bf1

To delete all completed workflows - they have to be either success/failed with a special isCompleted label set on them. The Label is set here

   $ kubectl-kozmo delete --namespace kozmokit-development --all-completed

Running propeller locally

use the config.yaml in root found here. Cd into this folder and then run

   $ kozmopropeller

Following dependencies need to be met

  1. Blob store (you can forward minio port to localhost)
  2. Admin Service endpoint (can be forwarded) OR Disable events to admin and launchplans
  3. access to kubeconfig and kubeapi

Running webhook

API Server requires the webhook to serve traffic over SSL. To issue self-signed certs to be used for serving traffic, use:

    $ kozmopropeller webhook init-certs

This will create a ca.crt, tls.crt and key.crt and store them to kozmo-pod-webhook secret. If a secret of the same name already exist, it'll not override it.

Starting the webhook can be done by running:

    $ kozmopropeller webhook

The secret should be mounted and accessible to this command. It'll then create a MutatingWebhookConfiguration object with the details of the webhook and that registers the webhook with ApiServer.

Making changes to CRD

Remember changes to CRD should be carefully done, they should be backwards compatible or else you should use proper operator versioning system. Once you do the changes, you have to follow the following steps.

    $ go mod vendor
  • Now generate the code
    $ make op_code_generate

Why do we have to do this? Kozmopropeller uses old way of writing Custom controllers for K8s. The k8s.io/code-generator only works in the GOPATH relative code path (sadly). So you have checkout the code in the right place. Also, go mod vendor is needed to get code-generator in a discoverable path.

TODO

  1. We may be able to avoid needing the old style go-path
  2. Migrate to using controller runtime

Directories

Path Synopsis
cmd
controller/cmd
Package cmd contains commands for KozmoPropeller controller.
Package cmd contains commands for KozmoPropeller controller.
manager/cmd
Commands for KozmoPropeller manager.
Commands for KozmoPropeller manager.
This package imports things required by build scripts, to force `go mod` to see them as dependencies
This package imports things required by build scripts, to force `go mod` to see them as dependencies
Package manager introduces a KozmoPropeller Manager implementation that enables horizontal scaling of KozmoPropeller by sharding KozmoWorkflows.
Package manager introduces a KozmoPropeller Manager implementation that enables horizontal scaling of KozmoPropeller by sharding KozmoWorkflows.
config
Package config details configuration data structures for the KozmoPropeller Manager implementation.
Package config details configuration data structures for the KozmoPropeller Manager implementation.
shardstrategy
Package shardstrategy defines a variety of sharding stratgies to distribute KozmoWorkflows over managed KozmoPropeller instances.
Package shardstrategy defines a variety of sharding stratgies to distribute KozmoWorkflows over managed KozmoPropeller instances.
pkg
apis/kozmoworkflow/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/kozmoworkflow/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/kozmoworkflow/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
compiler
Package compiler provides compiler services for kozmo workflows.
Package compiler provides compiler services for kozmo workflows.
compiler/common
This package defines the intermediate layer that the compiler builds and transformers accept.
This package defines the intermediate layer that the compiler builds and transformers accept.
compiler/errors
This package is a central repository of all compile errors that can be reported.
This package is a central repository of all compile errors that can be reported.
compiler/transformers/k8s
This package converts the output of the compiler into a K8s resource for propeller to execute.
This package converts the output of the compiler into a K8s resource for propeller to execute.
compiler/validators
This package contains validators for all elements of the workflow spec (node, task, branch, interface, bindings...
This package contains validators for all elements of the workflow spec (node, task, branch, interface, bindings...
controller
Package controller contains the K8s controller logic.
Package controller contains the K8s controller logic.
controller/config
Package config contains the core configuration for KozmoPropeller.
Package config contains the core configuration for KozmoPropeller.
controller/nodes
Package nodes contains the Core Nodes Executor implementation and a subpackage for every node kind This module implements the core Nodes executor.
Package nodes contains the Core Nodes Executor implementation and a subpackage for every node kind This module implements the core Nodes executor.
webhook
Package webhook container PodMutator.
Package webhook container PodMutator.
Package plugins facilitates all the plugins that should be loaded by KozmoPropeller
Package plugins facilitates all the plugins that should be loaded by KozmoPropeller

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL