common

package
v0.0.0-...-05758ac Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAIMasterAddrEnv

func AddAIMasterAddrEnv(template *corev1.PodTemplateSpec, addr string)

func GetAIMasterPodSpec

func GetAIMasterPodSpec(
	spec apicommon.AIMasterSpec,
	jobName, jobType, namespace string,
	community,
	kubeflow bool) *corev1.PodTemplateSpec

Types

type ControllerInterface

type ControllerInterface interface {
	// GetNativeJob returns the native job object, or nil if not found.
	GetNativeJob(context.Context, types.NamespacedName) (interface{}, error)
	// GetAIMasterPodSpec tries to find AIMaster pod spec from the job's replicas spec.
	GetAIMasterPodSpec(interface{}) *corev1.PodTemplateSpec
	// PreprocessJobSpec updates the job object for enabling some feature gates.
	PreprocessJobSpec(context.Context, interface{}) (bool, error)
	// ReconcileNativeJob reconciles the native job object.
	ReconcileNativeJob(context.Context, interface{}, interface{}, string, *common.JobStatus, logr.Logger) error
	// DeleteJob deletes the job object.
	DeleteJob(context.Context, interface{}) error
	// RemoveNativeJobFinalizer removes the finalizer from the native job object.
	RemoveNativeJobFinalizer(context.Context, interface{}) error
	// UpdateStatus updates the Status of the job object.
	UpdateStatus(context.Context, interface{}, *common.JobStatus) error
	// GenLabels generates the labels that the native job operator adds to the pods.
	GenLabels(string) map[string]string
	// GetDefaultContainerName returns the default container name for the specific job CRD.
	GetDefaultContainerName() string
	// GetDefaultContainerPortName returns the default container port name for the specific job CRD.
	GetDefaultContainerPortName() string
	// GetDefaultPort returns the default port for the specific job CRD.
	GetDefaultPort() int32
}

ControllerInterface encapsulates methods for reconciling different job CRDs, which are invoked by the common JobController and should be implemented by the Reconcilers in controllers/xxx_controller.go.

type GangScheduler

type GangScheduler string

type JobController

type JobController struct {
	client.Client
	Scheme     *runtime.Scheme
	Log        logr.Logger
	Recorder   record.EventRecorder
	Controller ControllerInterface
	Config     JobControllerConfiguration
}

func (*JobController) ReconcileJob

func (c *JobController) ReconcileJob(
	ctx context.Context,
	job client.Object,
	status *common.JobStatus,
	logger logr.Logger) error

ReconcileJob reconciles job objects, AIMaster pods and services, and native job objects.

func (*JobController) RemovePodsFinalizers

func (c *JobController) RemovePodsFinalizers(ctx context.Context, namespacedName types.NamespacedName) error

type JobControllerConfiguration

type JobControllerConfiguration struct {
	// Enable gang scheduling by volcano
	EnableGangScheduling bool
}

Jump to

Keyboard shortcuts

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