ctrls

package
v0.0.0-...-b4f3a91 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PV           *Resource
	PVC          *Resource
	Node         *Resource
	Secret       *Resource
	Event        *Resource
	Service      *Resource
	SampleSet    *Resource
	SampleJob    *Resource
	PaddleJob    *Resource
	StatefulSet  *Resource
	RuntimePod   *Resource
	SourceSecret *Resource

	RmrJob    *JobType
	ClearJob  *JobType
	SyncJob   *JobType
	WarmupJob *JobType
	Terminate *JobType

	JobTypeMap map[v1alpha1.SampleJobType]*JobType
)

Functions

func AllBaseUris

func AllBaseUris(c *Controller) ([]string, error)

func ClearCreateOptions

func ClearCreateOptions(c *Controller, opt interface{}, ctx *common.RequestContext) error

func ClearOptions

func ClearOptions() interface{}

func EventIndexerFunc

func EventIndexerFunc(obj client.Object) []string

func EventListOptions

func EventListOptions(c *Controller) []client.ListOption

func FirstBaseUri

func FirstBaseUri(c *Controller) ([]string, error)

func GetSampleJobFinalizer

func GetSampleJobFinalizer(name string) string

func GetSampleSetFinalizer

func GetSampleSetFinalizer(name string) string

func NameObjectKey

func NameObjectKey(c *Controller) client.ObjectKey

func NamespacedObjectKey

func NamespacedObjectKey(c *Controller) client.ObjectKey

func NodeListOptions

func NodeListOptions(c *Controller) []client.ListOption

func PVCCreateObject

func PVCCreateObject(c *Controller, object client.Object, ctx *common.RequestContext) error

func PVCObject

func PVCObject() client.Object

func PVCreateObject

func PVCreateObject(c *Controller, object client.Object, ctx *common.RequestContext) error

func PVObject

func PVObject() client.Object

func PaddleJobIndexerFunc

func PaddleJobIndexerFunc(obj client.Object) []string

func PaddleJobListOptions

func PaddleJobListOptions(c *Controller) []client.ListOption

func RmrCreateOptions

func RmrCreateOptions(c *Controller, opt interface{}, ctx *common.RequestContext) error

func RmrOptions

func RmrOptions() interface{}

func RuntimePodIndexerFunc

func RuntimePodIndexerFunc(obj client.Object) []string

func RuntimePodListOptions

func RuntimePodListOptions(c *Controller) []client.ListOption

func SampleJobObject

func SampleJobObject() client.Object

func SampleJobObjectKey

func SampleJobObjectKey(c *Controller) client.ObjectKey

func SampleSetObject

func SampleSetObject() client.Object

func SecretObject

func SecretObject() client.Object

func SecretObjectKey

func SecretObjectKey(c *Controller) client.ObjectKey

func ServiceCreateObject

func ServiceCreateObject(c *Controller, object client.Object, ctx *common.RequestContext) error

func ServiceObject

func ServiceObject() client.Object

func ServiceObjectKey

func ServiceObjectKey(c *Controller) client.ObjectKey

func SourceSecretObjectKey

func SourceSecretObjectKey(c *Controller) client.ObjectKey

func StatefulSetCreateObject

func StatefulSetCreateObject(c *Controller, object client.Object, ctx *common.RequestContext) error

func StatefulSetObject

func StatefulSetObject() client.Object

func StatefulSetObjectKey

func StatefulSetObjectKey(c *Controller) client.ObjectKey

func SyncCreateOptions

func SyncCreateOptions(c *Controller, opt interface{}, ctx *common.RequestContext) error

func SyncOptions

func SyncOptions() interface{}

func TerminateCreateOptions

func TerminateCreateOptions(c *Controller, opt interface{}, ctx *common.RequestContext) error

func TerminateOptions

func TerminateOptions() interface{}

func WarmupCreateOptions

func WarmupCreateOptions(c *Controller, opt interface{}, ctx *common.RequestContext) error

func WarmupOptions

func WarmupOptions() interface{}

Types

type Controller

type Controller struct {
	driver.Driver
	Sample client.Object
	*common.ReconcileContext
}

func (*Controller) CollectCacheStatus

func (c *Controller) CollectCacheStatus(podNames []string) (*v1alpha1.CacheStatus, error)

func (*Controller) CollectCacheStatusByIndex

func (c *Controller) CollectCacheStatusByIndex(index int) (*v1alpha1.CacheStatus, error)

func (*Controller) CollectCacheStatusByPartitions

func (c *Controller) CollectCacheStatusByPartitions(partitions int) (*v1alpha1.CacheStatus, error)

func (*Controller) CreateJobOptions

func (c *Controller) CreateJobOptions(opt interface{}, j *JobType) error

func (*Controller) CreateResource

func (c *Controller) CreateResource(r *Resource) error

func (*Controller) DeleteResource

func (c *Controller) DeleteResource(r *Resource) error

func (*Controller) GetJobResult

func (c *Controller) GetJobResult(filename types.UID, j *JobType) (*common.JobResult, error)

func (*Controller) GetRequestContext

