kubekit

package module
v0.0.0-...-d390798 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2018 License: MIT Imports: 18 Imported by: 1

README

Kubekit

Build Status

Kubekit is a set of tools to help create Custom Resources for Kubernetes. Its goal is to provide a common library to create a set of Custom Resource Controllers.

Roadmap

  • Don't hardpin k8s on 1.9.3
  • Full Custom Controller example

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResyncPeriod = 5 * time.Second

ResyncPeriod is the delay between resync actions from the controller. This can be overwritten at package level to define the ResyncPeriod for the controller.

Functions

func Clientsets

Clientsets returns a set of clientsets for the given configuration.

func CreateCRD

func CreateCRD(cs clientset.Interface, c CustomResource) error

CreateCRD creates and registers a CRD with the k8s cluster.

func InClusterClientsets

func InClusterClientsets() (*rest.Config, kubernetes.Interface, clientset.Interface, error)

InClusterClientsets creates the in cluster configured clientsets with the rest.InClusterConfig.

func RESTClient

func RESTClient(cfg *rest.Config, sgv *schema.GroupVersion, schemeBuilders ...SchemeBuilder) (*rest.RESTClient, error)

RESTClient configures a new REST Client to be able to understand all the schemes defined. This way users can query objects associated with this scheme.

func TypeName

func TypeName(o interface{}) string

TypeName returns the Type Name of a given object.

Types

type CustomResource

type CustomResource struct {
	Name       string
	Plural     string
	Group      string
	Version    string
	Aliases    []string
	Scope      v1beta1.ResourceScope
	Object     runtime.Object
	Validation *v1beta1.CustomResourceValidation
}

CustomResource describes the configuration values for a CustomResourceDefinition.

func (CustomResource) Definition

Definition returns the CustomResourceDefinition that is linked to this CustomResource.

func (CustomResource) FullName

func (c CustomResource) FullName() string

FullName returns the combined name of the Plural and the Group.

func (CustomResource) GetName

func (c CustomResource) GetName() string

GetName returns the CustomResource Name. If no name is specified, the lowercased kind is used.

func (CustomResource) GetPlural

func (c CustomResource) GetPlural() string

GetPlural returns the pluralisation of the CustomResource. If no Plural value is specified, an 's' will be added to the Name.

func (CustomResource) GroupVersion

func (c CustomResource) GroupVersion() schema.GroupVersion

GroupVersion returns the GroupVersion Schema representation of this CustomResource.

func (CustomResource) GroupVersionKind

func (c CustomResource) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind returns the GroupVersionKind Schema representation of this CustomResource.

func (CustomResource) Kind

func (c CustomResource) Kind() string

Kind returns the Type Name of the CustomResource Object.

type Logging

type Logging interface {
	Infof(string, ...interface{})
}

Logging represents the interface kubekit uses for its logger instance.

var Logger Logging = &defaultLogger{}

Logger is the implementation of Logging which kubekit uses to log all it's information.

type SchemeBuilder

type SchemeBuilder func(*runtime.Scheme) error

SchemeBuilder allows us to add runtime.Scheme objects to our RESTClient.

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher represents a CRD Watcher Object. It knows enough details about a CRD to be able to create a controller and watch for changes.

func NewWatcher

func NewWatcher(cg cache.Getter, namespace string, resource *CustomResource, handler cache.ResourceEventHandler) *Watcher

NewWatcher returns a new watcher that can be used to watch in a given namespace. If namespace is an empty string, all namespaces will be watched.

func (*Watcher) Run

func (w *Watcher) Run(done <-chan struct{})

Run starts watching the CRDs associated with the Watcher through a Kubernetes CacheController.

Directories

Path Synopsis
Package patcher is heavily inspired by the work done in the Kubernetes kubectl package (https://github.com/kubernetes/kubernetes/tree/master/pkg/kubectl) It has been altered to make it easier to use from an extension point of view.
Package patcher is heavily inspired by the work done in the Kubernetes kubectl package (https://github.com/kubernetes/kubernetes/tree/master/pkg/kubectl) It has been altered to make it easier to use from an extension point of view.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL