Code Monkey home page Code Monkey logo

k8s-pingdom-operator's Introduction

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.

k8s-pingdom-operator's People

Contributors

tacf avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.