v1

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 22 Imported by: 9

Documentation

Overview

+k8s:deepcopy-gen=package +groupName=frameworkcontroller.microsoft.com

Index

Constants

View Source
const (
	// For controller
	ComponentName      = "frameworkcontroller"
	GroupName          = "frameworkcontroller.microsoft.com"
	Version            = "v1"
	FrameworkPlural    = "frameworks"
	FrameworkCRDName   = FrameworkPlural + "." + GroupName
	FrameworkKind      = "Framework"
	TaskKind           = "Task"
	ConfigMapKind      = "ConfigMap"
	PodKind            = "Pod"
	ObjectUIDFieldPath = "metadata.uid"

	ConfigFilePath                    = "./frameworkcontroller.yaml"
	UnlimitedValue                    = -1
	ExtendedUnlimitedValue            = -2
	LargeFrameworkCompressionMinBytes = 700 * 1024

	// 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"

	AnnotationKeyFrameworkUID                = "FC_FRAMEWORK_UID"
	AnnotationKeyFrameworkAttemptID          = "FC_FRAMEWORK_ATTEMPT_ID"
	AnnotationKeyFrameworkAttemptInstanceUID = "FC_FRAMEWORK_ATTEMPT_INSTANCE_UID"
	AnnotationKeyConfigMapUID                = "FC_CONFIGMAP_UID"
	AnnotationKeyTaskRoleUID                 = "FC_TASKROLE_UID"
	AnnotationKeyTaskUID                     = "FC_TASK_UID"
	AnnotationKeyTaskAttemptID               = "FC_TASK_ATTEMPT_ID"

	// Predefined Labels
	LabelKeyFrameworkName = AnnotationKeyFrameworkName
	LabelKeyTaskRoleName  = AnnotationKeyTaskRoleName
	LabelKeyTaskIndex     = AnnotationKeyTaskIndex

	// For all managed containers
	// Predefined Environment Variables
	// It can be referred by other environment variables specified in the Container Env,
	// i.e. specify its value to include "$(AnyPredefinedEnvName)".
	// If the reference is predefined, it will be replaced to its target value when
	// start the Container, otherwise it will be unchanged.
	EnvNameFrameworkNamespace = AnnotationKeyFrameworkNamespace
	EnvNameFrameworkName      = AnnotationKeyFrameworkName
	EnvNameTaskRoleName       = AnnotationKeyTaskRoleName
	EnvNameTaskIndex          = AnnotationKeyTaskIndex
	EnvNameConfigMapName      = AnnotationKeyConfigMapName
	EnvNamePodName            = AnnotationKeyPodName

	EnvNameFrameworkUID                = AnnotationKeyFrameworkUID
	EnvNameFrameworkAttemptID          = AnnotationKeyFrameworkAttemptID
	EnvNameFrameworkAttemptInstanceUID = AnnotationKeyFrameworkAttemptInstanceUID
	EnvNameConfigMapUID                = AnnotationKeyConfigMapUID
	EnvNameTaskRoleUID                 = AnnotationKeyTaskRoleUID
	EnvNameTaskUID                     = AnnotationKeyTaskUID
	EnvNameTaskAttemptID               = AnnotationKeyTaskAttemptID
	EnvNameTaskAttemptInstanceUID      = "FC_TASK_ATTEMPT_INSTANCE_UID"
	EnvNamePodUID                      = "FC_POD_UID"

	// For Pod Spec
	// Predefined Pod Template Placeholders
	// It can be referred in any string value specified in the Pod Spec,
	// i.e. specify the value to include "{{AnyPredefinedPlaceholder}}".
	// If the reference is predefined, it will be replaced to its target value when
	// create the Pod object, otherwise it will be unchanged.
	PlaceholderFrameworkNamespace = AnnotationKeyFrameworkNamespace
	PlaceholderFrameworkName      = AnnotationKeyFrameworkName
	PlaceholderTaskRoleName       = AnnotationKeyTaskRoleName
	PlaceholderTaskIndex          = AnnotationKeyTaskIndex
	PlaceholderConfigMapName      = AnnotationKeyConfigMapName
	PlaceholderPodName            = AnnotationKeyPodName

	// For LogObjectSnapshot
	// All snapshots are logged in format:
	// {AnyLogMessage}{ObjectSnapshotTrigger}{LogMarkerObjectSnapshot}{JsonObjectSnapshot}
	LogMarkerObjectSnapshot                            = ": ObjectSnapshot: "
	LogMarkerOnFrameworkRetry    ObjectSnapshotTrigger = ": OnFrameworkRetry"
	LogMarkerOnFrameworkDeletion ObjectSnapshotTrigger = ": OnFrameworkDeletion"
	LogMarkerOnTaskRetry         ObjectSnapshotTrigger = ": OnTaskRetry"
	LogMarkerOnTaskDeletion      ObjectSnapshotTrigger = ": OnTaskDeletion"
	LogMarkerOnPodDeletion       ObjectSnapshotTrigger = ": OnPodDeletion"
)

///////////////////////////////////////////////////////////////////////////////////// General Constants /////////////////////////////////////////////////////////////////////////////////////

View Source
const (
	// Names in CRD should be up to 63 lower case alphanumeric characters.
	NamingConvention = "^[a-z0-9]{1,63}$"
)

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var CompletionCodeReservedNonPositive = CompletionCodeRange{-999, 0}
View Source
var CompletionCodeReservedPositive = CompletionCodeRange{200, 219}

Reserved CompletionCodes It is Reserved for the Contract between Container and FrameworkController, so Container should avoid unintendedly exit within the range.

View Source
var ConfigMapGroupVersionKind = core.SchemeGroupVersion.WithKind(ConfigMapKind)
View Source
var DefaultKubeConfigFilePath = os.Getenv("HOME") + "/.kube/config"
View Source
var EnvValueKubeApiServerAddress = os.Getenv("KUBE_APISERVER_ADDRESS")
View Source
var EnvValueKubeConfigFilePath = os.Getenv("KUBECONFIG")
View Source
var FrameworkGroupVersionKind = SchemeGroupVersion.WithKind(FrameworkKind)
View Source
var ObjectUIDEnvVarSource = &core.EnvVarSource{
	FieldRef: &core.ObjectFieldSelector{FieldPath: ObjectUIDFieldPath},
}
View Source
var PodGroupVersionKind = core.SchemeGroupVersion.WithKind(PodKind)
View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   GroupName,
	Version: Version,
}
View Source
var TaskGroupVersionKind = SchemeGroupVersion.WithKind(TaskKind)

Functions

func AppendCompletionCodeInfos added in v0.4.0

func AppendCompletionCodeInfos(codeInfos []*CompletionCodeInfo)

func BuildKubeConfig added in v0.2.0

func BuildKubeConfig(cConfig *Config) *rest.Config

func GetAllContainerStatuses added in v0.4.0

