Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNamespacedName ¶
func GetNamespacedName() (*types.NamespacedName, error)
GetNamespacedName returns the NamespacedName of the CR. It returns an error when the name of the CR cannot be found from the environment variable set by OLM. Hence, GetNamespacedName() can provide the NamespacedName when the operator is running on cluster and is being managed by OLM. If running locally, operator writers are encouraged to skip this method or gracefully handle the errors by logging a message.
Types ¶
type Condition ¶
type Condition interface { // Get fetches the condition on the operator's // OperatorCondition. It returns an error if there are problems getting // the OperatorCondition object or if the specific condition type does not // exist. Get(ctx context.Context) (*metav1.Condition, error) // Set sets the specific condition on the operator's // OperatorCondition to the provided status. If the condition is not // present, it is added to the CR. // To set a new condition, the user can call this method and provide optional // parameters if required. It returns an error if there are problems getting or // updating the OperatorCondition object. Set(ctx context.Context, status metav1.ConditionStatus, option ...Option) error }
Condition can Get and Set a conditionType in an Operator Condition custom resource associated with the operator.
func NewCondition ¶
NewCondition returns a new Condition interface using the provided client for the specified conditionType. The condition will internally fetch the namespacedName of the operatorConditionCRD.
type Option ¶
Option is a function that applies a change to a condition. This can be used to set optional condition fields, like reasons and messages.
func WithMessage ¶
WithMessage is an Option, which adds the reason to the condition.
func WithReason ¶
WithReason is an Option, which adds the reason to the condition.