Documentation
¶
Index ¶
- func BundleStatusChangedPredicate() predicate.TypedFuncs[*fleet.Bundle]
- func MergeConditions(live, base, desired []genericcondition.GenericCondition, foreign ...string) []genericcondition.GenericCondition
- func NotReadyBundle(ctx context.Context, c client.Reader, namespace, label, value string) (*fleet.Bundle, error)
- func PatchStatus(ctx context.Context, c client.Client, orig, obj client.Object) error
- func SetFields(list *fleet.BundleDeploymentList, status *fleet.StatusBase) error
- func SetReadyCondition(status *fleet.StatusBase, notReadyBundle *fleet.Bundle, acceptedType string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BundleStatusChangedPredicate ¶
func BundleStatusChangedPredicate() predicate.TypedFuncs[*fleet.Bundle]
BundleStatusChangedPredicate returns true if the bundle status has changed, or the bundle was created
func MergeConditions ¶
func MergeConditions( live, base, desired []genericcondition.GenericCondition, foreign ...string, ) []genericcondition.GenericCondition
MergeConditions merges the condition list a controller wants to publish into the list currently live on the object.
A merge patch replaces the whole conditions array, so a controller which rebuilds that array from a snapshot taken at the start of its reconcile silently reverts, or outright deletes, conditions another controller wrote while it was working. Fleet has several writers per object (the GitRepo and HelmOp reconcilers, their polling jobs and their status reconcilers), so that window is real: a polling job clearing Stalled can be undone seconds later by a reconciler that started before the clear.
Comparing desired against base, the list as the caller first read it, tells the two cases apart. A condition type whose value the caller actually changed is one it computed, and wins. Every other type is only a stale echo of the read, and keeps whatever is live. Types named in foreign are owned by another controller entirely and are always taken from live.
Conditions are never removed, only added or updated, so live ordering is preserved and types the caller newly computed are appended.
func NotReadyBundle ¶
func NotReadyBundle(ctx context.Context, c client.Reader, namespace, label, value string) (*fleet.Bundle, error)
NotReadyBundle returns the first bundle in namespace with the given label which is not ready, or nil. Its Ready condition needs to be made explicitly visible in the status of the GitRepo or HelmOp owning it, since the other statuses are calculated from bundle deployments, which do not exist when rendering manifests or targeting fail.
func PatchStatus ¶
PatchStatus patches the status of obj against orig under an optimistic lock, skipping the request if nothing changed.
func SetFields ¶
func SetFields(list *fleet.BundleDeploymentList, status *fleet.StatusBase) error
setFields sets bundledeployment related status fields: Summary, ReadyClusters, DesiredReadyClusters, Display.State, Display.Message, Display.Error
func SetReadyCondition ¶
func SetReadyCondition(status *fleet.StatusBase, notReadyBundle *fleet.Bundle, acceptedType string)
SetReadyCondition computes the Ready condition of a GitRepo or HelmOp status, from, in order of precedence:
- the Ready condition of notReadyBundle, a bundle which is not ready, if any. This makes rendering issues visible, as no bundle deployments exist in that case;
- the bundle deployments summary, when not all of them are ready;
- the condition of type acceptedType, when the reconciler of the resource rejected or failed to process it (eg. a restriction violation, or a missing secret). This applies even when all bundle deployments are ready, as those reflect a previous state of the resource. Without this, a resource with no bundles yet would also be reported as ready, as an empty summary is a ready one.
More specific bundle errors take precedence over Accepted, which remains visible on its own condition.
Ready is set exactly once, so that its LastUpdateTime only changes when its content does, instead of on each reconcile which would flip it in memory.
It expects status.Summary and status.Display to be set from bundle deployments already, see SetFields. When Ready reflects an error which no bundle deployment does, the Display message and error are set from it too. A bundle is also not ready while its deployments are, eg. during a rollout, which is not an error. Hence a bundle's Ready condition is only displayed as an error when all bundle deployments are ready, or none exist. The bundle's own summary cannot tell those apart: it counts targets, not deployments, and is left stale when the bundle reconciler fails before computing it.
Types ¶
This section is empty.