Documentation
¶
Index ¶
- Constants
- type Client
- type ClientOption
- type ClientOptions
- type Config
- type CreateOption
- type CreateOptions
- type DeleteOption
- type DeleteOptions
- type GetOption
- type GetOptions
- type IndexFunc
- type Indexer
- type Informer
- type InformerCache
- type Informers
- type ListOption
- type ListOptions
- type ObjectKey
- type Reader
- type UpdateOption
- type UpdateOptions
- type VersionedClients
- type Writer
Constants ¶
const (
DefaultWatchInterval time.Duration = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Reader
Writer
Informers
SetServer(server string)
GetServer() string
// SetTokenProvider replaces the TokenProvider used by subsequent requests.
// It is safe to call concurrently with client requests and informers.
SetTokenProvider(tokenProvider token.Provider)
// GetToken returns the latest token successfully resolved by the provider.
GetToken() string
// Versioned returns a handle to call a specific raw versioned client.
Versioned() VersionedClients
}
Client knows how to perform CRUD operations on Slurm objects.
type ClientOption ¶
type ClientOption interface {
// ApplyToCreate applies this configuration to the given client options.
ApplyToClient(*ClientOptions)
}
ClientOption is some configuration that modifies options for the client.
type ClientOptions ¶
type ClientOptions struct {
// EnableFor indicates the list of resources for the informer to ensure.
EnableFor []object.Object
// DisableFor indicates the list of resources for the informer to ignore.
DisableFor []object.Object
// CacheSyncPeriod is the time to wait before updating the cache
CacheSyncPeriod time.Duration
}
ClientOptions contains options for creating a client to make requests to Slurm.
func (*ClientOptions) ApplyOptions ¶
func (o *ClientOptions) ApplyOptions(opts []ClientOption) *ClientOptions
ApplyOptions applies the given create options on these options, and then returns itself (for convenient chaining).
func (*ClientOptions) ApplyToClient ¶
func (o *ClientOptions) ApplyToClient(co *ClientOptions)
ApplyToClient implements ClientOption.
type Config ¶
type Config struct {
// The server with port (e.g. `http://localhost:8080/`).
// +required
Server string
// TokenProvider supplies the Slurm JWT token for every request.
TokenProvider tokenprovider.Provider
// HTTPClient is the HTTP client to use for requests.
HTTPClient *http.Client
}
Config holds the common attributes that can be passed to a Slurm client on initialization.
type CreateOption ¶
type CreateOption interface {
// ApplyToCreate applies this configuration to the given create options.
ApplyToCreate(*CreateOptions)
}
CreateOption is some configuration that modifies options for a create request.
type CreateOptions ¶
type CreateOptions struct {
// SkipReadAfterCreate, when true, returns once creation is acknowledged.
// Only the object's identity is populated; no follow-up GET or cache
// insertion occurs.
//
// By default, Create reads the complete object back from Slurm. If that
// read fails, Create returns the read error and obj retains the accepted
// identity. Retry Get using that identity; do not resubmit the create request.
SkipReadAfterCreate bool
}
CreateOptions contains options for create requests. It's generally a subset of metav1.CreateOptions.
func (*CreateOptions) ApplyOptions ¶
func (o *CreateOptions) ApplyOptions(opts []CreateOption) *CreateOptions
ApplyOptions applies the given create options on these options, and then returns itself (for convenient chaining).
func (*CreateOptions) ApplyToCreate ¶
func (o *CreateOptions) ApplyToCreate(co *CreateOptions)
ApplyToCreate implements CreateOption.
type DeleteOption ¶
type DeleteOption interface {
// ApplyToDelete applies this configuration to the given delete options.
ApplyToDelete(*DeleteOptions)
}
DeleteOption is some configuration that modifies options for a delete request.
type DeleteOptions ¶
type DeleteOptions struct {
// SkipReadAfterDelete, when true, returns once deletion is acknowledged.
// No cache refresh occurs, and obj is left unchanged. Cached objects remain
// until an explicit cache refresh or informer sync observes the deletion.
//
// By default, Delete returns once deletion is acknowledged and refreshes the
// cached object in the background, so cache reads wait for the new state.
// Slurm may keep the object (a canceled job stays until MinJobAge).
SkipReadAfterDelete bool
}
DeleteOptions contains options for delete requests. It's generally a subset of metav1.DeleteOptions.
func (*DeleteOptions) ApplyOptions ¶
func (o *DeleteOptions) ApplyOptions(opts []DeleteOption) *DeleteOptions
ApplyOptions applies the given delete options on these options, and then returns itself (for convenient chaining).
func (*DeleteOptions) ApplyToDelete ¶
func (o *DeleteOptions) ApplyToDelete(do *DeleteOptions)
ApplyToDelete implements DeleteOption.
type GetOption ¶
type GetOption interface {
// ApplyToGet applies this configuration to the given get options.
ApplyToGet(*GetOptions)
}
GetOption is some configuration that modifies options for a get request.
type GetOptions ¶
type GetOptions struct {
// SkipCache indicates not to use cache when fetching data.
SkipCache bool
// RefreshCache indicates to refresh the cache before reading from it.
RefreshCache bool
// WaitRefreshCache indicates to wait for the next cache refresh before reading from it.
WaitRefreshCache bool
}
GetOptions contains options for get operation. Now it only has a Raw field, with support for specific resourceVersion.
func (*GetOptions) ApplyOptions ¶
func (o *GetOptions) ApplyOptions(opts []GetOption) *GetOptions
ApplyOptions applies the given get options on these options, and then returns itself (for convenient chaining).
func (*GetOptions) ApplyToGet ¶
func (o *GetOptions) ApplyToGet(lo *GetOptions)
ApplyToGet implements GetOption for GetOptions.
type IndexFunc ¶ added in v1.3.0
IndexFunc extracts zero or more secondary keys from an object. It must be deterministic, must not modify the object, and must not call back into the cache. Return no keys for objects that do not belong in the index.
type Indexer ¶ added in v1.3.0
type Indexer interface {
// AddIndex registers an index and indexes any existing objects atomically.
// Empty names, nil extractors, and duplicate names are rejected.
AddIndex(name string, extract IndexFunc) error
// ByIndex appends deep copies of matching cached objects to list. It has the
// same synchronization semantics as a cached List and makes no live request.
// The list must match the informer's object type. An unknown index is an error;
// a known index with no matches returns an empty result, not ErrNotFound.
// A cache miss is not proof that an object does not exist on the server.
ByIndex(ctx context.Context, name, value string, list object.ObjectList) error
}
Indexer supports local secondary indexes over an informer's objects.
type Informer ¶
type Informer interface {
// SetEventHandler sets an event handler to the informer. When cache changes,
// event handlers will trigger.
SetEventHandler(handler cache.ResourceEventHandler)
// UnsetEventHandler unsets the event handler of the informer.
// Callbacks that have already captured the handler may still complete.
UnsetEventHandler()
// HasSynced return true if the informers underlying store has synced.
HasSynced() (bool, error)
// HasStarted return true if the informers underlying store has been started.
HasStarted() bool
// Run starts and runs the informer, returning after it stops.
// The informer will be stopped when stopCh is closed.
Run(stopCh <-chan struct{})
}
Informer - informer allows you interact with the underlying informer.
type InformerCache ¶
type Informers ¶
type Informers interface {
// GetInformer fetches or constructs an informer for the given objectType that corresponds to the
// non-list version of the resource.
GetInformer(objectType object.ObjectType) InformerCache
// Start runs all the informers known to this cache until the context is closed.
// It blocks.
Start(ctx context.Context)
// Stop runs all the informers known to this cache until the context is closed.
// It blocks.
Stop()
}
Informers knows how to create or fetch informers for different Objects. It's safe to call GetInformer from multiple threads.
type ListOption ¶
type ListOption interface {
// ApplyToList applies this configuration to the given list options.
ApplyToList(*ListOptions)
}
ListOption is some configuration that modifies options for a list request.
type ListOptions ¶
type ListOptions struct {
// SkipCache indicates not to use cache when fetching data.
SkipCache bool
// RefreshCache indicates to refresh the cache before reading from it.
RefreshCache bool
// WaitRefreshCache indicates to wait for the next cache refresh before reading from it.
WaitRefreshCache bool
}
ListOptions contains options for limiting or filtering results. It's generally a subset of metav1.ListOptions, with support for pre-parsed selectors (since generally, selectors will be executed against the cache).
func (*ListOptions) ApplyOptions ¶
func (o *ListOptions) ApplyOptions(opts []ListOption) *ListOptions
ApplyOptions applies the given list options on these options, and then returns itself (for convenient chaining).
func (*ListOptions) ApplyToList ¶
func (o *ListOptions) ApplyToList(lo *ListOptions)
ApplyToList implements ListOption for ListOptions.
type ObjectKey ¶
ObjectKey identifies a Slurm Object.
func ObjectKeyFromObject ¶
ObjectKeyFromObject returns the ObjectKey given a object.Object.
type Reader ¶
type Reader interface {
// Get retrieves an obj for the given object key from the Slurm Cluster.
// obj must be a struct pointer so that obj can be updated with the response
// returned by the Server.
Get(ctx context.Context, key object.ObjectKey, obj object.Object, opts ...GetOption) error
// List retrieves list of objects for a given namespace and list options. On a
// successful call, Items field in the list will be populated with the
// result returned from the server.
List(ctx context.Context, list object.ObjectList, opts ...ListOption) error
}
Reader knows how to read and list Slurm objects.
type UpdateOption ¶
type UpdateOption interface {
// ApplyToUpdate applies this configuration to the given update options.
ApplyToUpdate(*UpdateOptions)
}
UpdateOption is some configuration that modifies options for a update request.
type UpdateOptions ¶
type UpdateOptions struct {
// SkipReadAfterUpdate, when true, returns once the update is acknowledged.
// No follow-up GET or cache refresh occurs, and obj is left unchanged.
// Cached objects remain unchanged until an explicit cache refresh or
// informer sync observes the update.
//
// By default, Update reads the complete object back from Slurm into obj.
// Read errors are returned even though the update was acknowledged.
SkipReadAfterUpdate bool
}
UpdateOptions contains options for update requests.
func (*UpdateOptions) ApplyOptions ¶
func (o *UpdateOptions) ApplyOptions(opts []UpdateOption) *UpdateOptions
ApplyOptions applies the given update options on these options, and then returns itself (for convenient chaining).
func (*UpdateOptions) ApplyToUpdate ¶
func (o *UpdateOptions) ApplyToUpdate(uo *UpdateOptions)
ApplyToUpdate implements UpdateOption.
type VersionedClients ¶ added in v1.3.0
type VersionedClients struct {
// contains filtered or unexported fields
}
func (VersionedClients) V0042 ¶ added in v1.3.0
func (v VersionedClients) V0042() apiv0042.ClientWithResponsesInterface
func (VersionedClients) V0043 ¶ added in v1.3.0
func (v VersionedClients) V0043() apiv0043.ClientWithResponsesInterface
func (VersionedClients) V0044 ¶ added in v1.3.0
func (v VersionedClients) V0044() apiv0044.ClientWithResponsesInterface
func (VersionedClients) V0045 ¶ added in v1.3.0
func (v VersionedClients) V0045() apiv0045.ClientWithResponsesInterface
type Writer ¶
type Writer interface {
// Create saves the object obj in the Slurm cluster. obj must be a
// struct pointer so that obj can be updated with the content returned by the Server.
Create(ctx context.Context, obj object.Object, req any, opts ...CreateOption) error
// Update updates the given obj in the Slurm cluster. obj must be a
// struct pointer so that obj can be updated with the content returned by the Server.
Update(ctx context.Context, obj object.Object, req any, opts ...UpdateOption) error
// Delete deletes the given obj from Slurm cluster.
Delete(ctx context.Context, obj object.Object, opts ...DeleteOption) error
}
Writer knows how to create, delete, and update Slurm objects.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package token supplies Slurm authentication tokens to clients.
|
Package token supplies Slurm authentication tokens to clients. |