controller

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// a kubernetes client object
	Client kubernetes.Interface
}

func NewController

func NewController(client kubernetes.Interface) *Controller

NewController instantiates a new controller.

func (*Controller) EnsureConfigMap

func (c *Controller) EnsureConfigMap(namespace, configMapName string) error

EnsureConfigMap creates a ConfigMap specified by namespace and name if it doesn't already exist.

func (*Controller) GenerateConfig

func (c *Controller) GenerateConfig(ingresses ...extensions.Ingress) (*armor.Armor, error)

GenerateConfig receives a list of Ingress objects and generates a corresponding Armor config from it. It also sets up some default plugins and enables automatic TLS certificate retrieval from Let's Encrypt.

func (*Controller) GetIngresses

func (c *Controller) GetIngresses() ([]extensions.Ingress, error)

GetIngresses returns a slice of all Ingress objects that are annotated with this controller's annotation identifier.

func (*Controller) GetNodeIPs

func (c *Controller) GetNodeIPs() ([]string, error)

GetNodeIPs returns the public IPs of all nodes in the cluster.

func (*Controller) UpdateDaemonSet

func (c *Controller) UpdateDaemonSet(daemonSet *extensions.DaemonSet, config *armor.Armor) (*extensions.DaemonSet, error)

UpdateDaemonSet updates the passed in DaemonSet. It updates the annotation in the DaemonSet as well as in the Pod template spec with the hash of the passed in config. This won't update any pods immediately but newly created pods will correspond to the new template spec.

TODO(linki): tests with different namespace don't fail ?? TODO(linki): pods do not get updated correctly

func (*Controller) UpdateDaemonSetByName

func (c *Controller) UpdateDaemonSetByName(namespace string, daemonSetName string, config *armor.Armor) (*extensions.DaemonSet, error)

UpdateDaemonSetByName updates a DaemonSet identified by namespace and name.

func (*Controller) UpdateDeployment

func (c *Controller) UpdateDeployment(deployment *extensions.Deployment, config *armor.Armor) error

UpdateDeployment updates the passed in Deployment. It updates the annotation in the Deployment as well as in the Pod template spec with the hash of the passed in config so that the deployment controller will update the pods.

TODO(linki): tests with different namespace don't fail ??

func (*Controller) UpdateDeploymentByName

func (c *Controller) UpdateDeploymentByName(namespace string, deploymentName string, config *armor.Armor) error

UpdateDeploymentByName updates a Deployment identified by namespace and name.

func (*Controller) UpdateIngressLoadBalancers

func (c *Controller) UpdateIngressLoadBalancers(ingresses []extensions.Ingress, IPs ...string) error

UpdateIngressLoadBalancers takes a slice of Ingress objects and updates the Status.LoadBalancer section with the given IPs.

func (*Controller) UpdatePodsByLabelSelector

func (c *Controller) UpdatePodsByLabelSelector(namespace string, selector labels.Selector, config *armor.Armor) error

UpdatePodsByLabelSelector deletes all pods matching a provided label selector that are not annotated with the hash of the passed in config. When passed the label selector of a DaemonSet this can be used to force the pods to be updated.

func (*Controller) WriteConfigToConfigMap

func (c *Controller) WriteConfigToConfigMap(config *armor.Armor, configMap *v1.ConfigMap, key string) error

WriteConfigToConfigMap updates a passed in ConfigMap and stores the JSON representation of the passed in Armor config under the provided key. It also annotates the ConfigMap with the hash of its content.

func (*Controller) WriteConfigToConfigMapByName

func (c *Controller) WriteConfigToConfigMapByName(config *armor.Armor, namespace, configMapName, key string) error

WriteConfigToConfigMapByName updates a ConfigMap identified by namespace and name and stores the JSON representation of the passed in Armor config under the provided key.

func (*Controller) WriteConfigToWriter

func (c *Controller) WriteConfigToWriter(config *armor.Armor, writer io.Writer) error

WriteConfigToWriter writes the JSON representation of an Armor config to a Writer.

Jump to

Keyboard shortcuts

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