Documentation ¶
Index ¶
- func DefaultNamespace(ns string) func(name *types.NamespacedName)
- 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 NewCoreClient(kubeconfig string, inCluster bool) (*kubernetes.Clientset, error)
- func NewNamespaceFilter(namespaces []string, next cache.ResourceEventHandler) cache.ResourceEventHandler
- func NewRestConfig(kubeconfig string, inCluster bool) (*rest.Config, error)
- func NewSesameScheme() (*runtime.Scheme, error)
- func VersionOf(obj interface{}) string
- type LogOption
- type ServiceStatusLoadBalancerWatcher
- type StatusAddressUpdater
- type StatusMutator
- type StatusMutatorFunc
- type StatusUpdate
- type StatusUpdateCacher
- func (suc *StatusUpdateCacher) Add(name, namespace string, obj client.Object) bool
- func (suc *StatusUpdateCacher) Get(name, namespace string) interface{}
- func (suc *StatusUpdateCacher) GetStatus(obj interface{}) (*sesame_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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNamespace ¶
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 InitLogging ¶
func InitLogging(options ...LogOption)
InitLogging initializes the Kubernetes client-go logging subsystem.
func KindOf ¶
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 ¶
func NamespacedNameFrom(nameStr string, opts ...func(*types.NamespacedName)) types.NamespacedName
NamespacedNameFrom parses a resource name string into a fully qualified NamespacedName.
func NamespacedNameOf ¶
func NamespacedNameOf(obj metav1.Object) types.NamespacedName
NamespacedNameOf returns the NamespacedName of any given Kubernetes object.
func NewCoreClient ¶
func NewCoreClient(kubeconfig string, inCluster bool) (*kubernetes.Clientset, error)
NewCoreClient returns a new Kubernetes core API client using the supplied kubeconfig path, or the cluster environment variables if inCluster is true.
func NewNamespaceFilter ¶
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 NewRestConfig ¶
NewRestConfig returns a *rest.Config for the supplied kubeconfig path, or the cluster environment variables if inCluster is true.
func NewSesameScheme ¶
NewSesameScheme returns a scheme that includes all the API types that Sesame supports as well as the core Kubernetes API types from the default scheme.
Types ¶
type LogOption ¶
type LogOption func(*klogParams)
func LogLevelOption ¶
LogLevelOption creates an option to set the Kubernetes verbose log level (1 - 10 is the standard range).
func LogWriterOption ¶
LogWriterOption creates an option to set the Kubernetes logging output.
type ServiceStatusLoadBalancerWatcher ¶
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 ¶
func (s *ServiceStatusLoadBalancerWatcher) OnAdd(obj interface{})
func (*ServiceStatusLoadBalancerWatcher) OnDelete ¶
func (s *ServiceStatusLoadBalancerWatcher) OnDelete(obj interface{})
func (*ServiceStatusLoadBalancerWatcher) OnUpdate ¶
func (s *ServiceStatusLoadBalancerWatcher) OnUpdate(oldObj, newObj interface{})
type StatusAddressUpdater ¶
type StatusAddressUpdater struct { Logger logrus.FieldLogger Cache cache.Cache LBStatus v1.LoadBalancerStatus IngressClassName string GatewayControllerName string StatusUpdater StatusUpdater // 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 ¶
func (s *StatusAddressUpdater) OnAdd(obj interface{})
OnAdd updates the given Ingress/HTTPProxy/Gateway object with the current load balancer address. Note that this method can be called concurrently from an informer or from Sesame itself.
func (*StatusAddressUpdater) OnDelete ¶
func (s *StatusAddressUpdater) OnDelete(obj interface{})
func (*StatusAddressUpdater) OnUpdate ¶
func (s *StatusAddressUpdater) OnUpdate(oldObj, newObj interface{})
func (*StatusAddressUpdater) Set ¶
func (s *StatusAddressUpdater) Set(status v1.LoadBalancerStatus)
Set updates the LBStatus field.
type StatusMutator ¶
StatusMutator is an interface to hold mutator functions for status updates.
type StatusMutatorFunc ¶
StatusMutatorFunc is a function adaptor for StatusMutators.
type StatusUpdate ¶
type StatusUpdate struct { NamespacedName types.NamespacedName Resource client.Object 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 ¶
func NewStatusUpdate(name, namespace string, resource client.Object, mutator StatusMutator) StatusUpdate
type StatusUpdateCacher ¶
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 ¶
func (suc *StatusUpdateCacher) Add(name, namespace string, obj client.Object) bool
func (*StatusUpdateCacher) Get ¶
func (suc *StatusUpdateCacher) Get(name, namespace string) interface{}
Get allows retrieval of objects from the cache.
func (*StatusUpdateCacher) GetStatus ¶
func (suc *StatusUpdateCacher) GetStatus(obj interface{}) (*sesame_api_v1.HTTPProxyStatus, error)
func (*StatusUpdateCacher) IsCacheable ¶
func (suc *StatusUpdateCacher) IsCacheable(obj interface{}) bool
IsCacheable returns whether this type of object can be stored in the status cache.
func (*StatusUpdateCacher) OnAdd ¶
func (suc *StatusUpdateCacher) OnAdd(obj interface{})
OnAdd adds an object to the status cache.
func (*StatusUpdateCacher) OnDelete ¶
func (suc *StatusUpdateCacher) OnDelete(obj interface{})
OnDelete removes an object from the status cache.
func (*StatusUpdateCacher) Send ¶
func (suc *StatusUpdateCacher) Send(su StatusUpdate)
type StatusUpdateHandler ¶
type StatusUpdateHandler struct {
// contains filtered or unexported fields
}
StatusUpdateHandler holds the details required to actually write an Update back to the referenced object.
func NewStatusUpdateHandler ¶
func NewStatusUpdateHandler(log logrus.FieldLogger, client client.Client) *StatusUpdateHandler
func (*StatusUpdateHandler) NeedLeaderElection ¶
func (suh *StatusUpdateHandler) NeedLeaderElection() bool
func (*StatusUpdateHandler) Start ¶
func (suh *StatusUpdateHandler) Start(ctx context.Context) error
Start runs the goroutine to perform status writes.
func (*StatusUpdateHandler) Writer ¶
func (suh *StatusUpdateHandler) Writer() StatusUpdater
Writer retrieves the interface that should be used to write to the StatusUpdateHandler.
type StatusUpdateWriter ¶
type StatusUpdateWriter struct {
// contains filtered or unexported fields
}
StatusUpdateWriter takes status updates and sends these to the StatusUpdateHandler via a channel.
func (*StatusUpdateWriter) Send ¶
func (suw *StatusUpdateWriter) Send(update StatusUpdate)
Send sends the given StatusUpdate off to the update channel for writing by the StatusUpdateHandler.
type StatusUpdater ¶
type StatusUpdater interface {
Send(su StatusUpdate)
}
StatusUpdater describes an interface to send status updates somewhere.