func GetAllContainerStatuses(pod *core.Pod) []core.ContainerStatus

func GetConfigMapName

func GetConfigMapName(frameworkName string) string

func GetFrameworkAttemptInstanceUID

func GetFrameworkAttemptInstanceUID(frameworkAttemptID int32, configMapUID *types.UID) *types.UID

func GetPodName

func GetPodName(frameworkName string, taskRoleName string, taskIndex int32) string

func GetTaskAttemptInstanceUID

func GetTaskAttemptInstanceUID(taskAttemptID int32, podUID *types.UID) *types.UID

func GetTaskName added in v0.9.0

func GetTaskName(frameworkName string, taskRoleName string, taskIndex int32) string

func Resource

func Resource(resource string) schema.GroupResource

func SplitConfigMapName

func SplitConfigMapName(configMapName string) (frameworkName string)

func SplitFrameworkAttemptInstanceUID

func SplitFrameworkAttemptInstanceUID(frameworkAttemptInstanceUID *types.UID) (
	frameworkAttemptID int32, configMapUID *types.UID)

func SplitFrameworkKey added in v0.6.0

func SplitFrameworkKey(frameworkKey string) (frameworkNamespace, frameworkName string)

///////////////////////////////////////////////////////////////////////////////////// Utils /////////////////////////////////////////////////////////////////////////////////////

func SplitPodName

func SplitPodName(podName string) (frameworkName string, taskRoleName string, taskIndex int32)

func SplitTaskAttemptInstanceUID

func SplitTaskAttemptInstanceUID(taskAttemptInstanceUID *types.UID) (
	taskAttemptID int32, podUID *types.UID)

func SplitTaskName added in v0.9.0

func SplitTaskName(taskName string) (frameworkName string, taskRoleName string, taskIndex int32)

Types

type CompletionCode

type CompletionCode int32
const (
	// [200, 219]: Predefined Container ExitCode
	CompletionCodeContainerTransientFailed         CompletionCode = 200
	CompletionCodeContainerTransientConflictFailed CompletionCode = 201
	CompletionCodeContainerPermanentFailed         CompletionCode = 210

	// [0, 0]: Succeeded
	CompletionCodeSucceeded CompletionCode = 0

	// [-999, -1]: Predefined Framework Error
	// -1XX: Transient Error
	CompletionCodeConfigMapExternalDeleted           CompletionCode = -100
	CompletionCodePodExternalDeleted                 CompletionCode = -101
	CompletionCodeConfigMapLocalCacheCreationTimeout CompletionCode = -110
	CompletionCodePodLocalCacheCreationTimeout       CompletionCode = -111
	CompletionCodePodCreationTransientError          CompletionCode = -120
	// -2XX: Permanent Error
	CompletionCodePodCreationPermanentError  CompletionCode = -200
	CompletionCodeStopFrameworkRequested     CompletionCode = -210
	CompletionCodeFrameworkAttemptCompletion CompletionCode = -220
	CompletionCodeDeleteTaskRequested        CompletionCode = -230
	// -3XX: Unknown Error
	CompletionCodePodFailedWithoutFailedContainer CompletionCode = -300
	CompletionCodePodCreationUnknownError         CompletionCode = -310
)

Predefined CompletionCodes The predefined ones must be within the reserved ones.

func (CompletionCode) NewFrameworkAttemptCompletionStatus added in v0.4.0

func (cc CompletionCode) NewFrameworkAttemptCompletionStatus(
	diag string, cpts *CompletionPolicyTriggerStatus) *FrameworkAttemptCompletionStatus

The CompletionCode should only be the predefined ones.

func (CompletionCode) NewTaskAttemptCompletionStatus added in v0.4.0

func (cc CompletionCode) NewTaskAttemptCompletionStatus(
	diag string, pcs *PodCompletionStatus) *TaskAttemptCompletionStatus

The CompletionCode should only be the predefined ones.

func (CompletionCode) Ptr added in v0.4.0

func (cc CompletionCode) Ptr() *CompletionCode

type CompletionCodeInfo

type CompletionCodeInfo struct {
	// Must not duplicate with other codes.
	// It should not be within [-999, 0] and [200, 219], if it is from Config.
	// It can universally locate the CompletionCodeInfo, if it is non-positive.
	Code *CompletionCode `yaml:"code"`
	// The textual phrase representation of the CompletionCode.
	// Default to empty.
	Phrase CompletionPhrase `yaml:"phrase,omitempty"`
	// The CompletionTypeName must be Failed, if it is from Config.
	// Default to Failed.
	Type CompletionType `yaml:"type"`
	// If the Pod matches ANY pattern in the PodPatterns, it matches the
	// CompletionCode.
	// It is required, if it is from Config.
	// Default to match NONE.
	PodPatterns []*PodPattern `yaml:"podPatterns,omitempty"`
}

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 CompletionCodeRange added in v0.4.0

type CompletionCodeRange struct {
	Min CompletionCode
	Max CompletionCode
}

///////////////////////////////////////////////////////////////////////////////////// CompletionCodeInfos Constants ///////////////////////////////////////////////////////////////////////////////////// Represent [Min, Max]

func (CompletionCodeRange) Contains added in v0.4.0

func (ccr CompletionCodeRange) Contains(cc CompletionCode) bool

func (*CompletionCodeRange) DeepCopy added in v0.4.0

func (in *CompletionCodeRange) DeepCopy() *CompletionCodeRange

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionCodeRange.

func (*CompletionCodeRange) DeepCopyInto added in v0.4.0

func (in *CompletionCodeRange) DeepCopyInto(out *CompletionCodeRange)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (CompletionCodeRange) Int32Range added in v0.4.0

func (ccr CompletionCodeRange) Int32Range() Int32Range

func (CompletionCodeRange) String added in v0.4.0

func (ccr CompletionCodeRange) String() string

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:

  1. The conditions to complete a FrameworkAttempt.
  2. The CompletionStatus of the completed FrameworkAttempt.

Usage:

  1. If the ExecutionType is ExecutionStop, immediately complete the FrameworkAttempt, regardless of any uncompleted Task, and the CompletionStatus is failed which is not inherited from any Task.
  2. 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 inherited from the Task which triggers the completion.
  3. 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 inherited from the Task which triggers the completion.
  4. If multiple above conditions are satisfied at the same time, the behavior can be any one of these satisfied conditions.
  5. If none of above conditions are satisfied until all Tasks of the Framework are completed and the Framework has at least one Task, immediately complete the FrameworkAttempt and the CompletionStatus is succeeded which is not inherited from any Task.

Notes:

  1. 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.
  2. Resort to other spec to control other kind of CompletionPolicy:
  3. Framework CompletionPolicy is equivalent to Framework RetryPolicy.
  4. Task CompletionPolicy is equivalent to Task RetryPolicy.
  5. 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

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 CompletionPolicyTriggerStatus added in v0.4.0

