Documentation ¶
Index ¶
- Constants
- func MonitorClusterStatus(name string, syncCh <-chan error, stopCh <-chan struct{}, ...)
- func NewCSVWatchNotificationHandler(log *logrus.Logger, csvSet csv.SetGenerator, finder csv.ReplaceFinder, ...) *handler
- func NewMonitor(log *logrus.Logger, discovery discovery.DiscoveryInterface, ...) (Monitor, Sender)
- func Waiting(clock clock.Clock, name string) *configv1.ClusterOperatorStatus
- type Builder
- func (b *Builder) GetStatus() *configv1.ClusterOperatorStatus
- func (b *Builder) WithAvailable(status configv1.ConditionStatus, message, reason string) *Builder
- func (b *Builder) WithDegraded(status configv1.ConditionStatus) *Builder
- func (b *Builder) WithProgressing(status configv1.ConditionStatus, message string) *Builder
- func (b *Builder) WithRelatedObject(group, resource, namespace, name string) *Builder
- func (b *Builder) WithUpgradeable(status configv1.ConditionStatus, message string) *Builder
- func (b *Builder) WithVersion(name, version string) *Builder
- func (b *Builder) WithoutRelatedObject(group, resource, namespace, name string) *Builder
- func (b *Builder) WithoutVersion(name, version string) *Builder
- type Monitor
- type MutatorFunc
- type NotificationFunc
- type Sender
- type Writer
Constants ¶
const ( // SelectorKey is the key of the label we use to identify the // corresponding ClusterServiceVersion object related to the cluster operator. // If we want to update a cluster operator named "package-server" then the // corresponding ClusterServiceVersion must have the following label // // "olm.clusteroperator.name": "package-server" // SelectorKey = "olm.clusteroperator.name" )
Variables ¶
This section is empty.
Functions ¶
func MonitorClusterStatus ¶
func MonitorClusterStatus(name string, syncCh <-chan error, stopCh <-chan struct{}, opClient operatorclient.ClientInterface, configClient configv1client.ConfigV1Interface, crClient versioned.Interface)
func NewCSVWatchNotificationHandler ¶
func NewCSVWatchNotificationHandler(log *logrus.Logger, csvSet csv.SetGenerator, finder csv.ReplaceFinder, sender Sender) *handler
NewCSVWatchNotificationHandler returns a new instance of csv.WatchNotification This can be used to get notification of every CSV reconciliation request.
func NewMonitor ¶
func NewMonitor(log *logrus.Logger, discovery discovery.DiscoveryInterface, configClient configv1client.ConfigV1Interface, names ...string) (Monitor, Sender)
NewMonitor returns a new instance of Monitor that can be used to continuously update a clusteroperator resource and an instance of Sender that can be used to send update notifications to it.
The name of the clusteroperator resource to monitor is specified in name.
func Waiting ¶
func Waiting(clock clock.Clock, name string) *configv1.ClusterOperatorStatus
Waiting returns an initialized ClusterOperatorStatus object that is suited for creation if the given object does not exist already. The initialized object has the expected status for cluster operator resource before we have seen any corresponding CSV.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder helps build ClusterOperatorStatus with appropriate ClusterOperatorStatusCondition and OperandVersion.
func NewBuilder ¶
NewBuilder returns a builder for ClusterOperatorStatus.
func (*Builder) GetStatus ¶
func (b *Builder) GetStatus() *configv1.ClusterOperatorStatus
GetStatus returns the ClusterOperatorStatus built.
func (*Builder) WithAvailable ¶
func (b *Builder) WithAvailable(status configv1.ConditionStatus, message, reason string) *Builder
WithAvailable sets an OperatorAvailable type condition.
func (*Builder) WithDegraded ¶
func (b *Builder) WithDegraded(status configv1.ConditionStatus) *Builder
WithDegraded sets an OperatorDegraded type condition.
func (*Builder) WithProgressing ¶
func (b *Builder) WithProgressing(status configv1.ConditionStatus, message string) *Builder
WithProgressing sets an OperatorProgressing type condition.
func (*Builder) WithRelatedObject ¶
WithRelatedObject adds the reference specified to the RelatedObjects list.
func (*Builder) WithUpgradeable ¶
func (b *Builder) WithUpgradeable(status configv1.ConditionStatus, message string) *Builder
WithUpgradeable sets an OperatorUpgradeable type condition.
func (*Builder) WithVersion ¶
WithVersion adds the specific version into the status.
func (*Builder) WithoutRelatedObject ¶
WithoutRelatedObject removes the reference specified from the RelatedObjects list.
func (*Builder) WithoutVersion ¶
WithoutVersion removes the specified version from the existing status.
type Monitor ¶
type Monitor interface {
Run(stopCh <-chan struct{})
}
Monitor is an interface that wraps the Run method.
Run runs forever, it reads from an underlying notification channel and updates an clusteroperator resource accordingly. If the specified stop channel is closed the loop must terminate gracefully.
type MutatorFunc ¶
type MutatorFunc func(existing *configv1.ClusterOperatorStatus) (new *configv1.ClusterOperatorStatus)
MutatorFunc accepts an existing status object and appropriately mutates it to reflect the observed states.
func (MutatorFunc) Mutate ¶
func (m MutatorFunc) Mutate(existing *configv1.ClusterOperatorStatus) (new *configv1.ClusterOperatorStatus)
Mutate is a wrapper for MutatorFunc
type NotificationFunc ¶
type NotificationFunc func() (name string, mutator MutatorFunc)
NotificationFunc wraps a notification event. it returns the name of the cluster operator object associated and a mutator function that will set the new status for the cluster operator object.
func (NotificationFunc) Get ¶
func (n NotificationFunc) Get() (name string, mutator MutatorFunc)
Get is a wrapper for NotificationFunc.
type Sender ¶
type Sender interface {
Send(NotificationFunc)
}
Sender is an interface that wraps the Send method.
Send can be used to send notification(s) to the underlying monitor. Send is a non-blocking operation. If the underlying monitor is not ready to receive the notification will be lost. If the notification context specified is nil then it is ignored.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer encapsulates logic for cluster operator object API. It is used to update ClusterOperator resource.
func NewWriter ¶
func NewWriter(discovery discovery.DiscoveryInterface, client configv1client.ConfigV1Interface) *Writer
NewWriter returns a new instance of Writer.
func (*Writer) EnsureExists ¶
func (w *Writer) EnsureExists(name string) (existing *configv1.ClusterOperator, err error)
EnsureExists ensures that the cluster operator resource exists with a default status that reflects expecting status.
func (*Writer) IsAPIAvailable ¶
IsAPIAvailable return true if cluster operator API is present on the cluster. Otherwise, exists is set to false.
func (*Writer) UpdateStatus ¶
func (w *Writer) UpdateStatus(existing *configv1.ClusterOperator, newStatus *configv1.ClusterOperatorStatus) error
UpdateStatus updates the clusteroperator object with the new status specified.