 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- func CheckDeploymentReady(deployment *appsv1.Deployment) bool
- func ConditionsChanged(originalValues, newValues map[v1.ConditionType]v12.ConditionStatus) bool
- func ContainsStringValue(values []string, value string) bool
- func DeployClusterResources() bool
- func GetConditionValues(conditionList []v1.Condition) map[v1.ConditionType]v12.ConditionStatus
- func IsMutable(obj runtime.Object) bool
- func IsUpgrading(crStatus *api.Status) bool
- func LogJSONDiff(logger logr.Logger, objA, objB interface{})
- func MarkCrDeploying(crStatus *api.Status, reason, message string)
- func MarkCrFailed(crStatus *api.Status, reason, message string)
- func MarkCrFailedHealing(crStatus *api.Status, reason, message string)
- func MarkCrHealthyMessage(crStatus *api.Status, reason, message string)
- func MarkCrUpgradeHealingDegraded(crStatus *api.Status, reason, message string)
- func MergeLabelsAndAnnotations(src, dest metav1.Object)
- func MergeObject(desiredObj, currentObj runtime.Object, lastAppliedConfigAnnotation string) (runtime.Object, error)
- func NewDefaultInstance(obj runtime.Object) runtime.Object
- func NewIgnoreLeaderElectionPredicate() predicate.Predicate
- func SameResource(obj1, obj2 runtime.Object) bool
- func SetLabel(key, value string, obj metav1.Object)
- func ShouldTakeUpdatePath(logger logr.Logger, targetVersion, currentVersion string, deploying bool) (bool, error)
- func StripStatusByte(in []byte) ([]byte, error)
- func StripStatusFromObject(obj runtime.Object) (runtime.Object, error)
- type CallbackDispatcher
- type IgnoreWithMeta
- type ReconcileCallback
- type ReconcileCallbackArgs
- type ReconcileState
Constants ¶
const LeaderElectionAnnotation = "control-plane.alpha.kubernetes.io/leader"
    LeaderElectionAnnotation is the annotatation used on resources for leader election
Variables ¶
This section is empty.
Functions ¶
func CheckDeploymentReady ¶
func CheckDeploymentReady(deployment *appsv1.Deployment) bool
func ConditionsChanged ¶
func ConditionsChanged(originalValues, newValues map[v1.ConditionType]v12.ConditionStatus) bool
ConditionsChanged compares condition maps and return true if any of the conditions changed, false otherwise.
func ContainsStringValue ¶
func DeployClusterResources ¶
func DeployClusterResources() bool
func GetConditionValues ¶
func GetConditionValues(conditionList []v1.Condition) map[v1.ConditionType]v12.ConditionStatus
GetConditionValues gets the conditions and put them into a map for easy comparison
func IsUpgrading ¶
IsUpgrading checks whether cr status represents upgrade in progress
func LogJSONDiff ¶
func MarkCrDeploying ¶
MarkCrDeploying marks the passed CR as currently deploying. The CR object needs to be updated by the caller afterwards. Deploying means the following status conditions are set: ApplicationAvailable: false Progressing: true Degraded: false
func MarkCrFailed ¶
MarkCrFailed marks the passed CR as failed and requiring human intervention. The CR object needs to be updated by the caller afterwards. Failed means the following status conditions are set: ApplicationAvailable: false Progressing: false Degraded: true
func MarkCrFailedHealing ¶
MarkCrFailedHealing marks the passed CR as failed and healing. The CR object needs to be updated by the caller afterwards. FailedAndHealing means the following status conditions are set: ApplicationAvailable: false Progressing: true Degraded: true
func MarkCrHealthyMessage ¶
MarkCrHealthyMessage marks the passed in CR as healthy. The CR object needs to be updated by the caller afterwards. Healthy means the following status conditions are set: ApplicationAvailable: true Progressing: false Degraded: false
func MarkCrUpgradeHealingDegraded ¶
MarkCrUpgradeHealingDegraded marks the passed CR as upgrading and degraded. The CR object needs to be updated by the caller afterwards. Failed means the following status conditions are set: ApplicationAvailable: true Progressing: true Degraded: true
func MergeObject ¶
func NewIgnoreLeaderElectionPredicate ¶
NewIgnoreLeaderElectionPredicate returns a predicate used for ignoring leader election resources
func SameResource ¶
func ShouldTakeUpdatePath ¶
func StripStatusByte ¶
Types ¶
type CallbackDispatcher ¶
type CallbackDispatcher struct {
	// contains filtered or unexported fields
}
    CallbackDispatcher manages and executes resource callbacks
