Documentation ¶
Index ¶
- func ImageForOperandFromEnv() string
- func OperatorConditionToClusterOperatorCondition(condition operatorv1.OperatorCondition) configv1.ClusterOperatorStatusCondition
- func UnionClusterCondition(conditionType configv1.ClusterStatusConditionType, ...) configv1.ClusterOperatorStatusCondition
- func UnionCondition(conditionType string, defaultConditionStatus operatorv1.ConditionStatus, ...) operatorv1.OperatorCondition
- func VersionForOperand(namespace, imagePullSpec string, configMapGetter corev1client.ConfigMapsGetter, ...) string
- func VersionForOperandFromEnv() string
- func VersionForOperatorFromEnv() string
- type Inertia
- type InertiaCondition
- type InertiaConfig
- type RelatedObjectsFunc
- type StatusSyncer
- func (c *StatusSyncer) Name() string
- func (c *StatusSyncer) Run(ctx context.Context, workers int)
- func (c StatusSyncer) Sync(ctx context.Context, syncCtx factory.SyncContext) error
- func (c *StatusSyncer) WithDegradedInertia(inertia Inertia) *StatusSyncer
- func (c *StatusSyncer) WithRelatedObjectsFunc(f RelatedObjectsFunc)
- func (c *StatusSyncer) WithVersionRemoval() *StatusSyncer
- type VersionGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageForOperandFromEnv ¶
func ImageForOperandFromEnv() string
func OperatorConditionToClusterOperatorCondition ¶
func OperatorConditionToClusterOperatorCondition(condition operatorv1.OperatorCondition) configv1.ClusterOperatorStatusCondition
func UnionClusterCondition ¶
func UnionClusterCondition(conditionType configv1.ClusterStatusConditionType, defaultConditionStatus operatorv1.ConditionStatus, inertia Inertia, allConditions ...operatorv1.OperatorCondition) configv1.ClusterOperatorStatusCondition
UnionClusterCondition returns a single cluster operator condition that is the union of multiple operator conditions.
defaultConditionStatus indicates whether you want to merge all Falses or merge all Trues. For instance, Failures merge on true, but Available merges on false. Thing of it like an anti-default.
If inertia is non-nil, then resist returning a condition with a status opposite the defaultConditionStatus.
func UnionCondition ¶
func UnionCondition(conditionType string, defaultConditionStatus operatorv1.ConditionStatus, inertia Inertia, allConditions ...operatorv1.OperatorCondition) operatorv1.OperatorCondition
UnionCondition returns a single operator condition that is the union of multiple operator conditions.
defaultConditionStatus indicates whether you want to merge all Falses or merge all Trues. For instance, Failures merge on true, but Available merges on false. Thing of it like an anti-default.
If inertia is non-nil, then resist returning a condition with a status opposite the defaultConditionStatus.
func VersionForOperand ¶
func VersionForOperand(namespace, imagePullSpec string, configMapGetter corev1client.ConfigMapsGetter, eventRecorder events.Recorder) string
func VersionForOperandFromEnv ¶
func VersionForOperandFromEnv() string
func VersionForOperatorFromEnv ¶
func VersionForOperatorFromEnv() string
Types ¶
type Inertia ¶
type Inertia func(condition operatorv1.OperatorCondition) time.Duration
Inertia returns the inertial duration for the given condition.
type InertiaCondition ¶
type InertiaCondition struct { // ConditionTypeMatcher is a regular expression selecting condition types // with which this InertiaCondition is associated. ConditionTypeMatcher *regexp.Regexp // Duration is the inertial duration for associated conditions. Duration time.Duration }
InertiaCondition configures an inertia duration for a given set of condition types.
type InertiaConfig ¶
type InertiaConfig struct {
// contains filtered or unexported fields
}
InertiaConfig holds configuration for an Inertia implementation.
func MustNewInertia ¶
func MustNewInertia(defaultDuration time.Duration, conditions ...InertiaCondition) *InertiaConfig
MustNewInertia is like NewInertia but panics on error.
func NewInertia ¶
func NewInertia(defaultDuration time.Duration, conditions ...InertiaCondition) (*InertiaConfig, error)
NewInertia creates a new InertiaConfig object. Conditions are applied in the given order, so a condition type matching multiple regular expressions will have the duration associated with the first matching entry.
func (*InertiaConfig) Inertia ¶
func (c *InertiaConfig) Inertia(condition operatorv1.OperatorCondition) time.Duration
Inertia returns the configured inertia for the given condition type.
type RelatedObjectsFunc ¶
type RelatedObjectsFunc func() (isset bool, objs []configv1.ObjectReference)
type StatusSyncer ¶
type StatusSyncer struct {
// contains filtered or unexported fields
}
func NewClusterOperatorStatusController ¶
func NewClusterOperatorStatusController( name string, relatedObjects []configv1.ObjectReference, clusterOperatorClient configv1client.ClusterOperatorsGetter, clusterOperatorInformer configv1informers.ClusterOperatorInformer, operatorClient operatorv1helpers.OperatorClient, versionGetter VersionGetter, recorder events.Recorder, ) *StatusSyncer
func (*StatusSyncer) Name ¶
func (c *StatusSyncer) Name() string
func (StatusSyncer) Sync ¶
func (c StatusSyncer) Sync(ctx context.Context, syncCtx factory.SyncContext) error
sync reacts to a change in prereqs by finding information that is required to match another value in the cluster. This must be information that is logically "owned" by another component.
func (*StatusSyncer) WithDegradedInertia ¶
func (c *StatusSyncer) WithDegradedInertia(inertia Inertia) *StatusSyncer
WithDegradedInertia returns a copy of the StatusSyncer with the requested inertia function for degraded conditions.
func (*StatusSyncer) WithRelatedObjectsFunc ¶
func (c *StatusSyncer) WithRelatedObjectsFunc(f RelatedObjectsFunc)
WithRelatedObjectsFunc allows the set of related objects to be dynamically determined.
The function returns (isset, objects)
If isset is false, then the set of related objects is copied over from the existing ClusterOperator object. This is useful in cases where an operator has just restarted, and hasn't yet reconciled.
Any statically-defined related objects (in NewClusterOperatorStatusController) will always be included in the result.
func (*StatusSyncer) WithVersionRemoval ¶
func (c *StatusSyncer) WithVersionRemoval() *StatusSyncer
WithVersionRemoval returns a copy of the StatusSyncer that will remove versions that are missing in VersionGetter from the status.
type VersionGetter ¶
type VersionGetter interface { // SetVersion is a way to set the version for an operand. It must be thread-safe SetVersion(operandName, version string) // GetVersion is way to get the versions for all operands. It must be thread-safe and return an object that doesn't mutate GetVersions() map[string]string // VersionChangedChannel is a channel that will get an item whenever SetVersion has been called VersionChangedChannel() <-chan struct{} }
func NewVersionGetter ¶
func NewVersionGetter() VersionGetter