Documentation ¶
Overview ¶
+k8s:deepcopy-gen=package +groupName=frameworkcontroller.microsoft.com
Index ¶
- Constants
- Variables
- func BuildFrameworkCRD() *apiExtensions.CustomResourceDefinition
- func BuildKubeConfig(cConfig *Config) *rest.Config
- func GetConfigMapName(frameworkName string) string
- func GetFrameworkAttemptInstanceUID(frameworkAttemptID int32, configMapUID *types.UID) *types.UID
- func GetPodName(frameworkName string, taskRoleName string, taskIndex int32) string
- func GetTaskAttemptInstanceUID(taskAttemptID int32, podUID *types.UID) *types.UID
- func Resource(resource string) schema.GroupResource
- func SplitConfigMapName(configMapName string) (frameworkName string)
- func SplitFrameworkAttemptInstanceUID(frameworkAttemptInstanceUID *types.UID) (frameworkAttemptID int32, configMapUID *types.UID)
- func SplitPodName(podName string) (frameworkName string, taskRoleName string, taskIndex int32)
- func SplitTaskAttemptInstanceUID(taskAttemptInstanceUID *types.UID) (taskAttemptID int32, podUID *types.UID)
- type CompletionCode
- type CompletionCodeInfo
- type CompletionPhrase
- type CompletionPolicySpec
- type CompletionStatus
- type CompletionType
- type CompletionTypeAttribute
- type CompletionTypeName
- type Config
- type ContainerStateTerminatedReason
- type ExecutionType
- type Framework
- func (f *Framework) AreAllTasksCompleted() bool
- func (f *Framework) CompletionType() CompletionType
- func (f *Framework) ConfigMapName() string
- func (f *Framework) ConfigMapUID() *types.UID
- func (in *Framework) DeepCopy() *Framework
- func (in *Framework) DeepCopyInto(out *Framework)
- func (in *Framework) DeepCopyObject() runtime.Object
- func (f *Framework) FrameworkAttemptID() int32
- func (f *Framework) FrameworkAttemptInstanceUID() *types.UID
- func (f *Framework) GetTaskCount(selector TaskStatusSelector) int32
- func (f *Framework) IsAnyTaskRunning() bool
- func (f *Framework) IsCompleted() bool
- func (f *Framework) IsFailed() bool
- func (f *Framework) IsRunning() bool
- func (f *Framework) IsSucceeded() bool
- func (f *Framework) Key() string
- func (f *Framework) NewConfigMap() *core.ConfigMap
- func (f *Framework) NewFrameworkAttemptStatus(frameworkAttemptID int32) FrameworkAttemptStatus
- func (f *Framework) NewFrameworkStatus() *FrameworkStatus
- func (f *Framework) NewPod(cm *core.ConfigMap, taskRoleName string, taskIndex int32) *core.Pod
- func (f *Framework) NewTaskAttemptStatus(taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus
- func (f *Framework) NewTaskRoleStatuses() []TaskRoleStatus
- func (f *Framework) NewTaskStatus(taskRoleName string, taskIndex int32) TaskStatus
- func (f *Framework) TaskRoleSpec(taskRoleName string) *TaskRoleSpec
- func (f *Framework) TaskRoleStatus(taskRoleName string) *TaskRoleStatus
- func (f *Framework) TaskRoleStatuses() []TaskRoleStatus
- func (f *Framework) TaskStatus(taskRoleName string, taskIndex int32) *TaskStatus
- func (f *Framework) TransitionFrameworkState(dstState FrameworkState)
- func (f *Framework) TransitionTaskState(taskRoleName string, taskIndex int32, dstState TaskState)
- type FrameworkAttemptStatus
- type FrameworkList
- type FrameworkSpec
- type FrameworkState
- type FrameworkStatus
- type RemoteState
- type RetryDecision
- type RetryPolicySpec
- type RetryPolicyStatus
- type TaskAttemptStatus
- type TaskRoleSpec
- type TaskRoleStatus
- type TaskSpec
- type TaskState
- type TaskStatus
- func (ts *TaskStatus) CompletionType() CompletionType
- func (in *TaskStatus) DeepCopy() *TaskStatus
- func (in *TaskStatus) DeepCopyInto(out *TaskStatus)
- func (ts *TaskStatus) IsCompleted() bool
- func (ts *TaskStatus) IsFailed() bool
- func (ts *TaskStatus) IsRunning() bool
- func (ts *TaskStatus) IsSucceeded() bool
- func (ts *TaskStatus) PodName() string
- func (ts *TaskStatus) PodUID() *types.UID
- func (ts *TaskStatus) TaskAttemptID() int32
- func (ts *TaskStatus) TaskAttemptInstanceUID() *types.UID
- type TaskStatusSelector
Constants ¶
const ( // For controller ComponentName = "frameworkcontroller" GroupName = "frameworkcontroller.microsoft.com" Version = "v1" FrameworkPlural = "frameworks" FrameworkCRDName = FrameworkPlural + "." + GroupName FrameworkKind = "Framework" ConfigMapKind = "ConfigMap" ObjectUIDFieldPath = "metadata.uid" ConfigFilePath = "./frameworkcontroller.yaml" UnlimitedValue = -1 ExtendedUnlimitedValue = -2 // For all managed objects // Predefined Annotations AnnotationKeyFrameworkNamespace = "FC_FRAMEWORK_NAMESPACE" AnnotationKeyFrameworkName = "FC_FRAMEWORK_NAME" AnnotationKeyTaskRoleName = "FC_TASKROLE_NAME" AnnotationKeyTaskIndex = "FC_TASK_INDEX" AnnotationKeyConfigMapName = "FC_CONFIGMAP_NAME" AnnotationKeyPodName = "FC_POD_NAME" AnnotationKeyFrameworkAttemptID = "FC_FRAMEWORK_ATTEMPT_ID" AnnotationKeyFrameworkAttemptInstanceUID = "FC_FRAMEWORK_ATTEMPT_INSTANCE_UID" AnnotationKeyConfigMapUID = "FC_CONFIGMAP_UID" AnnotationKeyTaskAttemptID = "FC_TASK_ATTEMPT_ID" // Predefined Labels LabelKeyFrameworkName = AnnotationKeyFrameworkName LabelKeyTaskRoleName = AnnotationKeyTaskRoleName // For all managed containers // Predefined Environment Variables // It can be referred by the environment variable specified in the spec, i.e. // specify the environment variable value to include "$(AnyPredefinedEnvName)". EnvNameFrameworkNamespace = AnnotationKeyFrameworkNamespace EnvNameFrameworkName = AnnotationKeyFrameworkName EnvNameTaskRoleName = AnnotationKeyTaskRoleName EnvNameTaskIndex = AnnotationKeyTaskIndex EnvNameConfigMapName = AnnotationKeyConfigMapName EnvNamePodName = AnnotationKeyPodName EnvNameFrameworkAttemptID = AnnotationKeyFrameworkAttemptID EnvNameFrameworkAttemptInstanceUID = AnnotationKeyFrameworkAttemptInstanceUID EnvNameConfigMapUID = AnnotationKeyConfigMapUID EnvNameTaskAttemptID = AnnotationKeyTaskAttemptID EnvNameTaskAttemptInstanceUID = "FC_TASK_ATTEMPT_INSTANCE_UID" EnvNamePodUID = "FC_POD_UID" )
///////////////////////////////////////////////////////////////////////////////////// General Constants /////////////////////////////////////////////////////////////////////////////////////
const ( RemoteEnabled string = "true" RemoteDisabled string = "false" RemoteEmpty string = "" RemoteDinied string = "dinied" AnnotationKeyScheduleRemotable string = "openi.cn/schedule-remotable" LabelKeyScheduleRemotable string = AnnotationKeyScheduleRemotable LabelKeyScheduleRemoted string = "openi.cn/schedule-remoted" LabelKeyRemoteRequest string = "openi.cn/remote-request" LabelKeyRemoteResponse string = "openi.cn/remote-response" )
///////////////////////////////////////////////////////////////////////////////////// Remote Constants /////////////////////////////////////////////////////////////////////////////////////
const ( // For FrameworkScheduler QueueKeyPrefixNode string = "//node/" QueueKeyPrefixPod string = "//pod/" QueueKeyPrefixZone string = "//zone/" DefaultScheduleCategory string = "default" DefaultScheduleZone string = "default" DefaultZoneKey string = "default/default" AnnotationKeyScheduleCategory string = "openi.cn/schedule-category" AnnotationKeyScheduleZone string = "openi.cn/schedule-zone" AnnotationKeySchedulePreemption string = "openi.cn/schedule-preemption" LabelKeyScheduleCategory string = AnnotationKeyScheduleCategory LabelKeyScheduleZone string = AnnotationKeyScheduleZone TimeoutOfRefreshZoneList time.Duration = 100 * time.Millisecond TimeoutOfFrameworkSync time.Duration = 30 * time.Second )
///////////////////////////////////////////////////////////////////////////////////// Scheduler Constants /////////////////////////////////////////////////////////////////////////////////////
const (
// Names in CRD should be up to 63 lower case alphanumeric characters.
NamingConvention = "^[a-z0-9]{1,63}$"
)
Variables ¶
var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme )
var CompletionCodeInfoContainerFailedWithUnknownExitCode = CompletionCodeInfo{ "ContainerFailedWithUnknownExitCode", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{}}, }
var CompletionCodeInfos = map[CompletionCode]CompletionCodeInfo{ CompletionCodeContainerSigTermReceived: { "ContainerSigTermReceived", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodeContainerSigKillReceived: { "ContainerSigKillReceived", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodeContainerSigIntReceived: { "ContainerSigIntReceived", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodeContainerTransientFailed: { "ContainerTransientFailed", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeInternal}}}, CompletionCodeContainerTransientConflictFailed: { "ContainerTransientConflictFailed", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeInternal, CompletionTypeAttributeConflict}}}, CompletionCodeContainerPermanentFailed: { "ContainerPermanentFailed", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributePermanent, CompletionTypeAttributeInternal}}}, CompletionCodeSucceeded: { "Succeeded", CompletionType{CompletionTypeNameSucceeded, []CompletionTypeAttribute{CompletionTypeAttributeInternal}}}, CompletionCodeConfigMapExternalDeleted: { "ConfigMapExternalDeleted", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodePodExternalDeleted: { "PodExternalDeleted", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodeConfigMapCreationTimeout: { "ConfigMapCreationTimeout", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodePodCreationTimeout: { "PodCreationTimeout", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodePodFailedWithoutFailedContainer: { "PodFailedWithoutFailedContainer", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributeTransient, CompletionTypeAttributeExternal}}}, CompletionCodePodSpecInvalid: { "PodSpecInvalid", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{CompletionTypeAttributePermanent, CompletionTypeAttributeInternal}}}, CompletionCodeContainerOOMKilled: { "ContainerOOMKilled", CompletionType{CompletionTypeNameFailed, []CompletionTypeAttribute{}}}, }
var ConfigMapGroupVersionKind = core.SchemeGroupVersion.WithKind(ConfigMapKind)
var DefaultKubeConfigFilePath = os.Getenv("HOME") + "/.kube/config"
var EnvValueKubeApiServerAddress = os.Getenv("KUBE_APISERVER_ADDRESS")
var EnvValueKubeConfigFilePath = os.Getenv("KUBECONFIG")
var FrameworkGroupVersionKind = SchemeGroupVersion.WithKind(FrameworkKind)
var ObjectUIDEnvVarSource = &core.EnvVarSource{ FieldRef: &core.ObjectFieldSelector{FieldPath: ObjectUIDFieldPath}, }
var SchemeGroupVersion = schema.GroupVersion{ Group: GroupName, Version: Version, }
Functions ¶
func BuildFrameworkCRD ¶
func BuildFrameworkCRD() *apiExtensions.CustomResourceDefinition
func BuildKubeConfig ¶
func GetConfigMapName ¶
///////////////////////////////////////////////////////////////////////////////////// Utils /////////////////////////////////////////////////////////////////////////////////////
func GetPodName ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
func SplitConfigMapName ¶
func SplitPodName ¶
Types ¶
type CompletionCode ¶
type CompletionCode int32
const ( // NonNegative: // ExitCode of the Framework's Container // [129, 165]: Container Received Fatal Error Signal: ExitCode - 128 CompletionCodeContainerSigTermReceived CompletionCode = 143 CompletionCodeContainerSigKillReceived CompletionCode = 137 CompletionCodeContainerSigIntReceived CompletionCode = 130 // [200, 219]: Container ExitCode Contract CompletionCodeContainerTransientFailed CompletionCode = 200 CompletionCodeContainerTransientConflictFailed CompletionCode = 201 CompletionCodeContainerPermanentFailed CompletionCode = 210 // 0: Succeeded CompletionCodeSucceeded CompletionCode = 0 // Negative: // ExitCode of the Framework's Predefined Error // -1XX: Framework Predefined Transient Error CompletionCodeConfigMapExternalDeleted CompletionCode = -100 CompletionCodePodExternalDeleted CompletionCode = -101 CompletionCodeConfigMapCreationTimeout CompletionCode = -110 CompletionCodePodCreationTimeout CompletionCode = -111 CompletionCodePodFailedWithoutFailedContainer CompletionCode = -120 // -2XX: Framework Predefined Permanent Error CompletionCodePodSpecInvalid CompletionCode = -200 // -3XX: Framework Predefined Unknown Error CompletionCodeContainerOOMKilled CompletionCode = -300 )
Defined according to the CompletionCode Convention. See CompletionStatus.
func (CompletionCode) NewCompletionStatus ¶
func (cc CompletionCode) NewCompletionStatus(diagnostics string) *CompletionStatus
type CompletionCodeInfo ¶
type CompletionCodeInfo struct { Phrase CompletionPhrase Type CompletionType }
///////////////////////////////////////////////////////////////////////////////////// CompletionCodeInfos /////////////////////////////////////////////////////////////////////////////////////
func (*CompletionCodeInfo) DeepCopy ¶
func (in *CompletionCodeInfo) DeepCopy() *CompletionCodeInfo
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionCodeInfo.
func (*CompletionCodeInfo) DeepCopyInto ¶
func (in *CompletionCodeInfo) DeepCopyInto(out *CompletionCodeInfo)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CompletionPhrase ¶
type CompletionPhrase string
type CompletionPolicySpec ¶
type CompletionPolicySpec struct { MinFailedTaskCount int32 `json:"minFailedTaskCount"` MinSucceededTaskCount int32 `json:"minSucceededTaskCount"` }
CompletionPolicySpec can be configured for each TaskRole to control: 1. FrameworkAttempt CompletionPolicy:
- The conditions to complete a FrameworkAttempt.
- The CompletionStatus of the completed FrameworkAttempt.
Usage:
- If Pod Spec of current TaskRole is invalid, immediately complete the FrameworkAttempt, regardless of any uncompleted Task, and the CompletionStatus is failed which is generated from the Task which triggers the completion.
- If MinFailedTaskCount != -1 and MinFailedTaskCount <= failed Task count of current TaskRole, immediately complete the FrameworkAttempt, regardless of any uncompleted Task, and the CompletionStatus is failed which is generated from the Task which triggers the completion.
- If MinSucceededTaskCount != -1 and MinSucceededTaskCount <= succeeded Task count of current TaskRole, immediately complete the FrameworkAttempt, regardless of any uncompleted Task, and the CompletionStatus is succeeded which is generated from the Task which triggers the completion.
- If multiple above 1. and 2. conditions of all TaskRoles are satisfied at the same time, the behavior can be any one of these satisfied conditions.
- If none of above 1. and 2. conditions of all TaskRoles are satisfied until all Tasks of the Framework are completed, immediately complete the FrameworkAttempt and the CompletionStatus is succeeded which is not generated from any Task.
Notes:
- When the FrameworkAttempt is completed, the FrameworkState is transitioned to FrameworkAttemptCompleted, so the Framework may still be retried with another new FrameworkAttempt according to the Framework RetryPolicySpec.
- Resort to other spec to control other kind of CompletionPolicy:
- Framework CompletionPolicy is equivalent to Framework RetryPolicy.
- Task CompletionPolicy is equivalent to Task RetryPolicy.
- TaskAttempt CompletionPolicy is equivalent to Pod CompletionPolicy, i.e. the PodPhase conditions for PodSucceeded or PodFailed. See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase
func (*CompletionPolicySpec) DeepCopy ¶
func (in *CompletionPolicySpec) DeepCopy() *CompletionPolicySpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionPolicySpec.
func (*CompletionPolicySpec) DeepCopyInto ¶
func (in *CompletionPolicySpec) DeepCopyInto(out *CompletionPolicySpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CompletionStatus ¶
type CompletionStatus struct { // CompletionCode Convention: // 1. NonNegative: // The CompletionCode is the ExitCode of the Framework's Container which // triggers the completion. // 2. Negative: // -1XX: Framework Predefined Transient Error // -2XX: Framework Predefined Permanent Error // -3XX: Framework Predefined Unknown Error // The CompletionCode is the ExitCode of the Framework's Predefined Error // which triggers the completion. Code CompletionCode `json:"code"` // The textual phrase representation of the CompletionCode. Phrase CompletionPhrase `json:"phrase"` // CompletionType is determined by the CompletionCode and the Predefined // CompletionCodeInfos. // See CompletionCodeInfos. Type CompletionType `json:"type"` // The detailed diagnostic information of the completion. Diagnostics string `json:"diagnostics"` }
func (*CompletionStatus) DeepCopy ¶
func (in *CompletionStatus) DeepCopy() *CompletionStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionStatus.
func (*CompletionStatus) DeepCopyInto ¶
func (in *CompletionStatus) DeepCopyInto(out *CompletionStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*CompletionStatus) String ¶
func (cs *CompletionStatus) String() string
type CompletionType ¶
type CompletionType struct { Name CompletionTypeName `json:"name"` Attributes []CompletionTypeAttribute `json:"attributes"` }
func (CompletionType) ContainsAttribute ¶
func (ct CompletionType) ContainsAttribute(attribute CompletionTypeAttribute) bool
func (*CompletionType) DeepCopy ¶
func (in *CompletionType) DeepCopy() *CompletionType
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionType.
func (*CompletionType) DeepCopyInto ¶
func (in *CompletionType) DeepCopyInto(out *CompletionType)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (CompletionType) IsFailed ¶
func (ct CompletionType) IsFailed() bool
func (CompletionType) IsSucceeded ¶
func (ct CompletionType) IsSucceeded() bool
type CompletionTypeAttribute ¶
type CompletionTypeAttribute string
const ( // CompletionTypeName must be different within a finite retry times: // such as failed due to dependent components shutdown, machine error, // network error, environment error, workload spike, etc. CompletionTypeAttributeTransient CompletionTypeAttribute = "Transient" // CompletionTypeName must be the same in every retry times: // such as failed due to incorrect usage, incorrect configuration, etc. CompletionTypeAttributePermanent CompletionTypeAttribute = "Permanent" // The completion must be caused by External, i.e. the Platform. CompletionTypeAttributeExternal CompletionTypeAttribute = "External" // The completion must be caused by Internal, i.e. the Framework itself. CompletionTypeAttributeInternal CompletionTypeAttribute = "Internal" // The completion must be caused by Resource Conflict (Resource Contention): // such as failed due to Gang Allocation timeout. CompletionTypeAttributeConflict CompletionTypeAttribute = "Conflict" )
type CompletionTypeName ¶
type CompletionTypeName string
const ( CompletionTypeNameSucceeded CompletionTypeName = "Succeeded" CompletionTypeNameFailed CompletionTypeName = "Failed" )
type Config ¶
type Config struct { // KubeApiServerAddress is default to ${KUBE_APISERVER_ADDRESS}. // KubeConfigFilePath is default to ${KUBECONFIG} then falls back to ${HOME}/.kube/config. // // If both KubeApiServerAddress and KubeConfigFilePath after defaulting are still empty, falls back to the // [k8s inClusterConfig](https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#accessing-the-api-from-a-pod). // // If both KubeApiServerAddress and KubeConfigFilePath after defaulting are not empty, // KubeApiServerAddress overrides the server address specified in the file referred by KubeConfigFilePath. // // If only KubeApiServerAddress after defaulting is not empty, it should be an insecure ApiServer address (can be got from // [Insecure ApiServer](https://kubernetes.io/docs/reference/access-authn-authz/controlling-access/#api-server-ports-and-ips) or // [kubectl proxy](https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#using-kubectl-proxy)) // which does not enforce authentication. // // If only KubeConfigFilePath after defaulting is not empty, it should be an valid // [KubeConfig File](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#explore-the-home-kube-directory) // which inlines or refers the valid // [ApiServer Credential Files](https://kubernetes.io/docs/reference/access-authn-authz/controlling-access/#transport-security). // // Address should be in format http[s]://host:port KubeApiServerAddress *string `yaml:"kubeApiServerAddress"` KubeConfigFilePath *string `yaml:"kubeConfigFilePath"` // Number of concurrent workers to process each different Frameworks WorkerNumber *int32 `yaml:"workerNumber"` // Check interval and timeout to expect the created CRD to be in Established condition. CRDEstablishedCheckIntervalSec *int64 `yaml:"crdEstablishedCheckIntervalSec"` CRDEstablishedCheckTimeoutSec *int64 `yaml:"crdEstablishedCheckTimeoutSec"` // Timeout to expect the created object in ApiServer also appears in the local // cache of the Controller's Informer. // If the created object does not appear in the local cache within the timeout, // it is considered as deleted. ObjectLocalCacheCreationTimeoutSec *int64 `yaml:"objectLocalCacheCreationTimeoutSec"` // If the Framework FancyRetryPolicy is enabled and its FrameworkAttempt is // completed with Transient Conflict Failed CompletionType, it will be retried // after a random delay within this range. // This helps to avoid the resource deadlock for Framework which needs // Gang Execution, i.e. all Tasks in the Framework should be executed in an // all-or-nothing fashion in order to perform any useful work. FrameworkMinRetryDelaySecForTransientConflictFailed *int64 `yaml:"frameworkMinRetryDelaySecForTransientConflictFailed"` FrameworkMaxRetryDelaySecForTransientConflictFailed *int64 `yaml:"frameworkMaxRetryDelaySecForTransientConflictFailed"` }
func NewRemoteConfigs ¶
func NewRemoteConfigs() []*Config
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ContainerStateTerminatedReason ¶
type ContainerStateTerminatedReason string
const (
ReasonOOMKilled ContainerStateTerminatedReason = "OOMKilled"
)
type ExecutionType ¶
type ExecutionType string
const ( ExecutionStart ExecutionType = "Start" ExecutionStop ExecutionType = "Stop" )
type Framework ¶
type Framework struct { meta.TypeMeta `json:",inline"` meta.ObjectMeta `json:"metadata"` Spec FrameworkSpec `json:"spec"` Status *FrameworkStatus `json:"status"` }
//////////////////////////////////////////////////////////////////////////////////////////////// A Framework represents an application with a set of Tasks: 1. Executed by Kubernetes Pod 2. Partitioned to different heterogeneous TaskRoles which share the same lifecycle 3. Ordered in the same homogeneous TaskRole by TaskIndex 4. With consistent identity {FrameworkName}-{TaskRoleName}-{TaskIndex} as PodName 5. With fine grained RetryPolicy for each Task and the whole Framework 6. With fine grained FrameworkAttemptCompletionPolicy for each TaskRole 7. Guarantees at most one instance of a specific Task is running at any point in time 8. Guarantees at most one instance of a specific Framework is running at any point in time
Notes:
- Status field should only be modified by FrameworkController, and other fields should not be modified by FrameworkController. TODO: Remove +genclient:noStatus after ApiServer has supported CRD Subresources. Leverage CRD status subresource to isolate Status field modification with other fields. This can help to avoid unintended modification, such as users may unintendedly modify the status when updating the spec.
- To ensure at most one instance of a specific Task is running at any point in time:
- Do not delete the managed Pod with 0 gracePeriodSeconds. For example, the default Pod deletion is acceptable.
- Do not delete the Node which runs the managed Pod. For example, drain before delete the Node is acceptable. The instance can be universally located by its TaskAttemptInstanceUID or PodUID. See RetryPolicySpec and TaskAttemptStatus.
- To ensure at most one instance of a specific Framework is running at any point in time:
- Ensure ensure at most one instance of a specific Task is running at any point in time.
- Do not delete the managed ConfigMap with Background propagationPolicy. For example, the default ConfigMap deletion is acceptable.
- Must delete the Framework with Foreground propagationPolicy. For example, the default Framework deletion may not be acceptable, since the default propagationPolicy for Framework object may be Background. The instance can be universally located by its FrameworkAttemptInstanceUID or ConfigMapUID. See RetryPolicySpec and FrameworkAttemptStatus.
- To ensure there is no orphan object previously managed by FrameworkController:
- Do not delete the Framework or the managed ConfigMap with Orphan propagationPolicy. For example, the default Framework and ConfigMap deletion is acceptable.
- Do not change the OwnerReferences of the managed ConfigMap and Pods.
////////////////////////////////////////////////////////////////////////////////////////////////
func (*Framework) AreAllTasksCompleted ¶
func (*Framework) CompletionType ¶
func (f *Framework) CompletionType() CompletionType
func (*Framework) ConfigMapName ¶
func (*Framework) ConfigMapUID ¶
func (*Framework) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Framework.
func (*Framework) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Framework) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Framework) FrameworkAttemptID ¶
///////////////////////////////////////////////////////////////////////////////////// Status Read Methods /////////////////////////////////////////////////////////////////////////////////////
func (*Framework) FrameworkAttemptInstanceUID ¶
func (*Framework) GetTaskCount ¶
func (f *Framework) GetTaskCount(selector TaskStatusSelector) int32
func (*Framework) IsAnyTaskRunning ¶
func (*Framework) IsCompleted ¶
func (*Framework) IsSucceeded ¶
func (*Framework) Key ¶
///////////////////////////////////////////////////////////////////////////////////// Spec Read Methods /////////////////////////////////////////////////////////////////////////////////////
func (*Framework) NewConfigMap ¶
func (*Framework) NewFrameworkAttemptStatus ¶
func (f *Framework) NewFrameworkAttemptStatus( frameworkAttemptID int32) FrameworkAttemptStatus
func (*Framework) NewFrameworkStatus ¶
func (f *Framework) NewFrameworkStatus() *FrameworkStatus
func (*Framework) NewTaskAttemptStatus ¶
func (f *Framework) NewTaskAttemptStatus( taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus
func (*Framework) NewTaskRoleStatuses ¶
func (f *Framework) NewTaskRoleStatuses() []TaskRoleStatus
func (*Framework) NewTaskStatus ¶
func (f *Framework) NewTaskStatus(taskRoleName string, taskIndex int32) TaskStatus
func (*Framework) TaskRoleSpec ¶
func (f *Framework) TaskRoleSpec(taskRoleName string) *TaskRoleSpec
func (*Framework) TaskRoleStatus ¶
func (f *Framework) TaskRoleStatus(taskRoleName string) *TaskRoleStatus
func (*Framework) TaskRoleStatuses ¶
func (f *Framework) TaskRoleStatuses() []TaskRoleStatus
func (*Framework) TaskStatus ¶
func (f *Framework) TaskStatus(taskRoleName string, taskIndex int32) *TaskStatus
func (*Framework) TransitionFrameworkState ¶
func (f *Framework) TransitionFrameworkState(dstState FrameworkState)
///////////////////////////////////////////////////////////////////////////////////// Status Write Methods ///////////////////////////////////////////////////////////////////////////////////// This is the only interface to modify FrameworkState
type FrameworkAttemptStatus ¶
type FrameworkAttemptStatus struct { // FrameworkAttemptID = {FrameworkStatus.RetryPolicyStatus.TotalRetriedCount} // It can only locate the FrameworkAttempt within a specific Framework, i.e. // it cannot universally locate the FrameworkAttempt and cannot locate the // FrameworkAttemptInstance even within a specific Framework. ID int32 `json:"id"` StartTime meta.Time `json:"startTime"` CompletionTime *meta.Time `json:"completionTime"` // Current associated FrameworkAttemptInstance: // FrameworkAttemptInstanceUID = {FrameworkAttemptID}_{ConfigMapUID} // It is ordered by FrameworkAttemptID and can universally locate the // FrameworkAttemptInstance. InstanceUID *types.UID `json:"instanceUID"` // A FrameworkAttemptInstance is represented by a ConfigMap object: // ConfigMapName = {FrameworkName}-attempt // It will never be changed during the whole lifetime of a specific Framework. ConfigMapName string `json:"configMapName"` // ConfigMapUID can also universally locate the FrameworkAttemptInstance. ConfigMapUID *types.UID `json:"configMapUID"` CompletionStatus *CompletionStatus `json:"completionStatus"` TaskRoleStatuses []TaskRoleStatus `json:"taskRoleStatuses"` }
func (*FrameworkAttemptStatus) DeepCopy ¶
func (in *FrameworkAttemptStatus) DeepCopy() *FrameworkAttemptStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrameworkAttemptStatus.
func (*FrameworkAttemptStatus) DeepCopyInto ¶
func (in *FrameworkAttemptStatus) DeepCopyInto(out *FrameworkAttemptStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FrameworkList ¶
type FrameworkList struct { meta.TypeMeta `json:",inline"` meta.ListMeta `json:"metadata"` Items []Framework `json:"items"` }
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
func (*FrameworkList) DeepCopy ¶
func (in *FrameworkList) DeepCopy() *FrameworkList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrameworkList.
func (*FrameworkList) DeepCopyInto ¶
func (in *FrameworkList) DeepCopyInto(out *FrameworkList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*FrameworkList) DeepCopyObject ¶
func (in *FrameworkList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type FrameworkSpec ¶
type FrameworkSpec struct { Description string `json:"description"` ExecutionType ExecutionType `json:"executionType"` RetryPolicy RetryPolicySpec `json:"retryPolicy"` TaskRoles []TaskRoleSpec `json:"taskRoles"` }
//////////////////////////////////////////////////////////////////////////////////////////////// Spec ////////////////////////////////////////////////////////////////////////////////////////////////
func (*FrameworkSpec) DeepCopy ¶
func (in *FrameworkSpec) DeepCopy() *FrameworkSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrameworkSpec.
func (*FrameworkSpec) DeepCopyInto ¶
func (in *FrameworkSpec) DeepCopyInto(out *FrameworkSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FrameworkState ¶
type FrameworkState string
The ground truth of FrameworkState is the current associated FrameworkAttemptInstance which is represented by the ConfigMapUID and the corresponding ConfigMap object in the local cache.
[AssociatedState]: ConfigMapUID is not nil
const ( // ConfigMap does not exist and // has not been creation pending. // [StartState] // -> FrameworkAttemptCreationWaiting FrameworkAttemptCreationQueuing FrameworkState = "AttemptCreationQueuing" // ConfigMap does not exist and // has not been creation pending. // [WatingState] // -> FrameworkAttemptCreationPending FrameworkAttemptCreationWaiting FrameworkState = "AttemptCreationWaiting" // TODO for remote FrameworkAttemptCreationRemoting FrameworkState = "AttemptCreationRemoting" // ConfigMap does not exist and // has not been creation requested. // [AttemptStartState] // -> FrameworkAttemptCreationRequested FrameworkAttemptCreationPending FrameworkState = "AttemptCreationPending" // ConfigMap does not exist and // has been creation requested and is expected to exist. // [AssociatedState] // -> FrameworkAttemptPreparing // -> FrameworkAttemptDeleting // -> FrameworkAttemptCompleted FrameworkAttemptCreationRequested FrameworkState = "AttemptCreationRequested" // ConfigMap exists and is not deleting and // has not been deletion requested and // FrameworkAttemptCompletionPolicy has not been satisfied and // there is no Task in TaskAttemptRunning state. // [AssociatedState] // -> FrameworkAttemptRunning // -> FrameworkAttemptDeletionPending // -> FrameworkAttemptDeleting // -> FrameworkAttemptCompleted FrameworkAttemptPreparing FrameworkState = "AttemptPreparing" // ConfigMap exists and is not deleting and // has not been deletion requested and // FrameworkAttemptCompletionPolicy has not been satisfied and // there is at least one Task in TaskAttemptRunning state. // [AssociatedState] // -> FrameworkAttemptPreparing // -> FrameworkAttemptDeletionPending // -> FrameworkAttemptDeleting // -> FrameworkAttemptCompleted FrameworkAttemptRunning FrameworkState = "AttemptRunning" // ConfigMap exists and is not deleting and // has not been deletion requested and // FrameworkAttemptCompletionPolicy has been satisfied. // [AssociatedState] // -> FrameworkAttemptDeletionRequested // -> FrameworkAttemptDeleting // -> FrameworkAttemptCompleted FrameworkAttemptDeletionPending FrameworkState = "AttemptDeletionPending" // ConfigMap exists and is not deleting and // has been deletion requested. // [AssociatedState] // -> FrameworkAttemptDeleting // -> FrameworkAttemptCompleted FrameworkAttemptDeletionRequested FrameworkState = "AttemptDeletionRequested" // ConfigMap exists and is deleting. // [AssociatedState] // -> FrameworkAttemptCompleted FrameworkAttemptDeleting FrameworkState = "AttemptDeleting" // ConfigMap does not exist and // has been creation requested and is not expected to exist and // current attempt is not the last attempt or to be determined. // [AttemptFinalState] // [AssociatedState] // -> FrameworkAttemptCreationPending // -> FrameworkCompleted FrameworkAttemptCompleted FrameworkState = "AttemptCompleted" // ConfigMap does not exist and // has been creation requested and is not expected to exist and // current attempt is the last attempt. // [FinalState] // [AssociatedState] FrameworkCompleted FrameworkState = "Completed" )
type FrameworkStatus ¶
type FrameworkStatus struct { StartTime meta.Time `json:"startTime"` CompletionTime *meta.Time `json:"completionTime"` State FrameworkState `json:"state"` TransitionTime meta.Time `json:"transitionTime"` RetryPolicyStatus RetryPolicyStatus `json:"retryPolicyStatus"` AttemptStatus FrameworkAttemptStatus `json:"attemptStatus"` }
//////////////////////////////////////////////////////////////////////////////////////////////// Status It is used to: 1. Aggregate the ground truth from other related objects, such as Pod.Status. 2. Maintain the Framework owned ground truth, such as PodUID. 3. Retain the ground truth even if other related objects are deleted.
Notes:
- It should only contain current status, history status should be a different type and stored in a history database.
- For field which is not the ground truth, such as the TaskState, it should be totally reconstructable from its ground truth, in case the Status is failed to persist due to FrameworkController restart. The ground truth may be other fields in Framework.Status or the fields in other related objects, such as the PodUID and Pod.Status.
- For field which is the ground truth, such as the PodUID, it should be Monotonically Exposed which means it should only be changed to a future state in ApiServer. However, it does not mean other related objects are also Monotonically Exposed. For example, from the view of any ApiServer client, the PodUID should be changed from a not nil value to a different not nil value, if and only if its TaskAttemptID is also increased.
- It is better to keep the ground truth in other related objects instead of in the Status here, so that the Framework can be more compatible with other k8s features, such as labels and selectors.
////////////////////////////////////////////////////////////////////////////////////////////////
func (*FrameworkStatus) DeepCopy ¶
func (in *FrameworkStatus) DeepCopy() *FrameworkStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrameworkStatus.
func (*FrameworkStatus) DeepCopyInto ¶
func (in *FrameworkStatus) DeepCopyInto(out *FrameworkStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RemoteState ¶
type RemoteState string
const ( // [InitialState] // -> RemoteWaking RemoteHibernated RemoteState = "" // Ready to start remote scheduling // -> RemoteRequestAllowed RemoteWaking RemoteState = "Waking" // Allow Remote Site to send request for the framework // [StartState] // -> RemoteRequestRecieved // -> RemoteHibernated RemoteRequestAllowed RemoteState = "RequestAllowed" // A request for the framework has been recieved // -> RemoteRequestAccepted // -> RemoteHibernated RemoteRequestRecieved RemoteState = "RequestRecieved" // Accept a request for the framework // -> RemoteFrameworkCloning // -> RemoteFrameworkFailed // -> RemoteFrameworkCompleted RemoteRequestAccepted RemoteState = "RequestAccepted" RemoteRequestDenied RemoteState = "RequestDenied" RemoteRequestCanceled RemoteState = "RequestCanceled" // Remote site is cloning the framework // -> RemoteFrameworkFailed // -> RemoteFrameworkCompleted RemoteFrameworkCloning RemoteState = "FrameworkCloning" RemoteFrameworkFailed RemoteState = "FrameworkFailed" RemoteFrameworkCompleted RemoteState = "FrameworkCompleted" )
type RetryDecision ¶
type RetryDecision struct { ShouldRetry bool // Whether the retry should be counted into AccountableRetriedCount IsAccountable bool // The retry should be executed after DelaySec. DelaySec int64 Reason string }
func (*RetryDecision) DeepCopy ¶
func (in *RetryDecision) DeepCopy() *RetryDecision
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryDecision.
func (*RetryDecision) DeepCopyInto ¶
func (in *RetryDecision) DeepCopyInto(out *RetryDecision)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (RetryDecision) String ¶
func (rd RetryDecision) String() string
type RetryPolicySpec ¶
type RetryPolicySpec struct { FancyRetryPolicy bool `json:"fancyRetryPolicy"` MaxRetryCount int32 `json:"maxRetryCount"` }
RetryPolicySpec can be configured for the whole Framework and each TaskRole to control:
- Framework RetryPolicy: The conditions to retry the whole Framework after the Framework's current FrameworkAttempt completed. It can also be considered as Framework CompletionPolicy, i.e. the conditions to complete the whole Framework.
- Task RetryPolicy: The conditions to retry a single Task in the TaskRole after the Task's current TaskAttempt completed. It can also be considered as Task CompletionPolicy, i.e. the conditions to complete a single Task in the TaskRole.
Usage: If the FancyRetryPolicy is enabled,
will retry if the completion is due to Transient Failed CompletionType, will not retry if the completion is due to Permanent Failed CompletionType, will apply the NormalRetryPolicy defined below if all above conditions are not satisfied.
If the FancyRetryPolicy is not enabled,
will directly apply the NormalRetryPolicy for all kinds of completions.
The NormalRetryPolicy is defined as,
will retry and AccountableRetriedCount++ if MaxRetryCount == -2, will retry and AccountableRetriedCount++ if the completion is due to any failure and MaxRetryCount == -1, will retry and AccountableRetriedCount++ if the completion is due to any failure and AccountableRetriedCount < MaxRetryCount, will not retry if all above conditions are not satisfied.
After the retry is exhausted, the final CompletionStatus is defined as,
the CompletionStatus of the last attempt.
Notes:
- The existence of an attempt instance may not always be observed, such as create fails but succeeds on remote and then followed by an external delete. So, an attempt identified by its attempt id may be associated with multiple attempt instances over time, i.e. multiple instances may be run for the attempt over time, however, at most one instance is exposed into ApiServer over time and at most one instance is running at any point in time. So, the actual retried attempt instances maybe exceed the RetryPolicySpec in rare cases, however, the RetryPolicyStatus will never exceed the RetryPolicySpec.
- Resort to other spec to control other kind of RetryPolicy:
- Container RetryPolicy is the RestartPolicy in Pod Spec. See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
func (*RetryPolicySpec) DeepCopy ¶
func (in *RetryPolicySpec) DeepCopy() *RetryPolicySpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryPolicySpec.
func (*RetryPolicySpec) DeepCopyInto ¶
func (in *RetryPolicySpec) DeepCopyInto(out *RetryPolicySpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (RetryPolicySpec) ShouldRetry ¶
func (rp RetryPolicySpec) ShouldRetry( rps RetryPolicyStatus, ct CompletionType, minDelaySecForTransientConflictFailed int64, maxDelaySecForTransientConflictFailed int64) RetryDecision
type RetryPolicyStatus ¶
type RetryPolicyStatus struct { // Used as the ground truth of current attempt id. // If it is for Framework, TotalRetriedCount = FrameworkAttemptID // If it is for Task, TotalRetriedCount = TaskAttemptID TotalRetriedCount int32 `json:"totalRetriedCount"` // Used to compare against MaxRetryCount. // If the FancyRetryPolicy is not enabled, // it is the same as the TotalRetriedCount. // If the FancyRetryPolicy is enabled, // it does not count into the retries for the completion which is due to // Transient CompletionType, so only in this case, it may be less than the // TotalRetriedCount. AccountableRetriedCount int32 `json:"accountableRetriedCount"` // Used to expose the ScheduledRetryTime after which current retry can be // executed. // ScheduledRetryTime = AttemptStatus.CompletionTime + RetryDelaySec // It is available and meaningful if and only if current attempt is in // AttemptCompleted state. RetryDelaySec *int64 `json:"retryDelaySec"` }
func (*RetryPolicyStatus) DeepCopy ¶
func (in *RetryPolicyStatus) DeepCopy() *RetryPolicyStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryPolicyStatus.
func (*RetryPolicyStatus) DeepCopyInto ¶
func (in *RetryPolicyStatus) DeepCopyInto(out *RetryPolicyStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TaskAttemptStatus ¶
type TaskAttemptStatus struct { // TaskAttemptID = {TaskStatus.RetryPolicyStatus.TotalRetriedCount} // It can only locate the TaskAttempt within a specific Task, i.e. it cannot // universally locate the TaskAttempt and cannot locate the TaskAttemptInstance // even within a specific Task. ID int32 `json:"id"` StartTime meta.Time `json:"startTime"` CompletionTime *meta.Time `json:"completionTime"` // Current associated TaskAttemptInstance: // TaskAttemptInstanceUID = {TaskAttemptID}_{PodUID} // It is ordered by TaskAttemptID and can universally locate the // TaskAttemptInstance. InstanceUID *types.UID `json:"instanceUID"` // A TaskAttemptInstance is represented by a Pod object: // PodName = {FrameworkName}-{TaskRoleName}-{TaskIndex} // It will never be changed during the whole lifetime of a specific Task. PodName string `json:"podName"` // PodUID can also universally locate the TaskAttemptInstance. PodUID *types.UID `json:"podUID"` PodIP *string `json:"podIP"` PodHostIP *string `json:"podHostIP"` CompletionStatus *CompletionStatus `json:"completionStatus"` }
func (*TaskAttemptStatus) DeepCopy ¶
func (in *TaskAttemptStatus) DeepCopy() *TaskAttemptStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskAttemptStatus.
func (*TaskAttemptStatus) DeepCopyInto ¶
func (in *TaskAttemptStatus) DeepCopyInto(out *TaskAttemptStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TaskRoleSpec ¶
type TaskRoleSpec struct { // TaskRoleName Name string `json:"name"` // Tasks with TaskIndex in range [0, TaskNumber) TaskNumber int32 `json:"taskNumber"` FrameworkAttemptCompletionPolicy CompletionPolicySpec `json:"frameworkAttemptCompletionPolicy"` Task TaskSpec `json:"task"` }
func (*TaskRoleSpec) DeepCopy ¶
func (in *TaskRoleSpec) DeepCopy() *TaskRoleSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRoleSpec.
func (*TaskRoleSpec) DeepCopyInto ¶
func (in *TaskRoleSpec) DeepCopyInto(out *TaskRoleSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TaskRoleStatus ¶
type TaskRoleStatus struct { // TaskRoleName Name string `json:"name"` // Tasks with TaskIndex in range [0, TaskNumber) TaskStatuses []TaskStatus `json:"taskStatuses"` }
func (*TaskRoleStatus) DeepCopy ¶
func (in *TaskRoleStatus) DeepCopy() *TaskRoleStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskRoleStatus.
func (*TaskRoleStatus) DeepCopyInto ¶
func (in *TaskRoleStatus) DeepCopyInto(out *TaskRoleStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TaskRoleStatus) GetTaskCount ¶
func (trs *TaskRoleStatus) GetTaskCount(selector TaskStatusSelector) int32
func (*TaskRoleStatus) GetTaskStatuses ¶
func (trs *TaskRoleStatus) GetTaskStatuses(selector TaskStatusSelector) []TaskStatus
type TaskSpec ¶
type TaskSpec struct { RetryPolicy RetryPolicySpec `json:"retryPolicy"` Pod core.PodTemplateSpec `json:"pod"` }
func (*TaskSpec) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec.
func (*TaskSpec) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TaskState ¶
type TaskState string
The ground truth of TaskState is the current associated TaskAttemptInstance which is represented by the PodUID and the corresponding Pod object in the local cache.
[AssociatedState]: PodUID is not nil
const ( // Pod does not exist and // has not been creation requested. // [StartState] // [AttemptStartState] // -> TaskAttemptCreationRequested TaskAttemptCreationPending TaskState = "AttemptCreationPending" // Pod does not exist and // has been creation requested and is expected to exist. // [AssociatedState] // -> TaskAttemptPreparing // -> TaskAttemptRunning // -> TaskAttemptDeleting // -> TaskAttemptCompleted TaskAttemptCreationRequested TaskState = "AttemptCreationRequested" // Pod exists and is not deleting and // has not been deletion requested and // its PodPhase is PodPending or PodUnknown afterwards. // [AssociatedState] // -> TaskAttemptRunning // -> TaskAttemptDeletionPending // -> TaskAttemptDeleting // -> TaskAttemptCompleted TaskAttemptPreparing TaskState = "AttemptPreparing" // Pod exists and is not deleting and // has not been deletion requested and // its PodPhase is PodRunning or PodUnknown afterwards. // [AssociatedState] // -> TaskAttemptDeletionPending // -> TaskAttemptDeleting // -> TaskAttemptCompleted TaskAttemptRunning TaskState = "AttemptRunning" // Pod exists and is not deleting and // has not been deletion requested and // its PodPhase is PodSucceeded or PodFailed. // [AssociatedState] // -> TaskAttemptDeletionRequested // -> TaskAttemptDeleting // -> TaskAttemptCompleted TaskAttemptDeletionPending TaskState = "AttemptDeletionPending" // Pod exists and is not deleting and // has been deletion requested. // [AssociatedState] // -> TaskAttemptDeleting // -> TaskAttemptCompleted TaskAttemptDeletionRequested TaskState = "AttemptDeletionRequested" // Pod exists and is deleting. // [AssociatedState] // -> TaskAttemptCompleted TaskAttemptDeleting TaskState = "AttemptDeleting" // Pod does not exist and // has been creation requested and is not expected to exist and // current attempt is not the last attempt or to be determined. // [AttemptFinalState] // [AssociatedState] // -> TaskAttemptCreationPending // -> TaskCompleted TaskAttemptCompleted TaskState = "AttemptCompleted" // Pod does not exist and // has been creation requested and is not expected to exist and // current attempt is the last attempt. // [FinalState] // [AssociatedState] TaskCompleted TaskState = "Completed" )
type TaskStatus ¶
type TaskStatus struct { // TaskIndex Index int32 `json:"index"` StartTime meta.Time `json:"startTime"` CompletionTime *meta.Time `json:"completionTime"` State TaskState `json:"state"` TransitionTime meta.Time `json:"transitionTime"` RetryPolicyStatus RetryPolicyStatus `json:"retryPolicyStatus"` AttemptStatus TaskAttemptStatus `json:"attemptStatus"` }
func (*TaskStatus) CompletionType ¶
func (ts *TaskStatus) CompletionType() CompletionType
func (*TaskStatus) DeepCopy ¶
func (in *TaskStatus) DeepCopy() *TaskStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus.
func (*TaskStatus) DeepCopyInto ¶
func (in *TaskStatus) DeepCopyInto(out *TaskStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*TaskStatus) IsCompleted ¶
func (ts *TaskStatus) IsCompleted() bool
func (*TaskStatus) IsFailed ¶
func (ts *TaskStatus) IsFailed() bool
func (*TaskStatus) IsRunning ¶
func (ts *TaskStatus) IsRunning() bool
func (*TaskStatus) IsSucceeded ¶
func (ts *TaskStatus) IsSucceeded() bool
func (*TaskStatus) PodName ¶
func (ts *TaskStatus) PodName() string
func (*TaskStatus) PodUID ¶
func (ts *TaskStatus) PodUID() *types.UID
func (*TaskStatus) TaskAttemptID ¶
func (ts *TaskStatus) TaskAttemptID() int32
func (*TaskStatus) TaskAttemptInstanceUID ¶
func (ts *TaskStatus) TaskAttemptInstanceUID() *types.UID
type TaskStatusSelector ¶
type TaskStatusSelector func(*TaskStatus) bool
///////////////////////////////////////////////////////////////////////////////////// Interfaces /////////////////////////////////////////////////////////////////////////////////////