Giter VIP home page Giter VIP logo

kluster's Introduction

Create a digital ocean kubernetes cluster using operator.

type name -> Kluster

group -> utsab.dev

version -> v1alpha1

  • The directory will look like

pkg/apis/utsab.dev/v1alpha1 --> inside with there should be types.go

  • Create main.go in the outside directory

  • Since the structs created in types.go are only the go structs and not necessarily a kubernetes object

  • Hence to convert the go struct to kubernetes object, we use register.go file.

  • Generate

    Deep copy objects
    
    ClientSet
    
    Informers
    
    Listers
    
  • We can use codegenerator project for this.

doc.go file

  • Types are the ways to control the behaviour of the code generator

    • global tags - specified in doc.go
    • local tags - specify tags in types.go
  • Even though the struct is registered in Kubernetes, CRD should be generated, so that kubernetes can access the struct.

use controller-gen

Registering and creating CRD should go in parallel

Controller

  • create folder as controller inside pkg folder

  • create a file kluster.go

  • call the digitalocean api using Spec

  • create do->digitalocean folder under pkg and create a file

  • We want to add other fields to the file by itself using controller like configuring clusterID, progress, kubeconfig on the yaml file without explicitly added by the user.

  • For this status subresource is useful.

apiVersion kind metadata: spec: // only should be updated by user ... ... status: // only should be updated by controller or operator clusterID progress kubeconfig

  • To obtain this, we use subresource making status and spec as the subresource gives an endpoint to which can be mapped a RBAC.

Every resource has an endpoint

resource apis/apps/v1/namespaces/<ns>/deployments v1/namespaces/<ns>/pods/<podname>/

Subresources pods --> logs, describe, exec

  • Endpoint for the subresource v1/namespaces/<ns>/pods/<podname>/logs

  • Suppose this is the role by which the operator is going to run role-test: resources: Kluster/status

  • This particular role will only allow operator to update the status part.

kluster's People

Contributors

utsab818 avatar

Stargazers

 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.