operatorkit

module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0

README

GoDoc CircleCI

operatorkit

Package operatorkit implements an opinionated framework for developing Kubernetes operators. It emerged as we extracted common functionality from a number of the operators we developed at Giant Swarm. The goal of this library is to provide a common structure for operator projects and to encapsulate best practices we learned while running operators in production.

Features

  • CRD primitives to reliably create, watch and delete custom resources, as well as any Kubernetes runtime object.
  • Managing finalizers on reconciled objects, making sure the code is executed at least once for each create/delete/update event.
  • Guarantees to perform only one successful deletion event reconciliation to avoid unnecessary, possibly expensive interactions with third party systems.
  • Resource wrapping to gain ability of composing resources like middlewares.
  • Control flow primitives that allow cancellation and repetition of resource implementations.
  • Independent packages. It is possible to use only certain parts of the library without being bound to all primitives it provides.
  • Ability to change behaviour that is often specific to an organization like logging and error handling.

Roadmap

For future planned features and breaking changes see the roadmap.

Docs

Integration Tests

You can simply create a kind cluster to run the integration tests.

kind create cluster

The tests need to figure out how to connect to the Kubernetes cluster. Therefore we need to set an environment variable pointing to your local kube config.

export E2E_KUBECONFIG=~/.kube/config

Now you can easily run the integration tests.

go test -v -tags=k8srequired ./integration/test/<test-name>

Once you did your testing you may want to delete your local test cluster again.

kind delete cluster

Projects using operatorkit

Giant Swarm operators using operatorkit.

Example

For a detailed state of art implementation, please see giantswarm/aws-operator.

Contributing & Reporting Bugs

See CONTRIBUTING for details on submitting patches, the contribution workflow as well as reporting bugs.

License

operatorkit is under the Apache 2.0 license. See the LICENSE file for details.

Directories

Path Synopsis
context/cachekeycontext
Package cachekeycontext stores and accesses the local context key in context.Context.
Package cachekeycontext stores and accesses the local context key in context.Context.
context/finalizerskeptcontext
Package finalizerskeptcontext stores and accesses the kept in context.Context.
Package finalizerskeptcontext stores and accesses the kept in context.Context.
context/reconciliationcanceledcontext
Package reconciliationcanceledcontext stores and accesses the canceled in context.Context.
Package reconciliationcanceledcontext stores and accesses the canceled in context.Context.
context/resourcecanceledcontext
Package resourcecanceledcontext stores and accesses the canceled in context.Context.
Package resourcecanceledcontext stores and accesses the canceled in context.Context.
context/updateallowedcontext
Package updateallowedcontext stores and accesses the update allowed in context.Context.
Package updateallowedcontext stores and accesses the update allowed in context.Context.
flag
integration
env

Jump to

Keyboard shortcuts

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