Documentation
¶
Index ¶
- Constants
- func EnsureLauncherTarget(trainJobSpec *trainerv1alpha1.TrainJobSpec)
- func HasLauncherTarget(spec *nvcrev1alpha1.WorkloadSpec) bool
- func SetImagePullSecrets(trainJobSpec *trainerv1alpha1.TrainJobSpec, ...)
- type Adapter
- type TrainJobAdapter
- func (a *TrainJobAdapter) Build(name, namespace string, spec *nvcrev1alpha1.WorkloadSpec) (client.Object, error)
- func (a *TrainJobAdapter) GVK() schema.GroupVersionKind
- func (a *TrainJobAdapter) GetStatus(obj client.Object) (*WorkloadStatus, error)
- func (a *TrainJobAdapter) InjectPodLabel(spec *nvcrev1alpha1.WorkloadSpec, key, value string)
- func (a *TrainJobAdapter) NewObject() client.Object
- func (a *TrainJobAdapter) NodesRequired(spec *nvcrev1alpha1.WorkloadSpec) (int, error)
- func (a *TrainJobAdapter) SetNodeAffinity(spec *nvcrev1alpha1.WorkloadSpec, affinity *corev1.NodeAffinity)
- func (a *TrainJobAdapter) SetNodeSelector(spec *nvcrev1alpha1.WorkloadSpec, selector map[string]string)
- func (a *TrainJobAdapter) SetNumNodes(spec *nvcrev1alpha1.WorkloadSpec, numNodes int)
- func (a *TrainJobAdapter) SetTolerations(spec *nvcrev1alpha1.WorkloadSpec, tolerations []corev1.Toleration)
- type WorkloadPhase
- type WorkloadStatus
Constants ¶
const ( // RuntimePatchManager is the manager key for NVCRE controller-owned RuntimePatches. RuntimePatchManager = "nvcre.nvidia.com/controller" LauncherJobName = "launcher" NodeJobName = "node" )
Variables ¶
This section is empty.
Functions ¶
func EnsureLauncherTarget ¶
func EnsureLauncherTarget(trainJobSpec *trainerv1alpha1.TrainJobSpec)
EnsureLauncherTarget registers the worker and launcher replicated jobs in the controller-owned RuntimePatch. SetNodeAffinity and SetTolerations derive their targets from existing runtimePatches (allTargetJobs), and the Workflow controller's blanket MPI toleration is gated on HasLauncherTarget — so an MPI TrainJob without a launcher entry gets its launcher pod scheduled with no node pinning and no tolerations. Catalog MPI entries satisfy this contract with an explicit bare `- name: launcher` runtimePatch entry; MPI WorkloadRuns build their TrainJob programmatically and must register the launcher here. The bare entries are a no-op for the trainer's patch merge.
func HasLauncherTarget ¶
func HasLauncherTarget(spec *nvcrev1alpha1.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 *nvcrev1alpha1.WorkloadSpec) (client.Object, error)
// InjectPodLabel ensures the given label reaches pod templates.
// Mutates spec in-place — call on a DeepCopy before Build.
InjectPodLabel(spec *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.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 *nvcrev1alpha1.WorkloadSpec, key, value string)
func (*TrainJobAdapter) NewObject ¶
func (a *TrainJobAdapter) NewObject() client.Object
func (*TrainJobAdapter) NodesRequired ¶
func (a *TrainJobAdapter) NodesRequired(spec *nvcrev1alpha1.WorkloadSpec) (int, error)
func (*TrainJobAdapter) SetNodeAffinity ¶
func (a *TrainJobAdapter) SetNodeAffinity(spec *nvcrev1alpha1.WorkloadSpec, affinity *corev1.NodeAffinity)
func (*TrainJobAdapter) SetNodeSelector ¶
func (a *TrainJobAdapter) SetNodeSelector(spec *nvcrev1alpha1.WorkloadSpec, selector map[string]string)
func (*TrainJobAdapter) SetNumNodes ¶
func (a *TrainJobAdapter) SetNumNodes(spec *nvcrev1alpha1.WorkloadSpec, numNodes int)
func (*TrainJobAdapter) SetTolerations ¶
func (a *TrainJobAdapter) SetTolerations(spec *nvcrev1alpha1.WorkloadSpec, tolerations []corev1.Toleration)
type WorkloadPhase ¶
type WorkloadPhase string
WorkloadPhase represents the normalized phase of a workload.
const ( // WorkloadPending means the workload resource exists but has not started // running — for example a TrainJob suspended by an admission controller // such as Kueue while it waits for quota. Controllers must not count // pending time against job timeouts or stall detection, and must not // attribute node failures while a workload is pending. WorkloadPending WorkloadPhase = "Pending" 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.