echoperator

module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT

README

🤖 echoperator

CI Release Go Report Card Go Reference Artifact HUB

Simple Kubernetes operator built from scratch with client-go.

Kubernetes operator pattern implementation using the client-go library. Altough there are a bunch of frameworks for doing this (kubebuilder, operator framework ...), this example operator uses the tools provided by client-go for simplicity and flexibility reasons.

Medium article that explains how to build this operator step by step.

Features
  • Simple example to understand how a Kubernetes operator works.
  • Manages Echo CRDs for executing an echo inside a pod.
  • Manages ScheduledEcho CRDs for scheduling the execution of an echo inside a pod.
  • High Availability operator using Kubernetes lease objects.
  • Prometheus metrics.
  • Helm chart.
Versioning
Echo ScheduledEcho Job CronJob Lease Kubernetes
v1alpha1 v1alpha1 v1 v1 v1 v1.21.x
Installation
helm repo add mmontes https://mmontes11.github.io/charts
helm install echoperator mmontes/echoperator
Custom Resource Definitions (CRDs)

The helm chart installs automatically the Custom Resource Definitions needed for this operator to work. However, if you wanted to install them manually, you can find them in the helm chart repo.

Example use cases
Hello world
  • Client creates a hello world Echo CRD.
  • Operator receives a Echo added event.
  • Operator reads the message property from the Echo and creates a Job resource.
  • The Job resource creates a Pod that performs a echo command with the message property.
Scheduled hello world
  • Client creates a hello world ScheduledEcho CRD.
  • Operator receives a ScheduledEcho added event.
  • Operator reads the message and schedule property from the ScheduledEcho and creates a CronJob.
  • The CronJob schedules a Job creation using the schedule property.
  • When scheduled, the Job resource creates a Pod that performs a echo command with the message property.

Directories

Path Synopsis
cmd
internal
pkg
echo/v1alpha1
+groupName=mmontes.io
+groupName=mmontes.io
echo/v1alpha1/apis/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
echo/v1alpha1/apis/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
echo/v1alpha1/apis/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
echo/v1alpha1/apis/clientset/versioned/typed/echo/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
echo/v1alpha1/apis/clientset/versioned/typed/echo/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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