manager

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package manager provides an enhanced Kubernetes controller-runtime manager with integrated support for Δ-controller's composite client and cache system.

The manager wraps the standard controller-runtime Manager to provide seamless integration with the composite client system, enabling controllers to work with both native Kubernetes resources and view objects through a unified interface.

The manager automatically configures the composite client as the default client, ensuring that all controllers receive the enhanced client capabilities without requiring code changes.

Example usage:

mgr, _ := manager.New(cfg, manager.Options{
    Options: ctrl.Options{
        Scheme: scheme,
    },
    Logger: logger,
})
return mgr.Start(ctx)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeManager

type FakeManager struct {
	*Manager

	// allow to push a fake config
	Cfg *rest.Config
	// contains filtered or unexported fields
}

FakeManager is a fake manager that can be used for testing.

func NewFakeManager

func NewFakeManager(operator string, opts manager.Options, objs ...client.Object) (*FakeManager, error)

NewFakeManager creates a new fake manager.

func (*FakeManager) GetCompositeCache

func (m *FakeManager) GetCompositeCache() *composite.CompositeCache

func (*FakeManager) GetManager

func (m *FakeManager) GetManager() manager.Manager

func (*FakeManager) GetObjectTracker

func (m *FakeManager) GetObjectTracker() testing.ObjectTracker

func (*FakeManager) GetRuntimeCache

func (m *FakeManager) GetRuntimeCache() *composite.FakeRuntimeCache

func (*FakeManager) GetRuntimeClient

func (m *FakeManager) GetRuntimeClient() client.WithWatch

func (*FakeManager) GetRuntimeManager

func (m *FakeManager) GetRuntimeManager() manager.Manager

type FakeRuntimeManager

type FakeRuntimeManager struct {
	Client client.Client
	Cache  cache.Cache
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

FakeRuntimeManager is a runtime manager fake.

func NewFakeRuntimeManager

func NewFakeRuntimeManager(cache cache.Cache, client client.Client, logger logr.Logger) *FakeRuntimeManager

func (*FakeRuntimeManager) Add

func (f *FakeRuntimeManager) Add(runnable manager.Runnable) error

func (*FakeRuntimeManager) AddHealthzCheck

func (f *FakeRuntimeManager) AddHealthzCheck(name string, check healthz.Checker) error

func (*FakeRuntimeManager) AddMetricsServerExtraHandler

func (f *FakeRuntimeManager) AddMetricsServerExtraHandler(path string, handler http.Handler) error

func (*FakeRuntimeManager) AddReadyzCheck

func (f *FakeRuntimeManager) AddReadyzCheck(name string, check healthz.Checker) error

func (*FakeRuntimeManager) Elected

func (f *FakeRuntimeManager) Elected() <-chan struct{}

func (*FakeRuntimeManager) GetAPIReader

func (f *FakeRuntimeManager) GetAPIReader() client.Reader

func (*FakeRuntimeManager) GetCache

func (f *FakeRuntimeManager) GetCache() cache.Cache

func (*FakeRuntimeManager) GetClient

func (f *FakeRuntimeManager) GetClient() client.Client

func (*FakeRuntimeManager) GetConfig

func (f *FakeRuntimeManager) GetConfig() *rest.Config

func (*FakeRuntimeManager) GetControllerOptions

func (f *FakeRuntimeManager) GetControllerOptions() config.Controller

func (*FakeRuntimeManager) GetEventRecorderFor

func (f *FakeRuntimeManager) GetEventRecorderFor(name string) record.EventRecorder

func (*FakeRuntimeManager) GetFieldIndexer

func (f *FakeRuntimeManager) GetFieldIndexer() client.FieldIndexer

func (*FakeRuntimeManager) GetHTTPClient

func (f *FakeRuntimeManager) GetHTTPClient() *http.Client

func (*FakeRuntimeManager) GetLogger

func (f *FakeRuntimeManager) GetLogger() logr.Logger

func (*FakeRuntimeManager) GetRESTMapper

func (f *FakeRuntimeManager) GetRESTMapper() meta.RESTMapper

func (*FakeRuntimeManager) GetScheme

func (f *FakeRuntimeManager) GetScheme() *runtime.Scheme

func (*FakeRuntimeManager) GetWebhookServer

func (f *FakeRuntimeManager) GetWebhookServer() webhook.Server

func (*FakeRuntimeManager) SetFields

func (f *FakeRuntimeManager) SetFields(i interface{}) error

func (*FakeRuntimeManager) Start

func (f *FakeRuntimeManager) Start(ctx context.Context) error

type Manager

type Manager struct {
	manager.Manager
}

Manager is a wrapper around the controller-runtime Manager. The main difference is a custom split cache: only native objects are managed by the API server, view objects are served from a special view cache. The client returned by the GetClient call is smart enough to know when to send requests to the API server (via the default cache) and when to use the view cache.

func New

func New(config *rest.Config, operator string, opts Options) (*Manager, error)

New creates a new delta-controller manager. If called with a nil config, create a headless manager, otherwise create a composite manager. A headless manager runs with no upstream Kubernetes API access so it handles only view resources, not native objects. For native Kubernetes object support, create a composite manager by providing a valid REST config to access a full Kubernetes API server.

type Options

type Options struct {
	manager.Options

	// Manager is a controller runtime manager. If set, the dmanager will wrap the specified
	// manager instead of creating a new one.
	Manager manager.Manager
}

Options provides various settings to custimize the manager. Most options come verbatim from the controller runtime package.

type Runnable

type Runnable interface {
	manager.Runnable
	GetName() string
}

Runnable is something that can be run.

Jump to

Keyboard shortcuts

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