Home

Awesome

Ververica Platform K8s Operator

go reportcard FOSSA Statuspipeline status coverage report

Makes Ververica Platform resources Kubernetes-Native! Defines CustomResourceDefinitions for mapping resources to K8s!

Built for Ververica Platform version 2.x.

More about the Ververica Platform
Ververica Platform Docs

Supported Resources

Since the resources names of K8s and the Ververica Platform somewhat clash, the custom VP Resources will all be prefixed with Vp.

Unsupported

To avoid naming conflicts, and for simplicity, and VP metadata and spec fields are nested under the top-level spec field of the K8s resource.

Look in docs/mappings for information on each supported resource.

Getting Started

Please have a look at the docs for information on getting started using the operator.

Editions

This operator works with both the Community and Enterprise editions of the Ververica Platform, with the caveats:

Find out more about the editions here.

Running

To run the binary directly, after building run ./bin/manager.

Flags:

For authorization with the AppManager's API, a token is needed. This can be provided in the environment on either a per-namespace or one-token-to-rule-them-all basis. If it is not provided in the environment, an "owner" token will be created for each namespace that resources are managed in.

Specifying in the environment is a good way to integrate with namespaces that aren't defined in Kubernetes.

Environment:

Docker

Images are published to Docker Hub.

Helm

A Helm chart for the operator lives in ./charts/vp-k8s-operator, which sets up a deployment with a metrics server, RBAC policies, CRDs, and, optionally, an RBAC proxy for the metrics over HTTPS.

The CRDs are managed in a separate chart (./charts/vp-k8s-operator-crds), which also needs to be installed.

Development

Built using kubebuilder. kind is used for running a local test cluster, though something like minikube will also do.

More on the design of the controller and its resources can be found in docs/design.md.

Also built as a Go module - no vendor files here.

System Pre-requisites:

make Scripts

For working with a local kind cluster

Environment

To use the default test cluster, you'll need to store a KUBECONFIG env var pointed to it.

godotenv automatically loads this when running main.

AppManager + Platform APIs

The API Clients are auto-generated using the Swagger Codegen utility.

AppManager

The appmanager-api Swagger file is from the live API documentation (available at ${VP_URL}/api/swagger), but the generated client needs a few updates to work correctly.

Post-Generation Changes

The optional package is missing from many of the imports in the generated code, as must be added manually.

package ververicaplatformapi

import (
	// ...
    "github.com/antihax/optional"
    // ...
)

Affected files:

Type Changes:

There is also a bug that cannot handle an empty Swagger type to represent the any type, so you must manually change model_any.go to:

package appmanagerapi

type Any interface {}

You'll also have to change any usages of this type in structs to be embedded, instead of by pointer ref, namely in:

Building Images

The images are built in two steps:

  1. The build.Dockerfile image is a full development environment for running tests, linting, and building the source with the correct tooling. This can also be used for development if you so like, just override the entrypoint.
  2. The build image is then passed as a build arg to the main Dockerfile, which builds the manager binary and copies it over into an image for distribution.

Acknowledgements

Other OSS that influenced this project:

License

Licensed under Apache 2.0

FOSSA Status