v1alpha1

package
v0.0.0-...-436e495 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +groupName=fedlearner.k8s.io

Index

Constants

View Source
const (
	DefaultNonPairReplica int32 = 0
	DefaultPairReplica    int32 = 1
	DefaultBackoffLimit   int32 = 5
	DefaultPort           int32 = 8888
)
View Source
const (
	// GroupName is the group name use in this package.
	GroupName = "fedlearner.k8s.io"
	// GroupVersion is the version.
	GroupVersion = "v1alpha1"
	// Kind is the kind name.
	Kind = "FLApp"
	// Plural is the Plural for FLApp.
	Plural = "flapps"
	// Singular is the singular for FLApp.
	Singular = "flapp"
)
View Source
const (
	DefaultContainerName = "tensorflow"
	DefaultPortName      = "flapp-port"
	ChiefWorkerIndex     = "0"
)

Variables

View Source
var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}
	// SchemeGroupVersionKind is the GroupVersionKind of the resource.
	SchemeGroupVersionKind = SchemeGroupVersion.WithKind(Kind)
)
View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultFuncs)
	AddToScheme   = SchemeBuilder.AddToScheme
)

Functions

func GroupKind

func GroupKind(kind string) schema.GroupKind

GroupKind takes an unqualified kind and returns back a Group qualified GroupKind

func RegisterDefaults

func RegisterDefaults(scheme *runtime.Scheme) error

RegisterDefaults adds defaulters functions to the given scheme. Public to allow building arbitrary schemes. All generated defaulters are covering - they call all nested defaulters.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func SetDefaultStatus

func SetDefaultStatus(app *FLApp)

func SetDefaults_FLApp

func SetDefaults_FLApp(app *FLApp)

func SetObjectDefaults_FLApp

func SetObjectDefaults_FLApp(in *FLApp)

func SetObjectDefaults_FLAppList

func SetObjectDefaults_FLAppList(in *FLAppList)

Types

type CleanPodPolicy

type CleanPodPolicy string

CleanPodPolicy describes how to deal with pods when the job is finished.

const (
	CleanPodPolicyAll  CleanPodPolicy = "All"
	CleanPodPolicyNone CleanPodPolicy = "None"
)

type FLApp

type FLApp struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec is the spec for FLApp
	// +optional
	Spec FLAppSpec `json:"spec"`
	// Status is the status for FLApp
	// +optional
	Status FLAppStatus `json:"status"`
}

FLApp is a specification for a FLApp resource

func (*FLApp) DeepCopy

func (in *FLApp) DeepCopy() *FLApp

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

func (*FLApp) DeepCopyInto

func (in *FLApp) DeepCopyInto(out *FLApp)

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

func (*FLApp) DeepCopyObject

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

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

type FLAppList

type FLAppList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []FLApp `json:"items"`
}

FLAppList is a list of FLApp resources

func (*FLAppList) DeepCopy

func (in *FLAppList) DeepCopy() *FLAppList

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

func (*FLAppList) DeepCopyInto

func (in *FLAppList) DeepCopyInto(out *FLAppList)

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

func (*FLAppList) DeepCopyObject

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

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

type FLAppSpec

type FLAppSpec struct {
	// Specifies the duration (in seconds) since startTime during which the job can remain active
	// before it is terminated. Must be a positive integer.
	// This setting applies only to pods where restartPolicy is OnFailure or Always.
	// +optional
	// Defaults to infinite
	ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`

	// Number of retries before marking this job as failed.
	// +optional
	// Defaults to 5.
	BackoffLimit *int32 `json:"backoffLimit,omitempty"`

	// Defines the policy for cleaning up pods after the FLApp completes.
	// +optional
	// Defaults to All.
	CleanPodPolicy *CleanPodPolicy `json:"cleanPodPolicy,omitempty"`

	// Defines the TTL for cleaning up finished FLApps (temporary
	// before kubernetes adds the cleanup controller).
	// It may take extra ReconcilePeriod seconds for the cleanup, since
	// reconcile gets called periodically.
	// +optional
	// Defaults to infinite.
	// TODO: CompletionTime is required for this field
	TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"`

	// Defines replica spec for replica type
	FLReplicaSpecs FLReplicaSpecs `json:"flReplicaSpecs"`

	// Defines the role of FLApp
	// +kubebuilder:validation:Pattern=(^Leader$)|(^Follower\d*$)
	Role string `json:"role"`

	// Defines all the controllers involved in the app
	PeerSpecs PeerSpecs `json:"peerSpecs"`

	// IngressSpec defines the ingress created by controller
	// +optional
	IngressSpec *IngressSpec `json:"ingressSpec,omitempty"`
}