type CompletionPolicyTriggerStatus struct {
	Message      string `json:"message"`
	TaskRoleName string `json:"taskRoleName"`
	TaskIndex    int32  `json:"taskIndex"`
}

func (*CompletionPolicyTriggerStatus) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompletionPolicyTriggerStatus.

func (*CompletionPolicyTriggerStatus) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CompletionStatus

type CompletionStatus struct {
	// See corresponding fields in CompletionCodeInfo.
	Code   CompletionCode   `json:"code"`
	Phrase CompletionPhrase `json:"phrase"`
	Type   CompletionType   `json:"type"`

	// It is the summarized diagnostic information of the completion.
	// Such as if the CompletionCodeInfo is generated from the PodPattern matching,
	// the Diagnostics will include the matched Pod field which is explicitly
	// specified in the corresponding PodPattern.
	// For detailed and structured diagnostic information, check its outer embedding
	// type.
	Diagnostics string `json:"diagnostics"`
}

It is generated from Predefined CompletionCodes or PodPattern matching. For a Pod, if no PodPattern is matched and failed Container exists, the CompletionCode is the same as the last failed Container ExitCode. See PodFailureSpec.

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.

type CompletionType

type CompletionType struct {
	Name       CompletionTypeName        `json:"name" yaml:"name"`
	Attributes []CompletionTypeAttribute `json:"attributes" yaml:"attributes"`
}

func (CompletionType) ContainsAttribute

func (ct CompletionType) ContainsAttribute(attr 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

///////////////////////////////////////////////////////////////////////////////////// Completion Utils /////////////////////////////////////////////////////////////////////////////////////

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 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 added in v0.2.0

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"`

	// Rate limits of requests from FrameworkController to ApiServer.
	// Generally, it should be proportional to the cluster Framework workload, and within the ApiServer
	// serving capacity/limit such as the --max-mutating-requests-inflight.
	KubeClientQps   *float32 `yaml:"kubeClientQps"`
	KubeClientBurst *int32   `yaml:"kubeClientBurst"`

	// Number of concurrent workers to process each different Frameworks.
	// Generally, it should be proportional to the above rate limits of requests.
	WorkerNumber *int32 `yaml:"workerNumber"`

	// Specify whether to compress some fields in the Framework object if they are too large.
	//
	// Currently, due to the etcd limitation, the max size of any object on ApiServer is 1.5 MB:
	// https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/limit.md#request-size-limit
	// So, without this compression, FrameworkController can only support small scale Framework in the
	// worst case, i.e. the total task number in a single Framework is not greater than 300.
	//
	// With this compression, FrameworkController can generally support large scale Framework, i.e.
	// the total task number in a single Framework is not greater than 10000.
	// However, this requires all clients who read the Framework object directly, need to decompress
	// the compressed fields by themselves.
	//
	// How to decompress?
	// 1. The field name of a compressed field, has a suffix "Compressed" compared with the field
	//    name of its corresponding raw field, such as TaskRoleStatusesCompressed is the compressed
	//    field of TaskRoleStatuses.
	// 2. If the raw field is not null, just use the raw field, otherwise fallback to the compressed
	//    field, by base64 decoding, gzip decompression and json unmarshal.
	// 3. Currently, only field TaskRoleStatuses will be compressed if it is too large.
	LargeFrameworkCompression *bool `yaml:"largeFrameworkCompression"`

	// 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"`

	// A Framework will only be retained within recent FrameworkCompletedRetainSec
	// after it is completed, i.e. it will be automatically deleted after
	// f.Status.CompletionTime + FrameworkCompletedRetainSec.
	FrameworkCompletedRetainSec *int64 `yaml:"frameworkCompletedRetainSec"`

	// 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"`

	// Specify when to log the snapshot of which managed object.
	// This enables external systems to collect and process the history snapshots,
	// such as persistence, metrics conversion, visualization, alerting, acting,
	// analysis, etc.
	// Notes:
	// 1. The snapshot is logged to stderr and can be extracted by the regular
	//    expression ": ObjectSnapshot: (.+)", see LogMarkerObjectSnapshot.
	// 2. To determine the type of the snapshot, using object.apiVersion and
	//    object.kind.
	// 3. The same snapshot may be logged more than once in some rare cases, so
	//    external systems may need to deduplicate them by object.resourceVersion.
	// 4. The snapshot triggered by deletion may be missed to log during the
	//    FrameworkController downtime.
	LogObjectSnapshot LogObjectSnapshot `yaml:"logObjectSnapshot"`

	// Specify how to classify and summarize Pod failures:
	// 1. Generate universally unique and comparable CompletionCode.
	// 2. Generate CompletionType to instruct FancyRetryPolicy.
	// 3. Generate Diagnostics to summarize the Pod failure.
	// Notes:
	// 1. It will only be used for Failed Pods.
	// 2. Before it is used, it will be appended to the predefined internal
	//    completionCodeInfoList and if multiple CompletionCodes are matched in
	//    the final completionCodeInfoList, prefer to pick the first one.
	// 3. If a Pod is matched, only the Pod field which is explicitly specified in
	//    the corresponding PodPattern will be included in its Diagnostics.
	//    Otherwise, the whole PodCompletionStatus will be included in its
	//    Diagnostics.
	// 4. Non-positive CompletionCode must be universally unique and comparable
	//    since it can only be generated from FrameworkController, but positive
	//    CompletionCode may not since it may also be generated from Container
	//    ExitCode. So, it still needs the cooperation from Container to ensure
	//    positive CompletionCode is also universally unique and comparable.
	PodFailureSpec []*CompletionCodeInfo `yaml:"podFailureSpec"`
}

func NewConfig added in v0.2.0

func NewConfig() *Config

func (*Config) DeepCopy added in v0.2.0

func (in *Config) DeepCopy() *Config

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.

func (*Config) DeepCopyInto added in v0.2.0

func (in *Config) DeepCopyInto(out *Config)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerCompletionStatus added in v0.4.0

type ContainerCompletionStatus struct {
	Name    string `json:"name"`
	Reason  string `json:"reason,omitempty"`
	Message string `json:"message,omitempty"`
	Signal  int32  `json:"signal,omitempty"`
	Code    int32  `json:"code"`
}

func (*ContainerCompletionStatus) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerCompletionStatus.

func (*ContainerCompletionStatus) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerPattern added in v0.4.0

type ContainerPattern struct {
	NameRegex    Regex      `yaml:"nameRegex,omitempty"`
	ReasonRegex  Regex      `yaml:"reasonRegex,omitempty"`
	MessageRegex Regex      `yaml:"messageRegex,omitempty"`
	SignalRange  Int32Range `yaml:"signalRange,omitempty"`
	// It is the range of Container ExitCode.
	CodeRange Int32Range `yaml:"codeRange,omitempty"`
}

