Documentation
¶
Index ¶
- func Conditions(state amaltheadevv1alpha1.State, ctx context.Context, ...) []amaltheadevv1alpha1.AmaltheaSessionCondition
- type AmaltheaSessionReconciler
- type ChildResource
- type ChildResourceType
- type ChildResourceUpdate
- type ChildResourceUpdates
- func (c ChildResourceUpdates) AllEqual(op controllerutil.OperationResult) bool
- func (c ChildResourceUpdates) IsRunning(pod *v1.Pod) bool
- func (c ChildResourceUpdates) State(cr *amaltheadevv1alpha1.AmaltheaSession, pod *v1.Pod) (amaltheadevv1alpha1.State, string)
- func (c ChildResourceUpdates) Status(ctx context.Context, r *AmaltheaSessionReconciler, ...) amaltheadevv1alpha1.AmaltheaSessionStatus
- type ChildResources
- type EventsInferedStateResult
- type IdleDecision
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Conditions ¶
func Conditions( state amaltheadevv1alpha1.State, ctx context.Context, r *AmaltheaSessionReconciler, cr *amaltheadevv1alpha1.AmaltheaSession, ) []amaltheadevv1alpha1.AmaltheaSessionCondition
Types ¶
type AmaltheaSessionReconciler ¶
type AmaltheaSessionReconciler struct {
client.Client
Scheme *runtime.Scheme
MetricsClient metricsv1beta1.PodMetricsesGetter
ClusterType amaltheadevv1alpha1.ClusterType
}
AmaltheaSessionReconciler reconciles a AmaltheaSession object
func (*AmaltheaSessionReconciler) Reconcile ¶
func (r *AmaltheaSessionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the AmaltheaSession object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile
func (*AmaltheaSessionReconciler) SetupWithManager ¶
func (r *AmaltheaSessionReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ChildResource ¶
type ChildResource[T ChildResourceType] struct { Current *T Desired *T }
func (ChildResource[T]) Reconcile ¶
func (c ChildResource[T]) Reconcile(ctx context.Context, clnt client.Client, cr *amaltheadevv1alpha1.AmaltheaSession) ChildResourceUpdate[T]
type ChildResourceType ¶
type ChildResourceType interface {
networkingv1.Ingress | v1.Service | v1.PersistentVolumeClaim | appsv1.StatefulSet | v1.Secret
}
type ChildResourceUpdate ¶
type ChildResourceUpdate[T ChildResourceType] struct { Manifest *T UpdateResult controllerutil.OperationResult Error error // contains filtered or unexported fields }
type ChildResourceUpdates ¶
type ChildResourceUpdates struct {
Ingress ChildResourceUpdate[networkingv1.Ingress]
Service ChildResourceUpdate[v1.Service]
StatefulSet ChildResourceUpdate[appsv1.StatefulSet]
PVC ChildResourceUpdate[v1.PersistentVolumeClaim]
DataSourcesPVCs []ChildResourceUpdate[v1.PersistentVolumeClaim]
Secret ChildResourceUpdate[v1.Secret]
}
func (ChildResourceUpdates) AllEqual ¶
func (c ChildResourceUpdates) AllEqual(op controllerutil.OperationResult) bool
func (ChildResourceUpdates) State ¶
func (c ChildResourceUpdates) State(cr *amaltheadevv1alpha1.AmaltheaSession, pod *v1.Pod) (amaltheadevv1alpha1.State, string)
func (ChildResourceUpdates) Status ¶
func (c ChildResourceUpdates) Status( ctx context.Context, r *AmaltheaSessionReconciler, cr *amaltheadevv1alpha1.AmaltheaSession, ) amaltheadevv1alpha1.AmaltheaSessionStatus
type ChildResources ¶
type ChildResources struct {
Ingress ChildResource[networkingv1.Ingress]
Service ChildResource[v1.Service]
StatefulSet ChildResource[appsv1.StatefulSet]
PVC ChildResource[v1.PersistentVolumeClaim]
DataSourcesPVCs []ChildResource[v1.PersistentVolumeClaim]
Secret ChildResource[v1.Secret]
}
func NewChildResources ¶
func NewChildResources(cr *amaltheadevv1alpha1.AmaltheaSession, clusterType amaltheadevv1alpha1.ClusterType) (ChildResources, error)
func (ChildResources) Reconcile ¶
func (c ChildResources) Reconcile(ctx context.Context, clnt client.Client, cr *amaltheadevv1alpha1.AmaltheaSession) (ChildResourceUpdates, error)
type EventsInferedStateResult ¶
type EventsInferedStateResult string
const ( EisrNone EventsInferedStateResult = "None" EisrInitiallyFailed EventsInferedStateResult = "Initially Failed" EisrTemporaryFailed EventsInferedStateResult = "Temporary Failed" EisrFinallyFailed EventsInferedStateResult = "Finally Failed" EisrAutoScheduling EventsInferedStateResult = "Auto Scheduling" )
func EventsInferedState ¶
func EventsInferedState(ctx context.Context, cr *amaltheadevv1alpha1.AmaltheaSession, client client.Reader) (EventsInferedStateResult, error)
eventsInferedFailure looks into the events of the session pod to figure out whether a failure exists. The events are looked at with the latest first, if an event occurs that indicates a scale-up or a scheduled reason, then it is considered non-failing. If the first event encountered is a "FailedScheduling" reason, then it indicates a failure iff this state has occurred for a pre-defined period.
Returns one of: - initially failed: if the latest event is FailedScheduling and none of these has been seen before - temporary failed: if the latest event is FailedScheduling but the wait timeout has not been reached - finally failed: if the latest event is FailedScheduling and this has been seen for a while exceeding maximum wait time - auto scheduling: if an TriggeredScaleUp events has been found as the last event - none of the above
type IdleDecision ¶
type IdleDecision int
const Idle IdleDecision = 1
const NotIdle IdleDecision = 2
const Unknown IdleDecision = 0
The values are setup in a way so that max(x, y, z) where x, y, z are one of the values below will give the final decision.