Coder Social home page Coder Social logo

kluster's Introduction

kluster

create code to create new runtime object (we can also call it CRD as a code) and register it using schemes clientset would not be available by default as we are registering new runtime object (that implements deepcopy, set and get group version) informers: used to let operator know that particluar resources created or deleted (other events etc) lister: it will get resources from informer cache

we need global and local tags too in our code

code generator will create following in pkg dir bash /home/vikash/go/pkg/mod/k8s.io/[email protected]/generate-groups.sh all github.com/vikas-gautam/kluster/pkg/client github.com/vikas-gautam/kluster/pkg/apis "golearning.dev:v1alpha1" --go-header-file /home/vikash/go/pkg/mod/k8s.io/[email protected]/hack/boilerplate.go.txt

#under pkg dir deep copy object

#under client dir clientset informers lister

generate crd with controller-gen

./controller-gen paths=github.com/vikas-gautam/kluster/apis/golearning.dev/v1alpha1  crd:crdVersions=v1 output:crd:artifacts:config=manifests 

create cr in manifests folder

#subresources and additional printer columns once cluster is created on DO it returns ClusterID now to proceed further we need to store ClusterID somewhere

Hence we can hava status field appended to the yaml (by controller) of custom resource which will have all the required information.

apiVersion: kind: metadata: spec: --- --- status: clusterid kubeconfig progress

status is written by controller only.

#subresources: pod - resource logs as subresources (native subresources)


#event recorder for kluster and routines to handle objects from queue: P5

progress status field is static as of now i.e. creating in kluster.go - run a DO API query to check cluster status and then change that static - creating state to runnng waitForCluster to be up and running, once it is running update status to be running

record events - it prints the events under events field when u describe resource. all the controllers or components those do something for resource they update their events under event field of that particular resource.


#packaging operator

 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build    
 kubectl create deployment kluster --image vikas93/kluster:0.1.0 --dry-run=client -oyaml > install/deploy.yaml
 kubectl create serviceaccount kluster-sa --dry-run=client -oyaml > install/sa.yaml
 kubectl create clusterrole kluster-cr --resource kluster --verb list,watch --dry-run=client -oyaml > install/cr.yaml
 kubectl create clusterrolebinding kluster-crb --clusterrole=kluster-cr --serviceaccount=default:kluster-sa  --dry-run=client -oyaml > install/crb.yaml
 kubectl create role k-role --resource secret --verb get -dry-run=client -oyaml > install/krole.yaml
 kubectl create rolebinding k-rb --serviceaccount=default:kluster-sa --role=k-role --dry-run=client -oyaml > install/kroleb.yaml

kluster's People

Contributors

vikas-gautam avatar

Stargazers

Roman avatar  avatar

Watchers

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