func NewCallbackDispatcher ¶
func NewCallbackDispatcher(log logr.Logger, client, uncachedClient client.Client, scheme *runtime.Scheme, namespace string) *CallbackDispatcher
NewCallbackDispatcher creates new callback dispatcher
func (*CallbackDispatcher) AddCallback ¶
func (cd *CallbackDispatcher) AddCallback(obj runtime.Object, cb ReconcileCallback)
AddCallback registers a callback for given object type
func (*CallbackDispatcher) InvokeCallbacks ¶
func (cd *CallbackDispatcher) InvokeCallbacks(l logr.Logger, cr interface{}, s ReconcileState, desiredObj, currentObj runtime.Object) error
InvokeCallbacks executes callbacks for desired/current object type
type IgnoreWithMeta ¶
IgnoreWithMeta ignores resources with specified labels/annotations
func (*IgnoreWithMeta) Create ¶
func (p *IgnoreWithMeta) Create(e event.CreateEvent) bool
Create implements Predicate
func (*IgnoreWithMeta) Delete ¶
func (p *IgnoreWithMeta) Delete(e event.DeleteEvent) bool
Delete implements Predicate
func (*IgnoreWithMeta) Generic ¶
func (p *IgnoreWithMeta) Generic(e event.GenericEvent) bool
Generic implements Predicate
func (*IgnoreWithMeta) Update ¶
func (p *IgnoreWithMeta) Update(e event.UpdateEvent) bool
Update implements Predicate
type ReconcileCallback ¶
type ReconcileCallback func(args *ReconcileCallbackArgs) error
ReconcileCallback is the callback function
type ReconcileCallbackArgs ¶
type ReconcileCallbackArgs struct {
	Logger    logr.Logger
	Client    client.Client
	Scheme    *runtime.Scheme
	Namespace string
	Resource  interface{}
	State         ReconcileState
	DesiredObject runtime.Object
	CurrentObject runtime.Object
}
    ReconcileCallbackArgs contains the data of a ReconcileCallback
type ReconcileState ¶
type ReconcileState string
ReconcileState is the current state of the reconcile for a particuar resource
const ( // ReconcileStatePreCreate is the state before a resource is created ReconcileStatePreCreate ReconcileState = "PRE_CREATE" // ReconcileStatePostCreate is the state sfter a resource is created ReconcileStatePostCreate ReconcileState = "POST_CREATE" // ReconcileStatePostRead is the state sfter a resource is read ReconcileStatePostRead ReconcileState = "POST_READ" // ReconcileStatePreUpdate is the state before a resource is updated ReconcileStatePreUpdate ReconcileState = "PRE_UPDATE" // ReconcileStatePostUpdate is the state after a resource is updated ReconcileStatePostUpdate ReconcileState = "POST_UPDATE" // ReconcileStatePreDelete is the state before a resource is explicitly deleted (probably during upgrade) // don't count on this always being called for your resource // ideally we just let garbage collection do it's thing ReconcileStatePreDelete ReconcileState = "PRE_DELETE" // ReconcileStatePostDelete is the state after a resource is explicitly deleted (probably during upgrade) // don't count on this always being called for your resource // ideally we just let garbage collection do it's thing ReconcileStatePostDelete ReconcileState = "POST_DELETE" // ReconcileStateOperatorDelete is called during CR finalizer ReconcileStateOperatorDelete ReconcileState = "OPERATOR_DELETE" )