Documentation
¶
Overview ¶
Package status contains all the function needed to interact properly with the resources status
Index ¶
- func FlagBackupAsFailed(ctx context.Context, cli client.Client, backup *apiv1.Backup, ...) error
- func PatchConditionsWithOptimisticLock(ctx context.Context, c client.Client, cluster *apiv1.Cluster, ...) error
- func PatchObjectWithOptimisticLock[T client.Object](ctx context.Context, c client.Client, obj T, txs ...func(T)) (T, error)
- func PatchWithOptimisticLock(ctx context.Context, c client.Client, cluster *apiv1.Cluster, ...) error
- func SetClusterReadyCondition(cluster *apiv1.Cluster)
- type BackupTransaction
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlagBackupAsFailed ¶ added in v1.25.3
func FlagBackupAsFailed( ctx context.Context, cli client.Client, backup *apiv1.Backup, cluster *apiv1.Cluster, err error, transactions ...BackupTransaction, ) error
FlagBackupAsFailed updates the status of a Backup object to indicate that it has failed.
func PatchConditionsWithOptimisticLock ¶ added in v1.23.6
func PatchConditionsWithOptimisticLock( ctx context.Context, c client.Client, cluster *apiv1.Cluster, conditions ...metav1.Condition, ) error
PatchConditionsWithOptimisticLock will update a particular condition in cluster status. This function may update the conditions in the passed cluster with the latest ones that were found from the API server. This function is needed because Kubernetes still doesn't support strategic merge for CRDs (see https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/).
func PatchObjectWithOptimisticLock ¶
func PatchObjectWithOptimisticLock[T client.Object]( ctx context.Context, c client.Client, obj T, txs ...func(T), ) (T, error)
PatchObjectWithOptimisticLock applies the given transactions, in order, to a freshly read copy of the object and patches its status under an optimistic lock, retrying on conflict so a write landing between the read and the patch is never lost, even where a merge patch replaces a whole field (as it does for `status.conditions`). The object the caller holds is left alone; a zero value is returned when the patch was a no-op.
func PatchWithOptimisticLock ¶ added in v1.23.6
func PatchWithOptimisticLock( ctx context.Context, c client.Client, cluster *apiv1.Cluster, txs ...Transaction, ) error
PatchWithOptimisticLock updates the status of the cluster using the passed transaction functions (in the given order). Important: after successfully updating the status, this function refreshes it into the passed cluster
func SetClusterReadyCondition ¶ added in v1.26.0
SetClusterReadyCondition updates the cluster's readiness condition according to the cluster phase
Types ¶
type BackupTransaction ¶ added in v1.25.3
BackupTransaction is a function that modifies a Backup object.
type Transaction ¶ added in v1.26.0
Transaction is a function that modifies a cluster. It is an alias, so that a list of transactions can be handed straight to PatchObjectWithOptimisticLock.
func SetImage ¶ added in v1.26.0
func SetImage(image string) Transaction
SetImage is a transaction that sets the cluster image
func SetPGDataImageInfo ¶ added in v1.26.0
func SetPGDataImageInfo(imageInfo *apiv1.ImageInfo) Transaction
SetPGDataImageInfo is a transaction that sets the PGDataImageInfo
func SetPhase ¶ added in v1.26.0
func SetPhase(phase string, reason string) Transaction
SetPhase is a transaction that sets the cluster phase and reason
func SetTargetPGDataImageInfo ¶ added in v1.29.2
func SetTargetPGDataImageInfo(imageInfo *apiv1.ImageInfo) Transaction
SetTargetPGDataImageInfo is a transaction that sets the TargetPGDataImageInfo, representing the target image for an in-progress major upgrade.
func SetTimelineID ¶ added in v1.27.3
func SetTimelineID(timelineID int) Transaction
SetTimelineID is a transaction that sets the cluster timeline ID