Code Monkey home page Code Monkey logo

operator's Introduction

Operator

A skeleton k8s operator project.

Instructions

Note:

    operator/ is the directory containing this cloned repository
    workspace/operator/ is the directory where the operator is developed
  1. Build and install the Operator SDK

     $ git clone https://github.com/operator-framework/operator-sdk
     $ cd operator-sdk
     $ make install
    
  2. Deploy the operator web app container

     $ cd operator
     $ docker build -t localhost:5000/operatorwebapp:latest operatorwebapp
     $ docker push localhost:5000/operatorwebapp:latest
     $ curl http://localhost:5000/v2/operatorwebapp/tags/list
    
  3. Create a workspace

     Note: the name of the directory 'operator' is used by the SDK to name pods, etc.
    
     $ mkdir -p workspace/operator
     $ cd workspace/operator
    
  4. Create a sample operator

     $ export GO111MODULE=on
     $ operator-sdk init --domain example.org --repo github.com/keith-cullen/operator
    
     edit Makefile
    
         VERSION ?= latest
         IMAGE_TAG_BASE ?= localhost:5000/operator
         IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
    
  5. Create an API and controller

     $ operator-sdk create api --group cache --version v1alpha1 --kind Operator --resource --controller
     $ cp ../../operator_types.go api/v1alpha1/operator_types.go
     $ cp ../../operator_controller.go controllers/operator_controller.go
     $ make generate
     $ make manifests
    
  6. Build the operator

     Note: each time the operator is built, the value of the VERSION variable in the Makefile must be changed from that of the previous build
    
     $ make docker-build docker-push
    
  7. (Optionally) Run the Operator locally

     $ make install run
    
  8. Deploy the operator

     $ make deploy
    
  9. Deploy a custom resource

     $ cp ../../cache_v1alpha1_operator.yaml .
     $ kubectl apply -f cache_v1alpha1_operator.yaml
     $ kubectl get deployment -A
     $ kubectl get pods -A
     $ kubectl get operator/operator -o yaml
    
  10. Interact with deployment

    $ kubectl get pods -A -owide
    
    Note: the operator IP addresses
    
    $ curl http://<IP>:8081
    
  11. Clean-up

    $ kubectl delete -f cache_v1alpha1_operator.yaml
    $ make undeploy
    

operator's People

Contributors

keith-cullen avatar

Watchers

 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.