GithubHelp home page GithubHelp logo

linuxerwang / operator-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from operator-framework/operator-sdk

0.0 3.0 0.0 491 KB

SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding.

Home Page: https://coreos.com/operators

License: Apache License 2.0

Go 99.93% Shell 0.07%

operator-sdk's Introduction

Project Status: pre-alpha

The project is currently pre-alpha and it is expected that breaking changes to the API will be made in the upcoming releases.

See the design docs for planned work on upcoming milestones.

Overview

This project is a component of the Operator Framework, an open source toolkit to manage Kubernetes native applications, called Operators, in an effective, automated, and scalable way. Read more in the introduction blog post.

Operators make it easy to manage complex stateful applications on top of Kubernetes. However writing an operator today can be difficult because of challenges such as using low level APIs, writing boilerplate, and a lack of modularity which leads to duplication.

The Operator SDK is a framework designed to make writing operators easier by providing:

  • High level APIs and abstractions to write the operational logic more intuitively
  • Tools for scaffolding and code generation to bootstrap a new project fast
  • Extensions to cover common operator use cases

Workflow

The SDK provides the following workflow to develop a new operator:

  1. Create a new operator project using the SDK Command Line Interface(CLI)
  2. Define new resource APIs by adding Custom Resource Definitions(CRD)
  3. Specify resources to watch using the SDK API
  4. Define the operator reconciling logic in a designated handler and use the SDK API to interact with resources
  5. Use the SDK CLI to build and generate the operator deployment manifests

At a high level an operator using the SDK processes events for watched resources in a user defined handler and takes actions to reconcile the state of the application.

Quick Start

First, checkout and install the operator-sdk CLI:

$ cd $GOPATH/src/github.com/operator-framework/operator-sdk
$ git checkout tags/v0.0.5
$ dep ensure
$ go install github.com/operator-framework/operator-sdk/commands/operator-sdk

Create and deploy an app-operator using the SDK CLI:

# Create an app-operator project that defines the App CR.
$ cd $GOPATH/src/github.com/example-inc/
$ operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=App
$ cd app-operator

# Build and push the app-operator image to a public registry such as quay.io
$ operator-sdk build quay.io/example/app-operator
$ docker push quay.io/example/app-operator

# Deploy the app-operator
$ kubectl create -f deploy/rbac.yaml
$ kubectl create -f deploy/operator.yaml

# By default, creating a custom resource (App) triggers the app-operator to deploy a busybox pod
$ kubectl create -f deploy/cr.yaml

# Verify that the busybox pod is created
$ kubectl get pod -l app=busy-box
NAME            READY     STATUS    RESTARTS   AGE
busy-box   1/1       Running   0          50s

# Cleanup
$ kubectl delete -f deploy/cr.yaml
$ kubectl delete -f deploy/operator.yaml
$ kubectl delete -f deploy/rbac.yaml

To learn more about the operator-sdk, see the user guide.

Samples

To explore any operator samples built using the operator-sdk, see the operator-sdk-samples.

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

Reporting bugs

See reporting bugs for details about reporting any issues.

License

Operator SDK is under Apache 2.0 license. See the LICENSE file for details.

operator-sdk's People

Contributors

fanminshi avatar hasbro17 avatar hongchaodeng avatar robszumski avatar spahl avatar andersjanmyr avatar

Watchers

James Cloos avatar  avatar  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.