k8s-pingdom-operator

command module
v0.0.0-...-cf82eea Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

README

K8s Pingdom Operator

K8s Pingdom Operator is a simple kubernates controller (based on the operator pattern). It allows you to manage your Pingdom service checks through the usage of custom resources.

Since this was my first experince with K8s extensions (and Golang for production like purposes) this code is highly inspired by the sample controller from K8S oficial repo.

Setup

Installing dependencies

go get -u

you may need to add GO111MODULES=on as a prefix for the command above, or simply export the variable.

Building

In the root of the project just run

go build -o pingdom-controller .

Running

Running it locally requires you to have you kubeconfig file properly setup so that the controller can easily communicate with the cluster api.

After setting the kubeconfig simply run

./pingdom-controller -kubeconfig=<path to kubeconfig>

When running it as a container in your cluster (as it is intedend to be ran) you should make sure that you container has enough permissions to access your control plane (through the use of a service account)

Usage

The next section has some demonstrations on how to apply your checks (also, update and delete). The first step is adding your Custom Resource Definition to the cluster

kubectl apply -f artifact/examples/crd.yaml 

Then you can add your checks as you would with any other K8s native object. Heres an example of a PingdomOperator custom object defined by the definition applied in the step above

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: pingdomoperators.tacf.github.io
spec:
  group: tacf.github.io
  version: v1alpha1
  names:
    kind: PingdomOperator
    plural: pingdomoperators
  scope: Namespaced

Features

Sync at controller startup

Sync Demo

Create and Delete Checks

Create and Delete Demo

Update Checks

Update Demo

Limitations

As of now the definition and implementation of the controller only allows for simple http(s) checks to be created.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/pingdomcontroller/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
generated/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
generated/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
generated/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
generated/clientset/versioned/typed/pingdomcontroller/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/pingdomcontroller/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