k8s

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package k8s contains helpers for setting the IngressRoute status

Copyright © 2020 VMware Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	StatusValid    = "valid"
	StatusInvalid  = "invalid"
	StatusOrphaned = "orphaned"
)

Variables

This section is empty.

Functions

func KindOf added in v1.1.0

func KindOf(obj interface{}) string

KindOf returns the kind string for the given Kubernetes object.

The API machinery doesn't populate the metav1.TypeMeta field for objects, so we have to use a type assertion to detect kinds that we care about.

Types

type Clients added in v1.3.0

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

Clients holds the various API clients required by Contour.

func NewClients added in v1.3.0

func NewClients(kubeconfig string, inCluster bool) (*Clients, error)

NewClients returns a new set of the various API clients required by Contour using the supplied kubeconfig path, or the cluster environment variables if inCluster is true.

func (*Clients) ClientSet added in v1.3.0

func (c *Clients) ClientSet() *kubernetes.Clientset

ClientSet returns the Kubernetes Core v1 ClientSet.

func (*Clients) CoordinationClient added in v1.3.0

func (c *Clients) CoordinationClient() *coordinationv1.CoordinationV1Client

CoordinationClient returns the Kubernets Core v1 coordination client.

func (*Clients) DynamicClient added in v1.3.0

func (c *Clients) DynamicClient() dynamic.Interface

DynamicClient returns the Dyanmic client.

func (*Clients) NewDynamicInformerFactory added in v1.3.0

func (c *Clients) NewDynamicInformerFactory() dynamicinformer.DynamicSharedInformerFactory

NewDynamicInformerFactory returns a new DynamicSharedInformerFactory for use with any registered Kubernetes API type.

func (*Clients) NewInformerFactory added in v1.3.0

func (c *Clients) NewInformerFactory() informers.SharedInformerFactory

NewInformerFactory returns a new SharedInformerFactory for the core Kubernetes API types.

func (*Clients) NewInformerFactoryForNamespace added in v1.3.0

func (c *Clients) NewInformerFactoryForNamespace(namespace string) informers.SharedInformerFactory

NewInformerFactoryForNamespace returns a new SharedInformerFactory for the core Kubernetes API types for the namespace supplied.

type Converter added in v1.2.0

type Converter interface {
	Convert(obj interface{}) (interface{}, error)
}

type DynamicClientHandler added in v1.2.0

type DynamicClientHandler struct {

	// Next is the next handler in the chain.
	Next cache.ResourceEventHandler

	// Converter is the registered converter.
	Converter Converter

	Logger logrus.FieldLogger
}

DynamicClientHandler converts *unstructured.Unstructured from the k8s dynamic client to the types registered with the supplied Converter and forwards them to the next Handler in the chain.

func (*DynamicClientHandler) OnAdd added in v1.2.0

func (d *DynamicClientHandler) OnAdd(obj interface{})

func (*DynamicClientHandler) OnDelete added in v1.2.0

func (d *DynamicClientHandler) OnDelete(obj interface{})

func (*DynamicClientHandler) OnUpdate added in v1.2.0

func (d *DynamicClientHandler) OnUpdate(oldObj, newObj interface{})

type InformerSyncList added in v1.3.0

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

InformerSyncList holds the functions to call to check that an informer is synced.

func (*InformerSyncList) Add added in v1.3.0

Add adds the sync function from an informer to InformerSyncList and returns the informer so that .AddEventHandler() can be called on it.

func (*InformerSyncList) WaitForSync added in v1.3.0

func (sl *InformerSyncList) WaitForSync(stop <-chan struct{}) error

WaitForSync ensures that all the informers in the InformerSyncList are synced before returning.

type StatusCacher added in v1.1.0

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

StatusCacher keeps a cache of the latest status updates for Kubernetes objects.

func (*StatusCacher) Delete added in v1.1.0

func (c *StatusCacher) Delete(obj interface{})

Delete removes an object from the status cache.

func (*StatusCacher) GetStatus added in v1.1.0

func (c *StatusCacher) GetStatus(obj interface{}) (*projcontour.Status, error)

GetStatus returns the status (if any) for this given object.

func (*StatusCacher) IsCacheable added in v1.2.0

func (c *StatusCacher) IsCacheable(obj interface{}) bool

IsCacheable returns whether this type of object can be stored in the status cache.

func (*StatusCacher) SetStatus added in v1.1.0

func (c *StatusCacher) SetStatus(status, desc string, obj interface{}) error

SetStatus sets the IngressRoute status field to an Valid or Invalid status

type StatusClient added in v1.1.0

type StatusClient interface {
	SetStatus(status string, desc string, obj interface{}) error
	GetStatus(obj interface{}) (*projcontour.Status, error)
}

StatusClient updates the Status on a Kubernetes object.

type StatusWriter added in v1.1.0

type StatusWriter struct {
	Client dynamic.Interface
}

StatusWriter updates the object's Status field.

func (*StatusWriter) GetStatus added in v1.1.0

func (irs *StatusWriter) GetStatus(obj interface{}) (*projcontour.Status, error)

GetStatus is not implemented for StatusWriter.

func (*StatusWriter) SetStatus added in v1.1.0

func (irs *StatusWriter) SetStatus(status, desc string, existing interface{}) error

SetStatus sets the IngressRoute status field to an Valid or Invalid status

type UnstructuredConverter added in v1.2.0

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

UnstructuredConverter handles conversions between unstructured.Unstructured and Contour types

func NewUnstructuredConverter added in v1.2.0

func NewUnstructuredConverter() (*UnstructuredConverter, error)

NewUnstructuredConverter returns a new UnstructuredConverter initialized

func (*UnstructuredConverter) Convert added in v1.2.0

func (c *UnstructuredConverter) Convert(obj interface{}) (interface{}, error)

Convert converts an unstructured.Unstructured to typed struct. If obj is not an unstructured.Unstructured it is returned without further processing.

Jump to

Keyboard shortcuts

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