Documentation ¶
Overview ¶
Package app does all of the work necessary to configure and run a Kubernetes app process.
Package app does all of the work necessary to configure and run a Kubernetes app process.
Index ¶
- func NewCommand() *cobra.Command
- type AllocateWrapperType
- type ClaimID
- type ExampleController
- func (c *ExampleController) Allocate(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, ...) (result *resourcev1alpha2.AllocationResult, err error)
- func (c *ExampleController) Deallocate(ctx context.Context, claim *resourcev1alpha2.ResourceClaim) error
- func (c *ExampleController) GetClaimParameters(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, ...) (interface{}, error)
- func (c *ExampleController) GetClassParameters(ctx context.Context, class *resourcev1alpha2.ResourceClass) (interface{}, error)
- func (c *ExampleController) GetNumAllocations() int64
- func (c *ExampleController) GetNumDeallocations() int64
- func (c *ExampleController) Run(ctx context.Context, workers int)
- func (c *ExampleController) UnsuitableNodes(ctx context.Context, pod *v1.Pod, claims []*controller.ClaimAllocation, ...) (finalErr error)
- type ExamplePlugin
- func (ex *ExamplePlugin) GetPreparedResources() []ClaimID
- func (ex *ExamplePlugin) IsRegistered() bool
- func (ex *ExamplePlugin) NodePrepareResource(ctx context.Context, req *drapbv1.NodePrepareResourceRequest) (*drapbv1.NodePrepareResourceResponse, error)
- func (ex *ExamplePlugin) NodeUnprepareResource(ctx context.Context, req *drapbv1.NodeUnprepareResourceRequest) (*drapbv1.NodeUnprepareResourceResponse, error)
- func (ex *ExamplePlugin) Stop()
- type FileOperations
- type Resources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
NewCommand creates a *cobra.Command object with default parameters.
Types ¶
type AllocateWrapperType ¶
type AllocateWrapperType func(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, claimParameters interface{}, class *resourcev1alpha2.ResourceClass, classParameters interface{}, selectedNode string, handler func(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, claimParameters interface{}, class *resourcev1alpha2.ResourceClass, classParameters interface{}, selectedNode string) (result *resourcev1alpha2.AllocationResult, err error), ) (result *resourcev1alpha2.AllocationResult, err error)
type ClaimID ¶
ClaimID contains both claim name and UID to simplify debugging. The namespace is not included because it is random in E2E tests and the UID is sufficient to make the ClaimID unique.
type ExampleController ¶
type ExampleController struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(clientset kubernetes.Interface, driverName string, resources Resources) *ExampleController
func (*ExampleController) Allocate ¶
func (c *ExampleController) Allocate(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, claimParameters interface{}, class *resourcev1alpha2.ResourceClass, classParameters interface{}, selectedNode string) (result *resourcev1alpha2.AllocationResult, err error)
func (*ExampleController) Deallocate ¶
func (c *ExampleController) Deallocate(ctx context.Context, claim *resourcev1alpha2.ResourceClaim) error
func (*ExampleController) GetClaimParameters ¶
func (c *ExampleController) GetClaimParameters(ctx context.Context, claim *resourcev1alpha2.ResourceClaim, class *resourcev1alpha2.ResourceClass, classParameters interface{}) (interface{}, error)
func (*ExampleController) GetClassParameters ¶
func (c *ExampleController) GetClassParameters(ctx context.Context, class *resourcev1alpha2.ResourceClass) (interface{}, error)
func (*ExampleController) GetNumAllocations ¶
func (c *ExampleController) GetNumAllocations() int64
GetNumAllocations returns the number of times that a claim was allocated. Idempotent calls to Allocate that do not need to allocate the claim again do not contribute to that counter.
func (*ExampleController) GetNumDeallocations ¶
func (c *ExampleController) GetNumDeallocations() int64
GetNumDeallocations returns the number of times that a claim was allocated. Idempotent calls to Allocate that do not need to allocate the claim again do not contribute to that counter.
func (*ExampleController) UnsuitableNodes ¶
func (c *ExampleController) UnsuitableNodes(ctx context.Context, pod *v1.Pod, claims []*controller.ClaimAllocation, potentialNodes []string) (finalErr error)
type ExamplePlugin ¶
type ExamplePlugin struct {
// contains filtered or unexported fields
}
func StartPlugin ¶
func StartPlugin(logger klog.Logger, cdiDir, driverName string, nodeName string, fileOps FileOperations, opts ...kubeletplugin.Option) (*ExamplePlugin, error)
StartPlugin sets up the servers that are necessary for a DRA kubelet plugin.
func (*ExamplePlugin) GetPreparedResources ¶
func (ex *ExamplePlugin) GetPreparedResources() []ClaimID
func (*ExamplePlugin) IsRegistered ¶
func (ex *ExamplePlugin) IsRegistered() bool
func (*ExamplePlugin) NodePrepareResource ¶
func (ex *ExamplePlugin) NodePrepareResource(ctx context.Context, req *drapbv1.NodePrepareResourceRequest) (*drapbv1.NodePrepareResourceResponse, error)
NodePrepareResource ensures that the CDI file for the claim exists. It uses a deterministic name to simplify NodeUnprepareResource (no need to remember or discover the name) and idempotency (when called again, the file simply gets written again).
func (*ExamplePlugin) NodeUnprepareResource ¶
func (ex *ExamplePlugin) NodeUnprepareResource(ctx context.Context, req *drapbv1.NodeUnprepareResourceRequest) (*drapbv1.NodeUnprepareResourceResponse, error)
NodeUnprepareResource removes the CDI file created by NodePrepareResource. It's idempotent, therefore it is not an error when that file is already gone.
func (*ExamplePlugin) Stop ¶
func (ex *ExamplePlugin) Stop()
stop ensures that all servers are stopped and resources freed.
type FileOperations ¶
type FileOperations struct { // Create must overwrite the file. Create func(name string, content []byte) error // Remove must remove the file. It must not return an error when the // file does not exist. Remove func(name string) error }
FileOperations defines optional callbacks for handling CDI files.