tmplctlr

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Client KubeClient //client for talking with kubernetes
	// contains filtered or unexported fields
}

Controller implements a valid crwatcher.ResourceController that will manage resources in kubernetes based on the provided template files.

func NewController

func NewController(tmplDir string, kubeCfg string, logger *zap.SugaredLogger) *Controller

NewController will return a configured Controller

func (Controller) ResourceAdded

func (c Controller) ResourceAdded(r *unstructured.Unstructured)

ResourceAdded is called when a custom resource is created and will generate the template files and apply them to Kubernetes

func (Controller) ResourceDeleted

func (c Controller) ResourceDeleted(r *unstructured.Unstructured)

ResourceDeleted is called when a custom resource is created and will generate the template files and delete them from Kubernetes

func (Controller) ResourceUpdated

func (c Controller) ResourceUpdated(oldR, newR *unstructured.Unstructured)

ResourceUpdated is called when a custom resource is updated or during a resync and will generate the template files and apply them to Kubernetes

type KubeClient

type KubeClient interface {
	Apply(file string) (string, error)
	Delete(file string) (string, error)
}

KubeClient is an interface that implements an Apply() and Delete() for our K8s templates

type Kubectl

type Kubectl struct {
	ConfigFile string //config file for kubectl
}

Kubectl provides a simple wrapper around calling the needed kubectl commands TODO: This should be revisited when https://github.com/kubernetes/kubernetes/issues/15894 is completed. #15894 will move the apply logic from kubectl into the API

func (Kubectl) Apply

func (k Kubectl) Apply(file string) (string, error)

Apply will execute kubectl apply -f file with the correct config

func (Kubectl) Delete

func (k Kubectl) Delete(file string) (string, error)

Delete will execute kubectl delete -f file with the correct config

Jump to

Keyboard shortcuts

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