func (*ContainerPattern) DeepCopy added in v0.4.0

func (in *ContainerPattern) DeepCopy() *ContainerPattern

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerPattern.

func (*ContainerPattern) DeepCopyInto added in v0.4.0

func (in *ContainerPattern) DeepCopyInto(out *ContainerPattern)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExecutionType

type ExecutionType string

User can set any ExecutionType when create a Framework, and then he can choose to change the ExecutionType or not. However, only below changes are supported: 1. ExecutionCreate -> ExecutionStart/ExecutionStop 2. ExecutionStart -> ExecutionStop

const (
	// The Framework will be kept in FrameworkAttemptCreationPending.
	// So it will never start to run or complete.
	ExecutionCreate ExecutionType = "Create"
	// The Framework will be transitioned from FrameworkAttemptCreationPending.
	// So it will immediately start to run.
	ExecutionStart ExecutionType = "Start"
	// The Framework will be transitioned to FrameworkCompleted.
	// So it will immediately start to complete.
	ExecutionStop ExecutionType = "Stop"
)

type Framework

type Framework struct {
	meta.TypeMeta   `json:",inline"`
	meta.ObjectMeta `json:"metadata"`
	Spec            FrameworkSpec    `json:"spec"`
	Status          *FrameworkStatus `json:"status"`
}

//////////////////////////////////////////////////////////////////////////////////////////////// Framework A Framework represents an application with a set of Tasks. See README.md.

Notes:

  1. 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.

//////////////////////////////////////////////////////////////////////////////////////////////// +genclient +genclient:noStatus +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Framework) CompletionType

func (f *Framework) CompletionType() CompletionType

func (*Framework) Compress added in v0.5.0

func (f *Framework) Compress() error

func (*Framework) ConfigMapName

func (f *Framework) ConfigMapName() string

func (*Framework) ConfigMapUID

func (f *Framework) ConfigMapUID() *types.UID

func (*Framework) Decompress added in v0.5.0

func (f *Framework) Decompress() error

func (*Framework) DeepCopy

func (in *Framework) DeepCopy() *Framework

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Framework.

func (*Framework) DeepCopyInto

func (in *Framework) DeepCopyInto(out *Framework)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Framework) DeepCopyObject

func (in *Framework) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Framework) FrameworkAttemptID

func (f *Framework) FrameworkAttemptID() int32

///////////////////////////////////////////////////////////////////////////////////// Status Read Methods /////////////////////////////////////////////////////////////////////////////////////

func (*Framework) FrameworkAttemptInstanceUID

func (f *Framework) FrameworkAttemptInstanceUID() *types.UID

func (*Framework) GetTaskCountSpec added in v0.7.0

func (f *Framework) GetTaskCountSpec() int32

func (*Framework) GetTaskCountStatus added in v0.7.0

func (f *Framework) GetTaskCountStatus(selector TaskStatusSelector) int32

func (*Framework) GetTaskRoleSpec added in v0.7.0

func (f *Framework) GetTaskRoleSpec(taskRoleName string) *TaskRoleSpec

Return nil if and only if the TaskRoleSpec is deleted while the TaskRole's TaskRoleStatus still exist due to graceful deletion.

func (*Framework) GetTaskRoleStatus added in v0.7.0

func (f *Framework) GetTaskRoleStatus(taskRoleName string) *TaskRoleStatus

func (*Framework) GetTaskSpec added in v0.9.0

func (f *Framework) GetTaskSpec(taskRoleName string) *TaskSpec

Return nil if and only if its TaskRole's TaskRoleSpec is deleted while its TaskStatus still exist due to graceful deletion.

func (*Framework) GetTaskStatus added in v0.7.0

func (f *Framework) GetTaskStatus(taskRoleName string, taskIndex int32) *TaskStatus

func (*Framework) GetTotalTaskCountSpec added in v0.7.0

func (f *Framework) GetTotalTaskCountSpec() int32

func (*Framework) GetTotalTaskCountStatus added in v0.7.0

func (f *Framework) GetTotalTaskCountStatus() int32

func (*Framework) IsAnyTaskRunning added in v0.4.0

func (f *Framework) IsAnyTaskRunning(ignoreDeletionPending bool) bool

func (*Framework) IsCompleted

func (f *Framework) IsCompleted() bool

func (*Framework) IsCompleting added in v0.4.0

func (f *Framework) IsCompleting() bool

func (*Framework) IsFailed

func (f *Framework) IsFailed() bool

func (*Framework) IsRunning added in v0.4.0

func (f *Framework) IsRunning() bool

func (*Framework) IsSucceeded

func (f *Framework) IsSucceeded() bool

func (*Framework) Key

func (f *Framework) Key() string

///////////////////////////////////////////////////////////////////////////////////// Spec Read Methods /////////////////////////////////////////////////////////////////////////////////////

func (*Framework) MockTask added in v0.9.0

func (f *Framework) MockTask(taskRoleName string, taskIndex int32, taskDeleting bool) *Task

Mock a standalone Task from an embedded Task. Before calling it, ensure the embedded Task has been persisted, so the standalone Task can be considered to have ever existed with the same ResourceVersion as its Framework.

func (*Framework) NewConfigMap

func (f *Framework) NewConfigMap() *core.ConfigMap

func (*Framework) NewFrameworkAttemptStatus

func (f *Framework) NewFrameworkAttemptStatus(
	frameworkAttemptID int32) FrameworkAttemptStatus

func (*Framework) NewFrameworkStatus

func (f *Framework) NewFrameworkStatus() *FrameworkStatus

func (*Framework) NewPod

func (f *Framework) NewPod(cm *core.ConfigMap, taskRoleName string, taskIndex int32) *core.Pod

Before calling it, ensure its TaskRole's TaskRoleSpec exists.

func (*Framework) NewTaskAttemptStatus

func (f *Framework) NewTaskAttemptStatus(
	taskRoleName string, taskIndex int32, taskAttemptID int32) TaskAttemptStatus

func (*Framework) NewTaskRoleStatus added in v0.9.0

func (f *Framework) NewTaskRoleStatus(taskRoleName string, taskNumber int32) *TaskRoleStatus

func (*Framework) NewTaskRoleStatuses

func (f *Framework) NewTaskRoleStatuses() []*TaskRoleStatus

func (*Framework) NewTaskStatus

func (f *Framework) NewTaskStatus(taskRoleName string, taskIndex int32) *TaskStatus

func (*Framework) NewTaskStatuses added in v0.9.0

func (f *Framework) NewTaskStatuses(taskRoleName string, taskNumber int32) []*TaskStatus

func (*Framework) TaskRoleSpec

func (f *Framework) TaskRoleSpec(taskRoleName string) *TaskRoleSpec

Panic if and only if the TaskRoleSpec is deleted while the TaskRole's TaskRoleStatus still exist due to graceful deletion.

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

