Documentation ¶
Index ¶
- func DefaultNamespace(ns string) func(name *types.NamespacedName)
- func DefaultResources() []schema.GroupVersionResource
- func EndpointsResources() []schema.GroupVersionResource
- func GatewayAPIResources() []schema.GroupVersionResource
- func IngressV1Resources() []schema.GroupVersionResource
- func InitLogging(options ...LogOption)
- func KindOf(obj interface{}) string
- func NamespacedNameFrom(nameStr string, opts ...func(*types.NamespacedName)) types.NamespacedName
- func NamespacedNameOf(obj metav1.Object) types.NamespacedName
- func NamespacesResource() schema.GroupVersionResource
- func NewContourScheme() (*runtime.Scheme, error)
- func NewNamespaceFilter(namespaces []string, next cache.ResourceEventHandler) cache.ResourceEventHandler
- func SecretsResources() []schema.GroupVersionResource
- func ServicesResources() []schema.GroupVersionResource
- func VersionOf(obj interface{}) string
- type Clients
- func (c *Clients) Cache() client.Reader
- func (c *Clients) ClientSet() *kubernetes.Clientset
- func (c *Clients) DynamicClient() dynamic.Interface
- func (c *Clients) InformerForResource(gvr schema.GroupVersionResource) (Informer, error)
- func (c *Clients) ResourcesExist(gvr ...schema.GroupVersionResource) bool
- func (c *Clients) StartInformers(ctx context.Context) error
- func (c *Clients) WaitForCacheSync(ctx context.Context) bool
- type Converter
- type DynamicClientHandler
- type Informer
- type LogOption
- type ServiceStatusLoadBalancerWatcher
- type StatusAddressUpdater
- type StatusMutator
- type StatusMutatorFunc
- type StatusUpdate
- type StatusUpdateCacher
- func (suc *StatusUpdateCacher) Add(name, namespace string, gvr schema.GroupVersionResource, obj interface{}) bool
- func (suc *StatusUpdateCacher) Get(name, namespace string, gvr schema.GroupVersionResource) interface{}
- func (suc *StatusUpdateCacher) GetStatus(obj interface{}) (*contour_api_v1.HTTPProxyStatus, error)
- func (suc *StatusUpdateCacher) IsCacheable(obj interface{}) bool
- func (suc *StatusUpdateCacher) OnAdd(obj interface{})
- func (suc *StatusUpdateCacher) OnDelete(obj interface{})
- func (suc *StatusUpdateCacher) Send(su StatusUpdate)
- type StatusUpdateHandler
- type StatusUpdateWriter
- type StatusUpdater
- type UnstructuredConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNamespace ¶ added in v1.7.0
func DefaultNamespace(ns string) func(name *types.NamespacedName)
DefaultNamespace can be used with NamespacedNameFrom to set the default namespace for a resource name that may not be qualified by a namespace.
func DefaultResources ¶ added in v1.6.0
func DefaultResources() []schema.GroupVersionResource
DefaultResources ...
func EndpointsResources ¶ added in v1.6.0
func EndpointsResources() []schema.GroupVersionResource
EndpointsResources ...
func GatewayAPIResources ¶ added in v1.13.0
func GatewayAPIResources() []schema.GroupVersionResource
GatewayAPIResources returns a list of Gateway API group/version resources.
func IngressV1Resources ¶ added in v1.13.0
func IngressV1Resources() []schema.GroupVersionResource
func InitLogging ¶ added in v1.9.0
func InitLogging(options ...LogOption)
InitLogging initializes the Kubernetes client-go logging subsystem.
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.
func NamespacedNameFrom ¶ added in v1.7.0
func NamespacedNameFrom(nameStr string, opts ...func(*types.NamespacedName)) types.NamespacedName
NamespacedNameFrom parses a resource name string into a fully qualified NamespacedName.
func NamespacedNameOf ¶ added in v1.7.0
func NamespacedNameOf(obj metav1.Object) types.NamespacedName
NamespacedNameOf returns the NamespacedName of any given Kubernetes object.
func NamespacesResource ¶ added in v1.14.0
func NamespacesResource() schema.GroupVersionResource
NamespacesResource ...
func NewContourScheme ¶ added in v1.10.0
NewContourScheme returns a scheme that includes all the API types that Contour supports as well as the core Kubernetes API types from the default scheme.
func NewNamespaceFilter ¶ added in v1.10.0
func NewNamespaceFilter( namespaces []string, next cache.ResourceEventHandler, ) cache.ResourceEventHandler
NewNamespaceFilter returns a cache.ResourceEventHandler that accepts only objects whose namespaces are included in the given slice of namespaces. Objects with matching namespaces are passed to the next handler.
func SecretsResources ¶ added in v1.6.0
func SecretsResources() []schema.GroupVersionResource
SecretsResources ...
func ServicesResources ¶ added in v1.6.0
func ServicesResources() []schema.GroupVersionResource
ServicesResources ...
Types ¶
type Clients ¶ added in v1.3.0
type Clients struct { meta.RESTMapper // contains filtered or unexported fields }
Clients holds the various API clients required by Contour.
func NewClients ¶ added in v1.3.0
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) DynamicClient ¶ added in v1.3.0
DynamicClient returns the dynamic client.
func (*Clients) InformerForResource ¶ added in v1.10.0
func (c *Clients) InformerForResource(gvr schema.GroupVersionResource) (Informer, error)
func (*Clients) ResourcesExist ¶ added in v1.9.0
func (c *Clients) ResourcesExist(gvr ...schema.GroupVersionResource) bool
ResourcesExist returns true if all of the GroupVersionResources passed exists in the cluster.
func (*Clients) StartInformers ¶ added in v1.10.0
type Converter ¶ added in v1.2.0
type Converter interface { FromUnstructured(obj interface{}) (interface{}, error) ToUnstructured(obj interface{}) (*unstructured.Unstructured, 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 LogOption ¶ added in v1.9.0
type LogOption func(*klogParams)
func LogLevelOption ¶ added in v1.9.0
LogLevelOption creates an option to set the Kubernetes verbose log level (1 - 10 is the standard range).
func LogWriterOption ¶ added in v1.9.0
LogWriterOption creates an option to set the Kubernetes logging output.
type ServiceStatusLoadBalancerWatcher ¶ added in v1.4.0
type ServiceStatusLoadBalancerWatcher struct { ServiceName string LBStatus chan v1.LoadBalancerStatus Log logrus.FieldLogger }
ServiceStatusLoadBalancerWatcher implements ResourceEventHandler and watches for changes to the status.loadbalancer field Note that we specifically *don't* inspect inside the struct, as sending empty values is desirable to clear the status.
func (*ServiceStatusLoadBalancerWatcher) OnAdd ¶ added in v1.4.0
func (s *ServiceStatusLoadBalancerWatcher) OnAdd(obj interface{})
func (*ServiceStatusLoadBalancerWatcher) OnDelete ¶ added in v1.4.0
func (s *ServiceStatusLoadBalancerWatcher) OnDelete(obj interface{})
func (*ServiceStatusLoadBalancerWatcher) OnUpdate ¶ added in v1.4.0
func (s *ServiceStatusLoadBalancerWatcher) OnUpdate(oldObj, newObj interface{})
type StatusAddressUpdater ¶ added in v1.5.0
type StatusAddressUpdater struct { Logger logrus.FieldLogger LBStatus v1.LoadBalancerStatus IngressClassName string StatusUpdater StatusUpdater Converter Converter // contains filtered or unexported fields }
StatusAddressUpdater observes informer OnAdd and OnUpdate events and updates the ingress.status.loadBalancer field on all Ingress objects that match the ingress class (if used). Note that this is intended to handle updating the status.loadBalancer struct only, not more general status updates. That's a job for the StatusUpdater.
func (*StatusAddressUpdater) OnAdd ¶ added in v1.5.0
func (s *StatusAddressUpdater) OnAdd(obj interface{})
OnAdd updates the given Ingress or HTTPProxy object with the current load balancer address. Note that this method can be called concurrently from an informer or from Contour itself.
func (*StatusAddressUpdater) OnDelete ¶ added in v1.5.0
func (s *StatusAddressUpdater) OnDelete(obj interface{})
func (*StatusAddressUpdater) OnUpdate ¶ added in v1.5.0
func (s *StatusAddressUpdater) OnUpdate(oldObj, newObj interface{})
func (*StatusAddressUpdater) Set ¶ added in v1.10.0
func (s *StatusAddressUpdater) Set(status v1.LoadBalancerStatus)
Set updates the LBStatus field.
type StatusMutator ¶ added in v1.5.0
type StatusMutator interface {
Mutate(obj interface{}) interface{}
}
StatusMutator is an interface to hold mutator functions for status updates.
type StatusMutatorFunc ¶ added in v1.5.0
type StatusMutatorFunc func(interface{}) interface{}
StatusMutatorFunc is a function adaptor for StatusMutators.
func (StatusMutatorFunc) Mutate ¶ added in v1.5.0
func (m StatusMutatorFunc) Mutate(old interface{}) interface{}
Mutate adapts the StatusMutatorFunc to fit through the StatusMutator interface.
type StatusUpdate ¶ added in v1.5.0
type StatusUpdate struct { NamespacedName types.NamespacedName Resource schema.GroupVersionResource Mutator StatusMutator }
StatusUpdate contains an all the information needed to change an object's status to perform a specific update. Send down a channel to the goroutine that actually writes the changes back.
func NewStatusUpdate ¶ added in v1.9.0
func NewStatusUpdate(name, namespace string, gvr schema.GroupVersionResource, mutator StatusMutator) StatusUpdate
type StatusUpdateCacher ¶ added in v1.5.0
type StatusUpdateCacher struct {
// contains filtered or unexported fields
}
StatusUpdateCacher takes status updates and applies them to a cache, to be used for testing.
func (*StatusUpdateCacher) Add ¶ added in v1.9.0
func (suc *StatusUpdateCacher) Add(name, namespace string, gvr schema.GroupVersionResource, obj interface{}) bool
func (*StatusUpdateCacher) Get ¶ added in v1.9.0
func (suc *StatusUpdateCacher) Get(name, namespace string, gvr schema.GroupVersionResource) interface{}
Get allows retrieval of objects from the cache.
func (*StatusUpdateCacher) GetStatus ¶ added in v1.9.0
func (suc *StatusUpdateCacher) GetStatus(obj interface{}) (*contour_api_v1.HTTPProxyStatus, error)
func (*StatusUpdateCacher) IsCacheable ¶ added in v1.9.0
func (suc *StatusUpdateCacher) IsCacheable(obj interface{}) bool
IsCacheable returns whether this type of object can be stored in the status cache.
func (*StatusUpdateCacher) OnAdd ¶ added in v1.9.0
func (suc *StatusUpdateCacher) OnAdd(obj interface{})
OnAdd adds an object to the status cache.
func (*StatusUpdateCacher) OnDelete ¶ added in v1.9.0
func (suc *StatusUpdateCacher) OnDelete(obj interface{})
OnDelete removes an object from the status cache.
func (*StatusUpdateCacher) Send ¶ added in v1.9.0
func (suc *StatusUpdateCacher) Send(su StatusUpdate)
type StatusUpdateHandler ¶ added in v1.5.0
type StatusUpdateHandler struct { Log logrus.FieldLogger Clients *Clients UpdateChannel chan StatusUpdate LeaderElected chan struct{} IsLeader bool Converter *UnstructuredConverter }
StatusUpdateHandler holds the details required to actually write an Update back to the referenced object.
func (*StatusUpdateHandler) Start ¶ added in v1.5.0
func (suh *StatusUpdateHandler) Start(stop <-chan struct{}) error
Start runs the goroutine to perform status writes. Until the Contour is elected leader, will drop updates on the floor.
func (*StatusUpdateHandler) Writer ¶ added in v1.5.0
func (suh *StatusUpdateHandler) Writer() StatusUpdater
Writer retrieves the interface that should be used to write to the StatusUpdateHandler.
type StatusUpdateWriter ¶ added in v1.5.0
type StatusUpdateWriter struct {
UpdateChannel chan StatusUpdate
}
StatusUpdateWriter takes status updates and sends these to the StatusUpdateHandler via a channel.
func (*StatusUpdateWriter) Send ¶ added in v1.9.0
func (suw *StatusUpdateWriter) Send(update StatusUpdate)
Send sends the given StatusUpdate off to the update channel for writing by the StatusUpdateHandler.
type StatusUpdater ¶ added in v1.5.0
type StatusUpdater interface {
Send(su StatusUpdate)
}
StatusUpdater describes an interface to send status updates somewhere.
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) FromUnstructured ¶ added in v1.5.0
func (c *UnstructuredConverter) FromUnstructured(obj interface{}) (interface{}, error)
FromUnstructured converts an unstructured.Unstructured to typed struct. If obj is not an unstructured.Unstructured it is returned without further processing.
func (*UnstructuredConverter) ToUnstructured ¶ added in v1.5.0
func (c *UnstructuredConverter) ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)
ToUnstructured converts the supplied object to Unstructured, provided it's one of the types registered in the UnstructuredConverter's Scheme.