Documentation ¶
Index ¶
- Constants
- func CUEBasedHealthCheck(ctx context.Context, c client.Client, wlRef WorkloadReference, ns string, ...) (*WorkloadHealthCondition, []*TraitHealthCondition)
- func Setup(mgr ctrl.Manager, args controller.Args) error
- type AppHealthCondition
- type AppInfo
- type HealthStatus
- type PeerHealthConditions
- type Reconciler
- func (r *Reconciler) CollectAppfilesAndAppNames(ctx context.Context, refs []WorkloadReference, ns string) (map[WorkloadReference]*af.Appfile, map[WorkloadReference]AppInfo)
- func (r *Reconciler) GetScopeHealthStatus(ctx context.Context, healthScope *v1alpha2.HealthScope) (ScopeHealthCondition, []*AppHealthCondition)
- func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
- func (r *Reconciler) UpdateStatus(ctx context.Context, hs *v1alpha2.HealthScope, ...) error
- type ReconcilerOption
- type ScopeHealthCondition
- type TraitHealthCondition
- type WorkloadHealthCheckFn
- type WorkloadHealthCondition
- func CheckByHealthCheckTrait(ctx context.Context, c client.Client, wlRef core.ObjectReference, ns string) *WorkloadHealthCondition
- func CheckDaemonsetHealth(ctx context.Context, client client.Client, ref core.ObjectReference, ...) *WorkloadHealthCondition
- func CheckDeploymentHealth(ctx context.Context, client client.Client, ref core.ObjectReference, ...) *WorkloadHealthCondition
- func CheckStatefulsetHealth(ctx context.Context, client client.Client, ref core.ObjectReference, ...) *WorkloadHealthCondition
- func CheckUnknownWorkload(ctx context.Context, c client.Client, wlRef core.ObjectReference, ns string) *WorkloadHealthCondition
- type WorkloadReference
- type WorloadHealthChecker
Constants ¶
const ( // StatusHealthy represents healthy status. StatusHealthy = v1alpha2.StatusHealthy // StatusUnhealthy represents unhealthy status. StatusUnhealthy = v1alpha2.StatusUnhealthy // StatusUnknown represents unknown status. StatusUnknown = v1alpha2.StatusUnknown )
Variables ¶
This section is empty.
Functions ¶
func CUEBasedHealthCheck ¶ added in v1.1.0
func CUEBasedHealthCheck(ctx context.Context, c client.Client, wlRef WorkloadReference, ns string, appfile *af.Appfile) (*WorkloadHealthCondition, []*TraitHealthCondition)
CUEBasedHealthCheck check workload and traits health through CUE-based health checking approach.
Types ¶
type AppHealthCondition ¶ added in v1.1.0
type AppHealthCondition = v1alpha2.AppHealthCondition
AppHealthCondition holds health status of an application
type AppInfo ¶ added in v1.1.1
type AppInfo struct {
// contains filtered or unexported fields
}
AppInfo contains app's name and app's env
type HealthStatus ¶
type HealthStatus = v1alpha2.HealthStatus
HealthStatus represents health status strings.
type PeerHealthConditions ¶
type PeerHealthConditions []WorkloadHealthCondition
PeerHealthConditions refers to a slice of health condition of worloads belonging to one version-enabled component
func (PeerHealthConditions) Len ¶
func (p PeerHealthConditions) Len() int
func (PeerHealthConditions) Less ¶
func (p PeerHealthConditions) Less(i, j int) bool
func (PeerHealthConditions) MergePeerWorkloadsConditions ¶
func (p PeerHealthConditions) MergePeerWorkloadsConditions(basic *WorkloadHealthCondition)
MergePeerWorkloadsConditions merge health conditions of all peer workloads into basic
func (PeerHealthConditions) Swap ¶
func (p PeerHealthConditions) Swap(i, j int)
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
A Reconciler reconciles OAM Scopes by keeping track of the health status of components.
func NewReconciler ¶
func NewReconciler(m ctrl.Manager, o ...ReconcilerOption) *Reconciler
NewReconciler returns a Reconciler that reconciles HealthScope by keeping track of its healthstatus.
func (*Reconciler) CollectAppfilesAndAppNames ¶ added in v1.1.0
func (r *Reconciler) CollectAppfilesAndAppNames(ctx context.Context, refs []WorkloadReference, ns string) (map[WorkloadReference]*af.Appfile, map[WorkloadReference]AppInfo)
CollectAppfilesAndAppNames retrieve appfiles and app names for CUEBasedHealthCheck
func (*Reconciler) GetScopeHealthStatus ¶
func (r *Reconciler) GetScopeHealthStatus(ctx context.Context, healthScope *v1alpha2.HealthScope) (ScopeHealthCondition, []*AppHealthCondition)
GetScopeHealthStatus get the status of the healthscope based on workload resources.
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile an OAM HealthScope by keeping track of its health status.
func (*Reconciler) UpdateStatus ¶ added in v0.3.3
func (r *Reconciler) UpdateStatus(ctx context.Context, hs *v1alpha2.HealthScope, opts ...client.SubResourceUpdateOption) error
UpdateStatus updates v1alpha2.HealthScope's Status with retry.RetryOnConflict
type ReconcilerOption ¶
type ReconcilerOption func(*Reconciler)
A ReconcilerOption configures a Reconciler.
func WithChecker ¶
func WithChecker(c WorloadHealthChecker) ReconcilerOption
WithChecker adds workload health checker
func WithRecorder ¶
func WithRecorder(er event.Recorder) ReconcilerOption
WithRecorder specifies how the Reconciler should record events.
func WithTraitChecker ¶
func WithTraitChecker(c WorloadHealthChecker) ReconcilerOption
WithTraitChecker adds health checker based on HealthCheckTrait
type ScopeHealthCondition ¶
type ScopeHealthCondition = v1alpha2.ScopeHealthCondition
ScopeHealthCondition holds health condition of a scope
type TraitHealthCondition ¶ added in v1.1.0
type TraitHealthCondition = v1alpha2.TraitHealthCondition
TraitHealthCondition holds health status of a trait
type WorkloadHealthCheckFn ¶
type WorkloadHealthCheckFn func(context.Context, client.Client, core.ObjectReference, string) *WorkloadHealthCondition
WorkloadHealthCheckFn checks health status of specified resource and saves status into an HealthCondition object.
func (WorkloadHealthCheckFn) Check ¶
func (fn WorkloadHealthCheckFn) Check(ctx context.Context, c client.Client, tr core.ObjectReference, ns string) *WorkloadHealthCondition
Check the health status of specified resource
type WorkloadHealthCondition ¶
type WorkloadHealthCondition = v1alpha2.WorkloadHealthCondition
WorkloadHealthCondition holds health status of a workload
func CheckByHealthCheckTrait ¶
func CheckByHealthCheckTrait(ctx context.Context, c client.Client, wlRef core.ObjectReference, ns string) *WorkloadHealthCondition
CheckByHealthCheckTrait checks health condition through HealthCheckTrait.
func CheckDaemonsetHealth ¶
func CheckDaemonsetHealth(ctx context.Context, client client.Client, ref core.ObjectReference, namespace string) *WorkloadHealthCondition
CheckDaemonsetHealth checks health condition of DaemonSet
func CheckDeploymentHealth ¶
func CheckDeploymentHealth(ctx context.Context, client client.Client, ref core.ObjectReference, namespace string) *WorkloadHealthCondition
CheckDeploymentHealth checks health condition of Deployment
func CheckStatefulsetHealth ¶
func CheckStatefulsetHealth(ctx context.Context, client client.Client, ref core.ObjectReference, namespace string) *WorkloadHealthCondition
CheckStatefulsetHealth checks health condition of StatefulSet
func CheckUnknownWorkload ¶
func CheckUnknownWorkload(ctx context.Context, c client.Client, wlRef core.ObjectReference, ns string) *WorkloadHealthCondition
CheckUnknownWorkload handles unknown type workloads.
type WorkloadReference ¶ added in v1.1.1
type WorkloadReference struct { corev1.ObjectReference // contains filtered or unexported fields }
WorkloadReference refer to a multi-env workload
type WorloadHealthChecker ¶
type WorloadHealthChecker interface {
Check(context.Context, client.Client, core.ObjectReference, string) *WorkloadHealthCondition
}
A WorloadHealthChecker checks health status of specified resource and saves status into an HealthCondition object.