func (*Framework) TransitionTaskState

func (f *Framework) TransitionTaskState(
	taskRoleName string, taskIndex int32, dstState TaskState)

This is the only interface to modify TaskState

type FrameworkAttemptCompletionStatus added in v0.4.0

type FrameworkAttemptCompletionStatus struct {
	// Summary
	// Must be not nil for FrameworkAttemptCompleted and FrameworkCompleted Framework.
	*CompletionStatus `json:",inline"`
	// Detail
	Trigger *CompletionPolicyTriggerStatus `json:"trigger,omitempty"`
}

func NewCompletedTaskTriggeredCompletionStatus added in v0.7.0

func NewCompletedTaskTriggeredCompletionStatus(
	triggerTaskStatus *TaskStatus,
	triggerTaskRoleName string,
	completedTaskCount int32,
	totalTaskCount int32) *FrameworkAttemptCompletionStatus

func NewFailedTaskTriggeredCompletionStatus added in v0.7.0

func NewFailedTaskTriggeredCompletionStatus(
	triggerTaskStatus *TaskStatus,
	triggerTaskRoleName string,
	failedTaskCount int32,
	minFailedTaskCount int32) *FrameworkAttemptCompletionStatus

func NewSucceededTaskTriggeredCompletionStatus added in v0.7.0

func NewSucceededTaskTriggeredCompletionStatus(
	triggerTaskStatus *TaskStatus,
	triggerTaskRoleName string,
	succeededTaskCount int32,
	minSucceededTaskCount int32) *FrameworkAttemptCompletionStatus

func (*FrameworkAttemptCompletionStatus) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrameworkAttemptCompletionStatus.

func (*FrameworkAttemptCompletionStatus) DeepCopyInto added in v0.4.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

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"`
	RunTime        *meta.Time `json:"runTime"`
	CompletionTime *meta.Time `json:"completionTime"`

	// Current associated FrameworkAttemptInstance:
	// FrameworkAttemptInstanceUID = {FrameworkAttemptID}_{ConfigMapUID}
	// It is ordered by FrameworkAttemptID and can universally locate the
	// FrameworkAttemptInstance.
	// See RetryPolicySpec.
	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           *FrameworkAttemptCompletionStatus `json:"completionStatus"`
	TaskRoleStatuses           []*TaskRoleStatus                 `json:"taskRoleStatuses"`
	TaskRoleStatusesCompressed []byte                            `json:"taskRoleStatusesCompressed,omitempty"`
}

func (*FrameworkAttemptStatus) DeepCopy

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"`
}

//////////////////////////////////////////////////////////////////////////////////////////////// Framework.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
	// may not have been creation requested successfully and is expected to exist.
	// [StartState]
	// [AttemptStartState]
	// -> FrameworkAttemptCreationRequested
	// -> FrameworkAttemptCompleted
	FrameworkAttemptCreationPending FrameworkState = "AttemptCreationPending"

	// ConfigMap does not exist and
	// must have been creation requested successfully and is expected to exist.
	// [AssociatedState]
	// -> FrameworkAttemptPreparing
	// -> FrameworkAttemptDeleting
	// -> FrameworkAttemptCompleted
	FrameworkAttemptCreationRequested FrameworkState = "AttemptCreationRequested"

	// ConfigMap exists and is not deleting and
	// may not have been deletion requested successfully and
	// FrameworkAttemptCompletionPolicy may not have been satisfied and
	// no Task of current attempt has ever entered TaskAttemptRunning state.
	// [AssociatedState]
	// -> FrameworkAttemptRunning
	// -> FrameworkAttemptDeletionPending
	// -> FrameworkAttemptDeleting
	// -> FrameworkAttemptCompleted
	FrameworkAttemptPreparing FrameworkState = "AttemptPreparing"

	// ConfigMap exists and is not deleting and
	// may not have been deletion requested successfully and
	// FrameworkAttemptCompletionPolicy may not have been satisfied and
	// at least one Task of current attempt has ever entered TaskAttemptRunning state.
	// [AssociatedState]
	// -> FrameworkAttemptDeletionPending
	// -> FrameworkAttemptDeleting
	// -> FrameworkAttemptCompleted
	FrameworkAttemptRunning FrameworkState = "AttemptRunning"

	// ConfigMap exists and is not deleting and
	// may not have been deletion requested successfully and
	// FrameworkAttemptCompletionPolicy must have been satisfied.
	// [AssociatedState]
	// -> FrameworkAttemptDeletionRequested
	// -> FrameworkAttemptDeleting
	// -> FrameworkAttemptCompleted
	FrameworkAttemptDeletionPending FrameworkState = "AttemptDeletionPending"

	// ConfigMap exists and is not deleting and
	// must have been deletion requested successfully.
	// [AssociatedState]
	// -> FrameworkAttemptDeleting
	// -> FrameworkAttemptCompleted
	FrameworkAttemptDeletionRequested FrameworkState = "AttemptDeletionRequested"

	// ConfigMap exists and is deleting.
	// [AssociatedState]
	// -> FrameworkAttemptCompleted
	FrameworkAttemptDeleting FrameworkState = "AttemptDeleting"

	// ConfigMap does not exist and
	// is not expected to exist and will never exist and
	// current attempt is not the last attempt or to be determined.
	// [AttemptFinalState]
	// -> FrameworkAttemptCreationPending
	// -> FrameworkCompleted
	FrameworkAttemptCompleted FrameworkState = "AttemptCompleted"

	// ConfigMap does not exist and
	// is not expected to exist and will never exist and
	// current attempt is the last attempt.
	// [FinalState]
	FrameworkCompleted FrameworkState = "Completed"
)

type FrameworkStatus

type FrameworkStatus struct {
	StartTime         meta.Time              `json:"startTime"`
	RunTime           *meta.Time             `json:"runTime"`
	CompletionTime    *meta.Time             `json:"completionTime"`
	State             FrameworkState         `json:"state"`
	TransitionTime    meta.Time              `json:"transitionTime"`
	RetryPolicyStatus RetryPolicyStatus      `json:"retryPolicyStatus"`
	AttemptStatus     FrameworkAttemptStatus `json:"attemptStatus"`
}

//////////////////////////////////////////////////////////////////////////////////////////////// Framework.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:

  1. It should only contain current status, history status should be a different type and stored in a history database.
  2. 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.
  3. 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.
  4. 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 Int32Range added in v0.4.0

type Int32Range struct {
	Min *int32 `yaml:"min,omitempty"`
	Max *int32 `yaml:"max,omitempty"`
}

Represent [Min, Max] and nil indicates unlimited.

func (Int32Range) Contains added in v0.4.0

func (ir Int32Range) Contains(i int32) bool

func (*Int32Range) DeepCopy added in v0.4.0

func (in *Int32Range) DeepCopy() *Int32Range

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Int32Range.