FLAppSpec is the spec for a FLAppSpec resource

func (*FLAppSpec) DeepCopy

func (in *FLAppSpec) DeepCopy() *FLAppSpec

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

func (*FLAppSpec) DeepCopyInto

func (in *FLAppSpec) DeepCopyInto(out *FLAppSpec)

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

type FLAppStatus

type FLAppStatus struct {
	// FLState is the current state of the entire job
	// Defaults to New.
	AppState FLState `json:"appState"`
	// A map of FLReplicaType to FLReplicaStatus
	FLReplicaStatus FLReplicaStatus `json:"flReplicaStatus"`
	// Represents time when the job was completed. It is not guaranteed to
	// be set in happens-before order across separate operations.
	// It is represented in RFC3339 form and is in UTC.
	// +nullable
	CompletionTime *metav1.Time `json:"completionTime"`
}

FLAppStatus is the status for a FLApp resource

func (*FLAppStatus) DeepCopy

func (in *FLAppStatus) DeepCopy() *FLAppStatus

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

func (*FLAppStatus) DeepCopyInto

func (in *FLAppStatus) DeepCopyInto(out *FLAppStatus)

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

type FLReplicaSpecs

type FLReplicaSpecs map[FLReplicaType]ReplicaSpec

FLReplicaSpecs is the mapping from FLReplicaType to ReplicaSpec

func (FLReplicaSpecs) DeepCopy

func (in FLReplicaSpecs) DeepCopy() FLReplicaSpecs

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

func (FLReplicaSpecs) DeepCopyInto

func (in FLReplicaSpecs) DeepCopyInto(out *FLReplicaSpecs)

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

type FLReplicaStatus

type FLReplicaStatus map[FLReplicaType]ReplicaStatus

FLReplicaStatus describe FLReplicaStatus for each FLReplicaType

func (FLReplicaStatus) DeepCopy

func (in FLReplicaStatus) DeepCopy() FLReplicaStatus

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

func (FLReplicaStatus) DeepCopyInto

func (in FLReplicaStatus) DeepCopyInto(out *FLReplicaStatus)

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

type FLReplicaType

type FLReplicaType string

FLReplicaType can be one of: "Master", "Worker", or "PS".

const (
	// FLReplicaTypePS is the type for parameter servers of distributed TensorFlow.
	FLReplicaTypePS FLReplicaType = "PS"
	// FLReplicaTypeMaster is the type for master worker of distributed TensorFlow.
	FLReplicaTypeMaster FLReplicaType = "Master"
	// FLReplicaTypeWorker is the type for workers of distributed TensorFlow.
	FLReplicaTypeWorker FLReplicaType = "Worker"
	// FLReplicaTypeChief is the type for chief worker of distributed TensorFlow.
	FLReplicaTypeChief FLReplicaType = "Chief"
)

type FLState

type FLState string

FLState describes the current state of FLApp

const (
	FLStateNew          FLState = "FLStateNew"
	FLStateBootstrapped FLState = "FLStateBootstrapped"
	FLStateSyncSent     FLState = "FLStateSyncSent"
	FLStateRunning      FLState = "FLStateRunning"
	FLStateComplete     FLState = "FLStateComplete"
	FLStateFailing      FLState = "FLStateFailing"
	FLStateShutDown     FLState = "FLStateShutDown"
	FLStateFailed       FLState = "FLStateFailed"
)

type IngressSpec

type IngressSpec struct {
	// ExtraHostSuffix is the suffix appended to FLApp hostname
	ExtraHostSuffix string `json:"extraHostSuffix"`

	// ClientAuthSecretName is the name for Ingress client-auth
	ClientAuthSecretName string `json:"clientAuthSecretName"`

	// secretName is the name for Ingress TLS secrets
	SecretName string `json:"secretName"`

	// IngressClassName is the Ingress-class name
	IngressClassName string `json:"ingressClassName"`
}