func (c *Controller) GetRequestContext(d Dependence) (*common.RequestContext, error)

func (*Controller) GetResource

func (c *Controller) GetResource(object client.Object, r *Resource) error

func (*Controller) ListResources

func (c *Controller) ListResources(list client.ObjectList, r *Resource) error

func (*Controller) PostJobOptions

func (c *Controller) PostJobOptions(filename types.UID, j *JobType) error

func (*Controller) PostJobOptionsWithParam

func (c *Controller) PostJobOptionsWithParam(filename types.UID, j *JobType, param string) error

func (*Controller) PostTerminateSignal

func (c *Controller) PostTerminateSignal() error

func (*Controller) ResourcesExist

func (c *Controller) ResourcesExist(r *Resource) (bool, error)

func (*Controller) ResourcesExistWithObject

func (c *Controller) ResourcesExistWithObject(object client.Object, r *Resource) (bool, error)

func (*Controller) UpdateResource

func (c *Controller) UpdateResource(object client.Object, r *Resource) error

func (*Controller) UpdateResourceStatus

func (c *Controller) UpdateResourceStatus(object client.Object, r *Resource) error

type Dependence

type Dependence interface {
	GetName() string
	GetDependents() []*Resource
}

type JobType

type JobType struct {
	Name       string
	OptionPath string
	ResultPath string
	Dependents []*Resource

	Options       func() interface{}
	BaseUris      func(c *Controller) ([]string, error)
	CreateOptions func(c *Controller, opt interface{}, ctx *common.RequestContext) error
}

func NewJobOptions

func NewJobOptions(name string) *JobType

func (*JobType) CreateSuccessfully

func (j *JobType) CreateSuccessfully() string

func (*JobType) DoJobSuccessfully

func (j *JobType) DoJobSuccessfully() string

func (*JobType) ErrorCreateJob

func (j *JobType) ErrorCreateJob() string

func (*JobType) ErrorDoJob

func (j *JobType) ErrorDoJob() string

func (*JobType) GetDependents

func (j *JobType) GetDependents() []*Resource

func (*JobType) GetName

func (j *JobType) GetName() string

type OptionError

type OptionError struct{}

func (*OptionError) Error

func (e *OptionError) Error() string

type Resource

type Resource struct {
	Name       string
	WithLabel  bool
	Dependents []*Resource

	Object       func() client.Object
	ObjectKey    func(c *Controller) client.ObjectKey
	ListOptions  func(c *Controller) []client.ListOption
	CreateObject func(c *Controller, object client.Object, ctx *common.RequestContext) error
}

func NewResource

func NewResource(name string) *Resource

func (*Resource) CreateSuccessfully

func (r *Resource) CreateSuccessfully() string

func (*Resource) ErrorAlreadyExist

func (r *Resource) ErrorAlreadyExist() string

func (*Resource) ErrorCreateObject

func (r *Resource) ErrorCreateObject() string

func (*Resource) ErrorDeleteObject

func (r *Resource) ErrorDeleteObject() string

func (*Resource) GetDependents

func (r *Resource) GetDependents() []*Resource

func (*Resource) GetName

func (r *Resource) GetName() string

func (*Resource) UpdateSuccessfully

func (r *Resource) UpdateSuccessfully() string

type SampleJobController

type SampleJobController struct {
	Controller
	SampleJob *v1alpha1.SampleJob
}

func NewSampleJobController

func NewSampleJobController(
	sampleJob *v1alpha1.SampleJob,
	CSIDriver driver.Driver,
	ctx *common.ReconcileContext) *SampleJobController

type SampleJobReconciler

type SampleJobReconciler struct {
	client.Client
	Log      logr.Logger
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
}

SampleJobReconciler reconciles a SampleJob object

func (*SampleJobReconciler) AddFinalizer

func (r *SampleJobReconciler) AddFinalizer(ctx context.Context, sampleJob *v1alpha1.SampleJob) (ctrl.Result, error)

AddFinalizer add finalizer to SampleJob

func (*SampleJobReconciler) Reconcile

func (r *SampleJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. the SampleJob object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*SampleJobReconciler) SetupWithManager

func (r *SampleJobReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SampleSetController

type SampleSetController struct {
	Controller
	SampleSet *v1alpha1.SampleSet
}

func NewSampleSetController

func NewSampleSetController(
	sampleSet *v1alpha1.SampleSet,
	CSIDriver driver.Driver,
	ctx *common.ReconcileContext) *SampleSetController

type SampleSetReconciler

type SampleSetReconciler struct {
	client.Client
	Log      logr.Logger
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
}

SampleSetReconciler reconciles a SampleSet object

func (*SampleSetReconciler) AddFinalizer

func (r *SampleSetReconciler) AddFinalizer(ctx context.Context, sampleSet *v1alpha1.SampleSet) (ctrl.Result, error)

AddFinalizer add finalizer to SampleSet

func (*SampleSetReconciler) Reconcile

func (r *SampleSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. the SampleSet object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*SampleSetReconciler) SetupWithManager

func (r *SampleSetReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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