func (*Int32Range) DeepCopyInto added in v0.4.0

func (in *Int32Range) DeepCopyInto(out *Int32Range)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Int32Range) IsZero added in v0.4.0

func (ir Int32Range) IsZero() bool

func (Int32Range) String added in v0.4.0

func (ir Int32Range) String() string

type LogFrameworkSnapshot added in v0.4.0

type LogFrameworkSnapshot struct {
	OnFrameworkRetry    *bool `yaml:"onFrameworkRetry"`
	OnFrameworkDeletion *bool `yaml:"onFrameworkDeletion"`
}

func (*LogFrameworkSnapshot) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogFrameworkSnapshot.

func (*LogFrameworkSnapshot) DeepCopyInto added in v0.4.0

func (in *LogFrameworkSnapshot) DeepCopyInto(out *LogFrameworkSnapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LogFrameworkSnapshot) GetLogTailOnFrameworkDeletion added in v0.9.0

func (s *LogFrameworkSnapshot) GetLogTailOnFrameworkDeletion(f *Framework) string

func (*LogFrameworkSnapshot) GetLogTailOnFrameworkRetry added in v0.9.0

func (s *LogFrameworkSnapshot) GetLogTailOnFrameworkRetry(f *Framework) string

type LogObjectSnapshot added in v0.4.0

type LogObjectSnapshot struct {
	Framework LogFrameworkSnapshot `yaml:"framework"`
	Task      LogTaskSnapshot      `yaml:"task"`
	Pod       LogPodSnapshot       `yaml:"pod"`
}

func (*LogObjectSnapshot) DeepCopy added in v0.4.0

func (in *LogObjectSnapshot) DeepCopy() *LogObjectSnapshot

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogObjectSnapshot.

func (*LogObjectSnapshot) DeepCopyInto added in v0.4.0