IngressSpec is the description for a FLApp ingress

func (*IngressSpec) DeepCopy

func (in *IngressSpec) DeepCopy() *IngressSpec

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

func (*IngressSpec) DeepCopyInto

func (in *IngressSpec) DeepCopyInto(out *IngressSpec)

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

type PeerSpec

type PeerSpec struct {
	// PeerURL is the url of the involved controller
	PeerURL string `json:"peerURL"`
	// Authority is the GRPC Authority in the request
	// +optional
	Authority string `json:"authority,omitempty"`
	// The extra GRPC header in the request
	// +optional
	ExtraHeaders map[string]string `json:"extraHeaders,omitempty"`
}

PeerSpec is a description of a involved controller in the app

func (*PeerSpec) DeepCopy

func (in *PeerSpec) DeepCopy() *PeerSpec

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

func (*PeerSpec) DeepCopyInto

func (in *PeerSpec) DeepCopyInto(out *PeerSpec)

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

type PeerSpecs

type PeerSpecs map[string]PeerSpec

PeerSpecs is the mapping from Role to PeerSpec

func (PeerSpecs) DeepCopy

func (in PeerSpecs) DeepCopy() PeerSpecs

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

func (PeerSpecs) DeepCopyInto

func (in PeerSpecs) DeepCopyInto(out *PeerSpecs)

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

type ReplicaSpec

type ReplicaSpec struct {
	// Replicas is the desired number of replicas of the given template.
	// +optional
	// Defaults to 0.
	Replicas *int32 `json:"replicas,omitempty"`
	// Pair, when set to true, controller will try to pair it with peer controller.
	// +optional
	// Defaults to false.
	Pair *bool `json:"pair,omitempty"`
	// Template is the object that describes the pod that
	// will be created for this replica.
	Template v1.PodTemplateSpec `json:"template,omitempty"`
	// Restart policy for all replicas within the app.
	// One of Always, OnFailure, Never and ExitCode.
	// Default to OnFailure.
	RestartPolicy RestartPolicy `json:"restartPolicy,omitempty"`

	// ChiefResources describes the resource requirements of worker0.
	// +optional
	// Default to nil.
	ChiefResources *v1.ResourceRequirements `json:"chiefResources,omitempty"`
}

ReplicaSpec is a description of the replica

func (*ReplicaSpec) DeepCopy

func (in *ReplicaSpec) DeepCopy() *ReplicaSpec

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

func (*ReplicaSpec) DeepCopyInto

func (in *ReplicaSpec) DeepCopyInto(out *ReplicaSpec)

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

type ReplicaStatus

type ReplicaStatus struct {
	// Local is the set of ID allocated locally
	Local sets.String `json:"local"`

	// Remote is the set of ID allocated from the peer side
	Remote sets.String `json:"remote"`

	// Mapping is the mapping from a local ID to remote ID
	Mapping map[string]string `json:"mapping"`

	// The actively running pods.
	Active sets.String `json:"active"`

	// The pods which reached phase Succeeded.
	Succeeded sets.String `json:"succeeded"`

	// The pods which reached phase Failed.
	Failed sets.String `json:"failed"`
}

ReplicaStatus is a description of pairing status

func (*ReplicaStatus) DeepCopy

func (in *ReplicaStatus) DeepCopy() *ReplicaStatus

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

func (*ReplicaStatus) DeepCopyInto

func (in *ReplicaStatus) DeepCopyInto(out *ReplicaStatus)

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

type RestartPolicy

type RestartPolicy string

RestartPolicy describes how the replicas should be restarted. Only one of the following restart policies may be specified. If none of the following policies is specified, the default one is RestartPolicyOnFailure.

const (
	RestartPolicyAlways    RestartPolicy = "Always"
	RestartPolicyOnFailure RestartPolicy = "OnFailure"
	RestartPolicyNever     RestartPolicy = "Never"
	// RestartPolicyExitCode policy means that user should add exit code by themselves,
	// The controller will check these exit codes to
	// determine the behavior when an error occurs:
	// - 1-127: permanent error, do not restart.
	// - 128-255: retryable error, will restart the pod.
	RestartPolicyExitCode RestartPolicy = "ExitCode"
)

Jump to

Keyboard shortcuts

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