Documentation ¶
Index ¶
- func AddObjectMetadata(taskCtx pluginsCore.TaskExecutionMetadata, o k8s.Resource, ...)
- func IsK8sObjectNotExists(err error) bool
- type PluginManager
- func (e PluginManager) Abort(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) error
- func (e *PluginManager) CheckResourcePhase(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
- func (e *PluginManager) ClearFinalizers(ctx context.Context, o k8s.Resource) error
- func (e *PluginManager) Finalize(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) error
- func (e *PluginManager) GetID() string
- func (e *PluginManager) GetProperties() pluginsCore.PluginProperties
- func (e PluginManager) Handle(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
- func (e *PluginManager) LaunchResource(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
- type PluginMetrics
- type PluginPhase
- type PluginState
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddObjectMetadata ¶
func AddObjectMetadata(taskCtx pluginsCore.TaskExecutionMetadata, o k8s.Resource, cfg *config.K8sPluginConfig)
func IsK8sObjectNotExists ¶
Types ¶
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
A generic Plugin for managing k8s-resources. Plugin writers wishing to use K8s resource can use the simplified api specified in pluginmachinery.core
func NewPluginManager ¶
func NewPluginManager(ctx context.Context, iCtx pluginsCore.SetupContext, entry k8s.PluginEntry) (*PluginManager, error)
Creates a K8s generic task executor. This provides an easier way to build task executors that create K8s resources.
Example ¶
sCtx := &pluginsCoreMock.SetupContext{} fakeKubeClient := mocks.NewFakeKubeClient() sCtx.On("KubeClient").Return(fakeKubeClient) sCtx.On("OwnerKind").Return("test") sCtx.On("EnqueueOwner").Return(pluginsCore.EnqueueOwner(func(name k8stypes.NamespacedName) error { return nil })) sCtx.On("MetricsScope").Return(promutils.NewTestScope()) ctx := context.TODO() exec, err := NewPluginManager(ctx, sCtx, k8s.PluginEntry{ ID: "SampleHandler", RegisteredTaskTypes: []pluginsCore.TaskType{"container"}, ResourceToWatch: &v1.Pod{}, Plugin: k8sSampleHandler{}, }) if err == nil { fmt.Printf("Created executor: %v\n", exec.GetID()) } else { fmt.Printf("Error in creating executor: %s\n", err.Error()) }
Output: Created executor: SampleHandler
func NewPluginManagerWithBackOff ¶ added in v0.1.21
func NewPluginManagerWithBackOff(ctx context.Context, iCtx pluginsCore.SetupContext, entry k8s.PluginEntry, backOffController *backoff.Controller) (*PluginManager, error)
func (PluginManager) Abort ¶
func (e PluginManager) Abort(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) error
func (*PluginManager) CheckResourcePhase ¶
func (e *PluginManager) CheckResourcePhase(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
func (*PluginManager) ClearFinalizers ¶
func (*PluginManager) Finalize ¶
func (e *PluginManager) Finalize(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) error
func (*PluginManager) GetID ¶
func (e *PluginManager) GetID() string
func (*PluginManager) GetProperties ¶
func (e *PluginManager) GetProperties() pluginsCore.PluginProperties
func (PluginManager) Handle ¶
func (e PluginManager) Handle(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
func (*PluginManager) LaunchResource ¶
func (e *PluginManager) LaunchResource(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (pluginsCore.Transition, error)
type PluginMetrics ¶
type PluginPhase ¶
type PluginPhase uint8
const ( PluginPhaseNotStarted PluginPhase = iota PluginPhaseAllocationTokenAcquired PluginPhaseStarted )
type PluginState ¶
type PluginState struct {
Phase PluginPhase
}
Click to show internal directories.
Click to hide internal directories.