Code Monkey home page Code Monkey logo

foo-controller-kubebuilder's Introduction

Sample Controller(Foo Controller)

This Controller is developed by Kubebuilder v2.2.0

インプレスR&D NextPublishing「実践入門 Kubernetesカスタムコントローラーへの道」の第五章に掲載したサンプルコード用のリポジトリです。

https://nextpublishing.jp/book/11389.html

Admission Webhookのサンプルはadmission_webhookに、
Conversion Webhookのサンプルはmulti_conversionに用意しています。

What is this Controller

This Controller reconcile foo custom resource.
Foo resource owns deployment object.

We define foo.spec.deploymentName & foo.spec.replicas.
When we apply foo, then deployment owned by foo is created.

If we delete deployment object like 'kubectl delete deployment/<deployment name>',
foo reconcile it and the deployment is created again.

Or if we scale deployment object like 'kubectl scale deployment/<deployment name> --replicas 0',
foo reconcile it and the deployment keeps the foo.spec.replicas.

How to run

Before you start this operator, you must prepare the kubernetes cluster using like Minikube, Kind.

Clone source code

$ mkdir -p $GOPATH/src/github.com/govargo
$ cd $GOPATH/src/github.com/govargo
$ git clone https://github.com/govargo/foo-controller-kubebuilder.git
$ cd foo-controller-kubebuilder

Run localy

$ make install
$ make run
$ kubectl apply -f config/samples/samplecontroller_v1alpha1_foo.yaml

Run container as Deployment

$ make install
$ make deploy
$ kubectl apply -f config/samples/samplecontroller_v1alpha1_foo.yaml

Reference

This project is inspired by

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.