Documentation
¶
Index ¶
- Constants
- func AreChecksEqual(c1 Check, c2 Check) bool
- func Get[T client.Object](ctx context.Context, cli client.Client, nn types.NamespacedName, obj T) (T, error)
- func GetLocal[T any, V Resource](r *Request[V], key string) (T, bool)
- func GetRaw[T any](ctx context.Context, cli client.Client, nn types.NamespacedName, ...) (*T, error)
- func ReconcileFilter(eventRecorder ...record.EventRecorder) predicate.Funcs
- func SetLocal[T any, V Resource](r *Request[V], key string, value T)
- type Check
- type CheckMeta
- type CheckWrapper
- type KV
- type NamedReconciler
- type Reconciler
- type Reconciler2
- type Request
- func (r *Request[T]) AddToOwnedResources(refs ...ResourceRef)
- func (r *Request[T]) CleanupOwnedResources(check *CheckWrapper[T]) stepResult.Result
- func (r *Request[T]) ClearStatusIfAnnotated() stepResult.Result
- func (r *Request[T]) Context() context.Context
- func (r *Request[T]) Done(result ...ctrl.Result) stepResult.Result
- func (r *Request[T]) EnsureCheckList(expected []CheckMeta) stepResult.Result
- func (r *Request[T]) EnsureChecks(names ...string) stepResult.Result
- func (r *Request[T]) EnsureFinalizers(finalizers ...string) stepResult.Result
- func (r *Request[T]) EnsureLabelsAndAnnotations() stepResult.Result
- func (r *Request[T]) Finalize() stepResult.Result
- func (r *Request[T]) ForceCleanupOwnedResources(check *CheckWrapper[T]) stepResult.Result
- func (r *Request[T]) GetAnchorName() string
- func (r *Request[T]) GetClient() client.Client
- func (r *Request[T]) GetOwnedK8sResources() []client.Object
- func (r *Request[T]) GetOwnedResources() []ResourceRef
- func (r *Request[T]) LogPostCheck(checkName string)
- func (r *Request[T]) LogPreCheck(checkName string)
- func (r *Request[T]) Next() stepResult.Result
- func (r *Request[T]) PostReconcile()
- func (r *Request[T]) PreReconcile()
- func (r *Request[T]) RestartIfAnnotated() stepResult.Result
- func (r *Request[T]) ShouldReconcile() bool
- type Resource
- type ResourceRef
- type State
- type Status
Constants ¶
const ( AnnotationShouldReconcileKey string = "kloudlite.io/operator.should-reconcile" AnnotationClearStatusKey string = "kloudlite.io/operator.clear-status" AnnotationResetCheckKey string = "kloudlite.io/operator.reset-check" AnnotationRestartKey string = "kloudlite.io/do-restart" )
const ( AnnotationResourceReady string = "kloudlite.io/operator.resource.ready" AnnotationResourceChecks string = "kloudlite.io/operator.checks" )
const ( CommonFinalizer string = "kloudlite.io/finalizer" ForegroundFinalizer string = "foregroundDeletion" BillingFinalizer string = "finalizers.kloudlite.io/billing-watcher" StatusWatcherFinalizer string = "finalizers.kloudlite.io/status-watcher" GenericFinalizer string = "kloudlite.io/finalizer" )
Finalizers
const ( AnnotationDescriptionKey string = "kloudlite.io/description" LastAppliedKey string = "kloudlite.io/last-applied" GVKKey string = "kloudlite.io/group-version-kind" )
Generic Keys
const ( ReasonGenerationUpdated string = "GENERATION_UPDATED" ReasonDeletionTimestamp string = "DELETION_TIMESTAMP" ReasonLabelsUpdated string = "LABELS_UPDATED" ReasonAnnotationsUpdated string = "ANNOTATIONS_UPDATED" ReasonFinalizersUpdated string = "FINALIZERS_UPDATED" ReasonOwnerReferencesUpdated string = "OWNER_REFERENCES_UPDATED" ReasonStatusIsReadyChanged string = "STATUS_IS_READY_CHANGED" ReasonStatusChecksUpdated string = "CHECKS_UPDATED" )
const (
KloudliteDNSHostnameKey string = "kloudlite.io/dns.hostname"
)
Variables ¶
This section is empty.
Functions ¶
func AreChecksEqual ¶
func GetRaw ¶
func GetRaw[T any](ctx context.Context, cli client.Client, nn types.NamespacedName, obj *unstructured.Unstructured) (*T, error)
func ReconcileFilter ¶
func ReconcileFilter(eventRecorder ...record.EventRecorder) predicate.Funcs
Types ¶
type Check ¶
type Check struct {
Status bool `json:"status"`
Message string `json:"message,omitempty"`
Generation int64 `json:"generation,omitempty"`
State State `json:"state,omitempty"`
StartedAt *metav1.Time `json:"startedAt,omitempty"`
Info string `json:"info,omitempty"`
Debug string `json:"debug,omitempty"`
Error string `json:"error,omitempty"`
}
+kubebuilder:object:generate=true
func (*Check) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Check.
func (*Check) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CheckMeta ¶
type CheckMeta struct {
Name string `json:"name"`
Title string `json:"title"`
Description *string `json:"description,omitempty"`
Debug bool `json:"debug,omitempty"`
Hide bool `json:"hide,omitempty"`
}
+kubebuilder:object:generate=true
func (*CheckMeta) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheckMeta.
func (*CheckMeta) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CheckWrapper ¶
type CheckWrapper[T Resource] struct { Check `json:",inline"` // contains filtered or unexported fields }
func NewRunningCheck ¶
func NewRunningCheck[T Resource](name string, req *Request[T]) *CheckWrapper[T]
func (*CheckWrapper[T]) Completed ¶
func (cw *CheckWrapper[T]) Completed() step_result.Result
func (*CheckWrapper[T]) Failed ¶
func (cw *CheckWrapper[T]) Failed(err error) step_result.Result
func (*CheckWrapper[T]) StillRunning ¶
func (cw *CheckWrapper[T]) StillRunning(err error) step_result.Result
type NamedReconciler ¶
type NamedReconciler interface {
GetName() string
}
type Reconciler ¶
type Reconciler2 ¶
type Reconciler2 struct {
reconcile.Reconciler
NamedReconciler
}
type Request ¶
type Request[T Resource] struct { Object T Logger *slog.Logger KV KV // contains filtered or unexported fields }
func NewRequest ¶
func (*Request[T]) AddToOwnedResources ¶
func (r *Request[T]) AddToOwnedResources(refs ...ResourceRef)
func (*Request[T]) CleanupOwnedResources ¶
func (r *Request[T]) CleanupOwnedResources(check *CheckWrapper[T]) stepResult.Result
func (*Request[T]) ClearStatusIfAnnotated ¶
func (r *Request[T]) ClearStatusIfAnnotated() stepResult.Result
func (*Request[T]) EnsureCheckList ¶
func (r *Request[T]) EnsureCheckList(expected []CheckMeta) stepResult.Result
func (*Request[T]) EnsureChecks ¶
func (r *Request[T]) EnsureChecks(names ...string) stepResult.Result
func (*Request[T]) EnsureFinalizers ¶
func (r *Request[T]) EnsureFinalizers(finalizers ...string) stepResult.Result
func (*Request[T]) EnsureLabelsAndAnnotations ¶
func (r *Request[T]) EnsureLabelsAndAnnotations() stepResult.Result
func (*Request[T]) Finalize ¶
func (r *Request[T]) Finalize() stepResult.Result
func (*Request[T]) ForceCleanupOwnedResources ¶
func (r *Request[T]) ForceCleanupOwnedResources(check *CheckWrapper[T]) stepResult.Result
INFO: this should only be used for very specific cases, where there is no other way to cleanup owned resources Like, when deleting ManagedService
- all managed resources should be deleted, but since owner is already getting deleted, there is no point in their proper cleanup
func (*Request[T]) GetAnchorName ¶
func (*Request[T]) GetOwnedK8sResources ¶
func (*Request[T]) GetOwnedResources ¶
func (r *Request[T]) GetOwnedResources() []ResourceRef
func (*Request[T]) LogPostCheck ¶
func (*Request[T]) LogPreCheck ¶
func (*Request[T]) Next ¶
func (r *Request[T]) Next() stepResult.Result
func (*Request[T]) PostReconcile ¶
func (r *Request[T]) PostReconcile()
func (*Request[T]) PreReconcile ¶
func (r *Request[T]) PreReconcile()
func (*Request[T]) RestartIfAnnotated ¶
func (r *Request[T]) RestartIfAnnotated() stepResult.Result
func (*Request[T]) ShouldReconcile ¶
type ResourceRef ¶
type ResourceRef struct {
metav1.TypeMeta `json:",inline" graphql:"children-required"`
Namespace string `json:"namespace"`
Name string `json:"name"`
}
+kubebuilder:object:generate=true
func ParseResourceRef ¶
func ParseResourceRef(obj client.Object) ResourceRef
func (*ResourceRef) DeepCopy ¶
func (in *ResourceRef) DeepCopy() *ResourceRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef.
func (*ResourceRef) DeepCopyInto ¶
func (in *ResourceRef) DeepCopyInto(out *ResourceRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Status ¶
type Status struct {
// +kubebuilder:validation:Optional
IsReady bool `json:"isReady"`
Resources []ResourceRef `json:"resources,omitempty"`
CheckList []CheckMeta `json:"checkList,omitempty"`
Checks map[string]Check `json:"checks,omitempty"`
LastReadyGeneration int64 `json:"lastReadyGeneration,omitempty"`
LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"`
}
+kubebuilder:object:generate=true +kubebuilder:printcolumn:JSONPath=".status.isReady",name=Ready,type=boolean +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name=Age,type=date
func (*Status) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.
func (*Status) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.