Documentation
¶
Index ¶
- Constants
- func HasLauncherTarget(spec *burninv1alpha1.WorkloadSpec) bool
- func SetImagePullSecrets(trainJobSpec *trainerv1alpha1.TrainJobSpec, ...)
- type Adapter
- type TrainJobAdapter
- func (a *TrainJobAdapter) Build(name, namespace string, spec *burninv1alpha1.WorkloadSpec) (client.Object, error)
- func (a *TrainJobAdapter) GVK() schema.GroupVersionKind
- func (a *TrainJobAdapter) GetStatus(obj client.Object) (*WorkloadStatus, error)
- func (a *TrainJobAdapter) InjectPodLabel(spec *burninv1alpha1.WorkloadSpec, key, value string)
- func (a *TrainJobAdapter) NewObject() client.Object
- func (a *TrainJobAdapter) NodesRequired(spec *burninv1alpha1.WorkloadSpec) (int, error)
- func (a *TrainJobAdapter) SetNodeAffinity(spec *burninv1alpha1.WorkloadSpec, affinity *corev1.NodeAffinity)
- func (a *TrainJobAdapter) SetNodeSelector(spec *burninv1alpha1.WorkloadSpec, selector map[string]string)
- func (a *TrainJobAdapter) SetNumNodes(spec *burninv1alpha1.WorkloadSpec, numNodes int)
- func (a *TrainJobAdapter) SetTolerations(spec *burninv1alpha1.WorkloadSpec, tolerations []corev1.Toleration)
- type WorkloadPhase
- type WorkloadStatus
Constants ¶
View Source
const ( // RuntimePatchManager is the manager key for CRE controller-owned RuntimePatches. RuntimePatchManager = "cre.nvidia.com/controller" LauncherJobName = "launcher" NodeJobName = "node" )
Variables ¶
This section is empty.
Functions ¶
func HasLauncherTarget ¶
func HasLauncherTarget(spec *burninv1alpha1.WorkloadSpec) bool
HasLauncherTarget reports whether the workload spec contains an MPI launcher target in its runtimePatches. Used by the workflow controller to decide whether to apply global tolerations (only MPI workloads need them).
func SetImagePullSecrets ¶
func SetImagePullSecrets(trainJobSpec *trainerv1alpha1.TrainJobSpec, secrets []corev1.LocalObjectReference)
SetImagePullSecrets applies imagePullSecrets to the worker replicated job via RuntimePatches.
Types ¶
type Adapter ¶
type Adapter interface {
// GVK returns the GroupVersionKind of the workload type.
GVK() schema.GroupVersionKind
// NewObject returns a new empty typed object (for Get/Delete).
NewObject() client.Object
// Build creates a fully typed workload object from the WorkloadSpec.
// The name and namespace are set on the returned object.
Build(name, namespace string, spec *burninv1alpha1.WorkloadSpec) (client.Object, error)
// InjectPodLabel ensures the given label reaches pod templates.
// Mutates spec in-place — call on a DeepCopy before Build.
InjectPodLabel(spec *burninv1alpha1.WorkloadSpec, key, value string)
// SetNodeSelector sets nodeSelector on the workload's pod templates.
// Mutates spec in-place — call on a DeepCopy before Build.
SetNodeSelector(spec *burninv1alpha1.WorkloadSpec, selector map[string]string)
// SetNodeAffinity sets node affinity on the workload's pod templates.
// Mutates spec in-place — call on a DeepCopy before Build.
SetNodeAffinity(spec *burninv1alpha1.WorkloadSpec, affinity *corev1.NodeAffinity)
// SetTolerations appends tolerations to the workload's pod templates.
// Mutates spec in-place — call on a DeepCopy before Build.
SetTolerations(spec *burninv1alpha1.WorkloadSpec, tolerations []corev1.Toleration)
// NodesRequired returns the number of nodes required by the workload spec.
// This is auto-detected from the replica count in the workload definition.
NodesRequired(spec *burninv1alpha1.WorkloadSpec) (int, error)
// SetNumNodes overrides the number of nodes/replicas in the workload spec.
// Used by bisection to match the workload's node count to the group size,
// which changes each round. Mutates spec in-place.
SetNumNodes(spec *burninv1alpha1.WorkloadSpec, numNodes int)
// GetStatus reads typed status conditions and returns a normalized WorkloadStatus.
GetStatus(obj client.Object) (*WorkloadStatus, error)
}
Adapter provides a typed interface for creating and inspecting workloads.
func ForSpec ¶
func ForSpec(spec *burninv1alpha1.WorkloadSpec) (Adapter, error)
ForSpec returns the appropriate Adapter for the given WorkloadSpec.
type TrainJobAdapter ¶
type TrainJobAdapter struct{}
TrainJobAdapter implements Adapter for Kubeflow TrainJob.
func (*TrainJobAdapter) Build ¶
func (a *TrainJobAdapter) Build(name, namespace string, spec *burninv1alpha1.WorkloadSpec) (client.Object, error)
func (*TrainJobAdapter) GVK ¶
func (a *TrainJobAdapter) GVK() schema.GroupVersionKind
func (*TrainJobAdapter) GetStatus ¶
func (a *TrainJobAdapter) GetStatus(obj client.Object) (*WorkloadStatus, error)
func (*TrainJobAdapter) InjectPodLabel ¶
func (a *TrainJobAdapter) InjectPodLabel(spec *burninv1alpha1.WorkloadSpec, key, value string)
func (*TrainJobAdapter) NewObject ¶
func (a *TrainJobAdapter) NewObject() client.Object
func (*TrainJobAdapter) NodesRequired ¶
func (a *TrainJobAdapter) NodesRequired(spec *burninv1alpha1.WorkloadSpec) (int, error)
func (*TrainJobAdapter) SetNodeAffinity ¶
func (a *TrainJobAdapter) SetNodeAffinity(spec *burninv1alpha1.WorkloadSpec, affinity *corev1.NodeAffinity)
func (*TrainJobAdapter) SetNodeSelector ¶
func (a *TrainJobAdapter) SetNodeSelector(spec *burninv1alpha1.WorkloadSpec, selector map[string]string)
func (*TrainJobAdapter) SetNumNodes ¶
func (a *TrainJobAdapter) SetNumNodes(spec *burninv1alpha1.WorkloadSpec, numNodes int)
func (*TrainJobAdapter) SetTolerations ¶
func (a *TrainJobAdapter) SetTolerations(spec *burninv1alpha1.WorkloadSpec, tolerations []corev1.Toleration)
type WorkloadPhase ¶
type WorkloadPhase string
WorkloadPhase represents the normalized phase of a workload.
const ( WorkloadRunning WorkloadPhase = "Running" WorkloadSucceeded WorkloadPhase = "Succeeded" WorkloadFailed WorkloadPhase = "Failed" )
type WorkloadStatus ¶
type WorkloadStatus struct {
Phase WorkloadPhase
Reason string
Message string
}
WorkloadStatus is the normalized status returned by adapters.
Click to show internal directories.
Click to hide internal directories.