func (in *LogObjectSnapshot) DeepCopyInto(out *LogObjectSnapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LogPodSnapshot added in v0.4.0

type LogPodSnapshot struct {
	OnPodDeletion *bool `yaml:"onPodDeletion"`
}

func (*LogPodSnapshot) DeepCopy added in v0.4.0

func (in *LogPodSnapshot) DeepCopy() *LogPodSnapshot

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogPodSnapshot.

func (*LogPodSnapshot) DeepCopyInto added in v0.4.0

func (in *LogPodSnapshot) DeepCopyInto(out *LogPodSnapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LogPodSnapshot) GetLogTailOnPodDeletion added in v0.9.0

func (s *LogPodSnapshot) GetLogTailOnPodDeletion(pod *core.Pod) string

type LogTaskSnapshot added in v0.9.0

type LogTaskSnapshot struct {
	OnTaskRetry    *bool `yaml:"onTaskRetry"`
	OnTaskDeletion *bool `yaml:"onTaskDeletion"`
}

func (*LogTaskSnapshot) DeepCopy added in v0.9.0

func (in *LogTaskSnapshot) DeepCopy() *LogTaskSnapshot

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogTaskSnapshot.

func (*LogTaskSnapshot) DeepCopyInto added in v0.9.0

func (in *LogTaskSnapshot) DeepCopyInto(out *LogTaskSnapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LogTaskSnapshot) GetLogTailOnTaskDeletion added in v0.9.0

func (s *LogTaskSnapshot) GetLogTailOnTaskDeletion(task *Task) string

func (*LogTaskSnapshot) GetLogTailOnTaskRetry added in v0.9.0

func (s *LogTaskSnapshot) GetLogTailOnTaskRetry(task *Task) string

type MatchedContainer added in v0.4.0

type MatchedContainer struct {
	Name    *string `json:"name,omitempty"`
	Reason  string  `json:"reason,omitempty"`
	Message string  `json:"message,omitempty"`
	Signal  int32   `json:"signal,omitempty"`
	Code    *int32  `json:"code,omitempty"`
}

Field name should be consistent with ContainerCompletionStatus

func (*MatchedContainer) DeepCopy added in v0.4.0

func (in *MatchedContainer) DeepCopy() *MatchedContainer

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchedContainer.

func (*MatchedContainer) DeepCopyInto added in v0.4.0

func (in *MatchedContainer) DeepCopyInto(out *MatchedContainer)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MatchedPod added in v0.4.0

type MatchedPod struct {
	Name       *string             `json:"name,omitempty"`
	Reason     string              `json:"reason,omitempty"`
	Message    string              `json:"message,omitempty"`
	Containers []*MatchedContainer `json:"containers,omitempty"`
}

Field name should be consistent with PodCompletionStatus

func (*MatchedPod) DeepCopy added in v0.4.0

func (in *MatchedPod) DeepCopy() *MatchedPod

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchedPod.

func (*MatchedPod) DeepCopyInto added in v0.4.0

func (in *MatchedPod) DeepCopyInto(out *MatchedPod)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ObjectSnapshotTrigger added in v0.9.0

type ObjectSnapshotTrigger string

type PodCompletionStatus added in v0.4.0

type PodCompletionStatus struct {
	Reason     string                       `json:"reason,omitempty"`
	Message    string                       `json:"message,omitempty"`
	Containers []*ContainerCompletionStatus `json:"containers,omitempty"`
}

func ExtractPodCompletionStatus added in v0.4.0

func ExtractPodCompletionStatus(pod *core.Pod) *PodCompletionStatus

func (*PodCompletionStatus) DeepCopy added in v0.4.0

func (in *PodCompletionStatus) DeepCopy() *PodCompletionStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCompletionStatus.

func (*PodCompletionStatus) DeepCopyInto added in v0.4.0

func (in *PodCompletionStatus) DeepCopyInto(out *PodCompletionStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodMatchResult added in v0.4.0

type PodMatchResult struct {
	// CodeInfo and its Code should be not nil
	CodeInfo    *CompletionCodeInfo
	Diagnostics string
}

///////////////////////////////////////////////////////////////////////////////////// CompletionCodeInfos Matching /////////////////////////////////////////////////////////////////////////////////////

func ClassifyPodCreationError added in v0.8.0

func ClassifyPodCreationError(apiErr error) PodMatchResult

The returned CompletionCode must be within CompletionCodeInfos.

func MatchCompletionCodeInfos added in v0.4.0

func MatchCompletionCodeInfos(pod *core.Pod) PodMatchResult

Match ANY CompletionCodeInfo The returned CompletionCode may not within CompletionCodeInfos, such as for the ContainerUnrecognizedFailed, so it should not be used to NewTaskAttemptCompletionStatus or NewFrameworkAttemptCompletionStatus later.

func (*PodMatchResult) DeepCopy added in v0.4.0

func (in *PodMatchResult) DeepCopy() *PodMatchResult

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodMatchResult.

func (*PodMatchResult) DeepCopyInto added in v0.4.0

func (in *PodMatchResult) DeepCopyInto(out *PodMatchResult)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodPattern added in v0.4.0

type PodPattern struct {
	NameRegex    Regex               `yaml:"nameRegex,omitempty"`
	ReasonRegex  Regex               `yaml:"reasonRegex,omitempty"`
	MessageRegex Regex               `yaml:"messageRegex,omitempty"`
	Containers   []*ContainerPattern `yaml:"containers,omitempty"`
}

Used to match against the corresponding fields in Pod object. ALL its fields are optional and default to match ANY. It is matched if and only if ALL its fields are matched.

func (*PodPattern) DeepCopy added in v0.4.0

func (in *PodPattern) DeepCopy() *PodPattern

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodPattern.

func (*PodPattern) DeepCopyInto added in v0.4.0

func (in *PodPattern) DeepCopyInto(out *PodPattern)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Regex added in v0.4.0

type Regex struct {
	*regexp.Regexp `yaml:",inline"`
}

Represent regex pattern string and nil indicates match ANY. See https://github.com/google/re2/wiki/Syntax

func NewRegex added in v0.4.0

func NewRegex(pattern string) Regex

func (*Regex) DeepCopy added in v0.4.0

func (in *Regex) DeepCopy() *Regex

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Regex.

func (*Regex) DeepCopyInto added in v0.4.0

func (re *Regex) DeepCopyInto(out *Regex)

Override generated code.

func (Regex) FindString added in v0.4.0

func (re Regex) FindString(s string) *string

func (Regex) IsZero added in v0.4.0

func (re Regex) IsZero() bool

func (Regex) MarshalYAML added in v0.4.0

func (re Regex) MarshalYAML() (interface{}, error)

func (*Regex) UnmarshalYAML added in v0.4.0

func (re *Regex) UnmarshalYAML(unmarshal func(interface{}) error) error

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:

  1. 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.
  2. 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 ExecutionType is ExecutionStop or the Task's FrameworkAttempt is completing or the Task is DeletionPending (ScaleDown),

will not retry.

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:

  1. 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 running at any point in time and at most one instance is exposed into ApiServer over time. So, the actual retried attempt instances may exceed the RetryPolicySpec in rare cases, however, the RetryPolicyStatus will never exceed the RetryPolicySpec.
  2. Resort to other spec to control other kind of RetryPolicy:
  3. 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,
	cs *CompletionStatus,
	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 not nil only if the retry has been scheduled but not yet executed, i.e.
	// current attempt is in AttemptCompleted state and is not the last attempt.
	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 Task added in v0.9.0

type Task struct {
	meta.TypeMeta `json:",inline"`
	// Enough information is provided in the Task's metadata to help locate its
	// corresponding Framework with the same ResourceVersion, and locate itself
	// in the Framework.
	// See MockTask.
	meta.ObjectMeta `json:"metadata"`
	// Task.Spec can be nil if and only if its TaskRole's TaskRoleSpec is deleted
	// while its TaskStatus still exist due to graceful deletion.
	Spec   *TaskSpec   `json:"spec"`
	Status *TaskStatus `json:"status"`
}

//////////////////////////////////////////////////////////////////////////////////////////////// Task All information of a Task is already embedded in its Framework object. So, the below Task object is not a real CRD, instead it is used to:

  1. Only expose a specific Task object instead of its whole Framework object. Such as LogObjectSnapshot for a specific Task when the Task will be retried.

//////////////////////////////////////////////////////////////////////////////////////////////// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Task) DeepCopy added in v0.9.0

func (in *Task) DeepCopy() *Task

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Task.

func (*Task) DeepCopyInto added in v0.9.0

func (in *Task) DeepCopyInto(out *Task)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Task) DeepCopyObject added in v0.9.0

func (in *Task) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TaskAttemptCompletionStatus added in v0.4.0

type TaskAttemptCompletionStatus struct {
	// Summary
	// Must be not nil for TaskAttemptCompleted and TaskCompleted Task.
	*CompletionStatus `json:",inline"`
	// Detail
	Pod *PodCompletionStatus `json:"pod,omitempty"`
}

func (*TaskAttemptCompletionStatus) DeepCopy added in v0.4.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskAttemptCompletionStatus.

func (*TaskAttemptCompletionStatus) DeepCopyInto added in v0.4.0

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"`
	RunTime        *meta.Time `json:"runTime"`
	CompletionTime *meta.Time `json:"completionTime"`

	// Current associated TaskAttemptInstance:
	// TaskAttemptInstanceUID = {TaskAttemptID}_{PodUID}
	// It is ordered by TaskAttemptID and can universally locate the
	// TaskAttemptInstance.
	// See RetryPolicySpec.
	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"`
	PodNodeName      *string                      `json:"podNodeName"`
	PodIP            *string                      `json:"podIP"`
	PodHostIP        *string                      `json:"podHostIP"`
	CompletionStatus *TaskAttemptCompletionStatus `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
	// It can only locate the TaskRole within a specific Framework, i.e. it cannot
	// universally locate the TaskRole and cannot locate the TaskRoleInstance even
	// within a specific Framework.
	Name string `json:"name"`

	// Current associated TaskRoleInstanceUID:
	// TaskRoleInstanceUID = {TaskRole.UID}
	// It is totally generated by FrameworkController to universally locate the
	// TaskRoleInstance.
	// One TaskRole may be associated with multiple instances over time, such as
	// due to ScaleDown and ScaleUp, however, at most one instance is associated
	// with the TaskRole at any point in time.
	InstanceUID types.UID `json:"instanceUID"`

	// Effective and Backup PodGracefulDeletionTimeoutSec:
	// It is the immediate backup of corresponding field in TaskRoleSpec.TaskSpec,
	// in case the TaskRoleSpec is directly deleted later while the TaskRole's
	// TaskRoleStatus still exist due to graceful deletion.
	PodGracefulDeletionTimeoutSec *int64 `json:"podGracefulDeletionTimeoutSec"`

	// Tasks with TaskIndex in range [0, TaskNumber)
	TaskStatuses []*TaskStatus `json:"taskStatuses"`
}

func (*TaskRoleStatus) CompletionTimeOrderedTaskStatus added in v0.7.0

func (trs *TaskRoleStatus) CompletionTimeOrderedTaskStatus(
	selector TaskStatusSelector, orderIndex int32) *TaskStatus

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) GetTaskCountStatus added in v0.7.0

func (trs *TaskRoleStatus) GetTaskCountStatus(selector TaskStatusSelector) int32

func (*TaskRoleStatus) GetTaskStatuses

func (trs *TaskRoleStatus) GetTaskStatuses(selector TaskStatusSelector) []*TaskStatus

type TaskSpec

type TaskSpec struct {
	RetryPolicy RetryPolicySpec `json:"retryPolicy"`

	// If the Task's current associated Pod object is being deleted, i.e. graceful
	// deletion, but the graceful deletion cannot finish within this timeout, then
	// the Pod will be deleted forcefully by FrameworkController.
	// Default to nil.
	//
	// If this timeout is not nil, the Pod may be deleted forcefully by FrameworkController.
	// The force deletion does not wait for confirmation that the Pod has been terminated
	// totally, and then the Task will be immediately transitioned to TaskAttemptCompleted.
	// As a consequence, the Task will be immediately completed or retried with another
	// new Pod, however the old Pod may be still running.
	// So, in this setting, the Task behaves like ReplicaSet, and choose it if the Task
	// favors availability over consistency, such as stateless Task.
	// However, to still best effort execute graceful deletion with the toleration for
	// transient deletion failures, this timeout should be at least longer than the Pod
	// TerminationGracePeriodSeconds + minimal TolerationSeconds for TaintBasedEvictions.
	//
	// If this timeout is nil, the Pod will always be deleted gracefully, i.e. never
	// be deleted forcefully by FrameworkController. This helps to guarantee at most
	// one instance of a specific Task is running at any point in time.
	// So, in this setting, the Task behaves like StatefulSet, and choose it if the Task
	// favors consistency over availability, such as stateful Task.
	PodGracefulDeletionTimeoutSec *int64               `json:"podGracefulDeletionTimeoutSec"`
	Pod                           core.PodTemplateSpec `json:"pod"`
}

func (*TaskSpec) DeepCopy

func (in *TaskSpec) DeepCopy() *TaskSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec.

func (*TaskSpec) DeepCopyInto

func (in *TaskSpec) DeepCopyInto(out *TaskSpec)

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
	// may not have been creation requested successfully and is expected to exist.
	// [StartState]
	// [AttemptStartState]
	// -> TaskAttemptCreationRequested
	// -> TaskAttemptCompleted
	TaskAttemptCreationPending TaskState = "AttemptCreationPending"

	// Pod does not exist and
	// must have been creation requested successfully and is expected to exist.
	// [AssociatedState]
	// -> TaskAttemptPreparing
	// -> TaskAttemptDeleting
	// -> TaskAttemptCompleted
	TaskAttemptCreationRequested TaskState = "AttemptCreationRequested"

	// Pod exists and is not deleting and
	// may not have been deletion requested successfully and
	// its PodPhase is PodPending or PodUnknown afterwards.
	// [AssociatedState]
	// -> TaskAttemptRunning
	// -> TaskAttemptDeletionPending
	// -> TaskAttemptDeleting
	// -> TaskAttemptCompleted
	TaskAttemptPreparing TaskState = "AttemptPreparing"

	// Pod exists and is not deleting and
	// may not have been deletion requested successfully and
	// its PodPhase is PodRunning or PodUnknown afterwards.
	// [AssociatedState]
	// -> TaskAttemptDeletionPending
	// -> TaskAttemptDeleting
	// -> TaskAttemptCompleted
	TaskAttemptRunning TaskState = "AttemptRunning"

	// Pod exists and is not deleting and
	// may not have been deletion requested successfully and
	// its PodPhase is PodSucceeded or PodFailed.
	// [AssociatedState]
	// -> TaskAttemptDeletionRequested
	// -> TaskAttemptDeleting
	// -> TaskAttemptCompleted
	TaskAttemptDeletionPending TaskState = "AttemptDeletionPending"

	// Pod exists and is not deleting and
	// must have been deletion requested successfully.
	// [AssociatedState]
	// -> TaskAttemptDeleting
	// -> TaskAttemptCompleted
	TaskAttemptDeletionRequested TaskState = "AttemptDeletionRequested"

	// Pod exists and is deleting.
	// [AssociatedState]
	// -> TaskAttemptCompleted
	TaskAttemptDeleting TaskState = "AttemptDeleting"

	// Pod does not exist and
	// is not expected to exist and will never exist and
	// current attempt is not the last attempt or to be determined.
	// [AttemptFinalState]
	// -> TaskAttemptCreationPending
	// -> TaskCompleted
	TaskAttemptCompleted TaskState = "AttemptCompleted"

	// Pod does not exist and
	// is not expected to exist and will never exist and
	// current attempt is the last attempt.
	// [FinalState]
	TaskCompleted TaskState = "Completed"
)

type TaskStatus

type TaskStatus struct {
	// TaskIndex = The Task array index within its TaskRole.
	// It can only locate the Task within a specific TaskRole, i.e. it cannot
	// universally locate the Task and cannot locate the TaskInstance even within
	// a specific Task.
	Index int32 `json:"index"`

	// Current associated TaskInstance:
	// TaskInstanceUID = {Task.UID}
	// It is totally generated by FrameworkController to universally locate the
	// TaskInstance.
	// One Task may be associated with multiple instances over time, such as due to
	// ScaleDown and ScaleUp, however, at most one instance is associated with the
	// Task at any point in time.
	InstanceUID types.UID `json:"instanceUID"`

	StartTime      meta.Time  `json:"startTime"`
	RunTime        *meta.Time `json:"runTime"`
	CompletionTime *meta.Time `json:"completionTime"`
	State          TaskState  `json:"state"`
	TransitionTime meta.Time  `json:"transitionTime"`

	// Task DeletionPending is caused by Framework ScaleDown.
	// If a Task is DeletionPending, it is logically detached from its Framework
	// immediately, and will be proactively but still gracefully completed and
	// finally deleted.
	DeletionPending   bool              `json:"deletionPending"`
	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(ignoreDeletionPending bool) bool

func (*TaskStatus) IsCompleting added in v0.4.0

func (ts *TaskStatus) IsCompleting(ignoreDeletionPending bool) bool

func (*TaskStatus) IsDeletionPendingIgnored added in v0.7.0

func (ts *TaskStatus) IsDeletionPendingIgnored(ignoreDeletionPending bool) bool

func (*TaskStatus) IsFailed

func (ts *TaskStatus) IsFailed(ignoreDeletionPending bool) bool

func (*TaskStatus) IsRunning added in v0.4.0

func (ts *TaskStatus) IsRunning(ignoreDeletionPending bool) bool

func (*TaskStatus) IsSucceeded

func (ts *TaskStatus) IsSucceeded(ignoreDeletionPending bool) bool

func (*TaskStatus) MarkAsDeletionPending added in v0.7.0

func (ts *TaskStatus) MarkAsDeletionPending() (isNewDeletionPendingTask 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 *TaskStatus) bool

///////////////////////////////////////////////////////////////////////////////////// Interfaces /////////////////////////////////////////////////////////////////////////////////////

func BindIDP added in v0.7.0

func BindIDP(
	selectorIDP TaskStatusSelectorIDP,
	ignoreDeletionPending bool) TaskStatusSelector

type TaskStatusSelectorIDP added in v0.7.0

type TaskStatusSelectorIDP func(taskStatus *TaskStatus, ignoreDeletionPending bool) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL