Skip to content

Commit

Permalink
Update console types with conditions
Browse files Browse the repository at this point in the history
Update console types with failure/termination conditions. We want to
update these using a new controller, in which we can keep logic to
determine failure / termination states and relay that to the user via a
condition and to Kaiju by pubsub
  • Loading branch information
Theo Barber-Bany committed Feb 17, 2022
1 parent 7b29ee9 commit e0d9ffb
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions apis/workloads/v1alpha1/console_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,60 @@ type ConsoleStatus struct {
PodName string `json:"podName"`
ExpiryTime *metav1.Time `json:"expiryTime,omitempty"`
// Time at which the job completed successfully
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
Phase ConsolePhase `json:"phase"`
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
Phase ConsolePhase `json:"phase"`
Conditions []ConsoleCondition `json:"conditions,omitempty"`
}

// Console conditions describe a valid condition for a console
type ConsoleConditionType string

const (
// ConsoleTerminatedType describes the type of condition where the console
// is terminated
ConsoleTerminatedType ConsoleConditionType = "ConsoleTerminated"

// ConsoleFailedType describes the type of condition where the controller
// tried to start the console, but there was some error causing it to fail
ConsoleFailedType ConsoleConditionType = "ConsoleFailed"
)

// ConsoleCondition is a status condition for a console
type ConsoleCondition struct {
// Type of this condition
Type ConsoleConditionType `json:"type"`

// Status of this condition
Status corev1.ConditionStatus `json:"status"`

// LastUpdateTime of this condition
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`

// LastTransitionTime of this condition
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`

// Reason for the current status of this condition
Reason ConsoleConditionReason `json:"reason,omitempty"`

// Message associated with this condition
Message string `json:"message,omitempty"`
}

// ConsoleConditionReason represents a valid condition reason for a console
type ConsoleConditionReason string

const (
// ReasonTlogNotFound is a console condition for a failed console because
// tlog-rec was not found in the image
ReasonTlogNotFound ConsoleConditionReason = "tlog-rec binary not found"

ReasonCrashLoopBackoff ConsoleConditionReason = "pod for console is in CrashLoopBackoff"

ReasonImagePull ConsoleConditionReason = "specified image failed to pull"

ReasonTimedOutAuthorize ConsoleConditionReason = "specified image failed to pull"
)

// +kubebuilder:object:root=true
// +kubebuilder:storageversion

Expand Down

0 comments on commit e0d9ffb

Please sign in to comment.