controller

package
v0.19.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	JSConsumerNotFoundErr uint16 = 10014
	JSStreamNotFoundErr   uint16 = 10059
)

Variables

This section is empty.

Functions

func CreateJSMClient

func CreateJSMClient(conn *pooledConnection, pedantic bool, domain string) (*jsm.Manager, error)

func CreateJetStreamClient

func CreateJetStreamClient(conn *pooledConnection, pedantic bool, domain string) (jetstream.JetStream, error)

CreateJetStreamClient creates new Jetstream client with a connection based on the given NatsConfig. Returns a jetstream.Jetstream client and the Closable of the underlying connection. Close should be called when the client is no longer used.

func RegisterAll

func RegisterAll(mgr ctrl.Manager, clientConfig *NatsConfig, config *Config) error

RegisterAll registers all available jetStream controllers to the manager. natsCfg is specific to the nats server connection. controllerCfg defines behaviour of the registered controllers.

Types

type AccountReconciler

type AccountReconciler struct {
	Scheme *runtime.Scheme
	JetStreamController
}

AccountReconciler reconciles a Account object

func (*AccountReconciler) Reconcile

func (r *AccountReconciler) 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.

It performs two main operations: - Initialize finalizer if not present - Remove the finalizer on deletion once no other resources are referencing the account

A call to reconcile may perform only one action, expecting the reconciliation to be triggered again by an update. For example: Setting the finalizer triggers a second reconciliation. Reconcile returns after setting the finalizer, to prevent parallel reconciliations performing the same steps.

func (*AccountReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type Closable

type Closable interface {
	Close()
}

type Config

type Config struct {
	ReadOnly        bool
	Namespace       string
	RequeueInterval time.Duration
	CacheDir        string
}

The Config contains parameters to be considered by the registered controllers.

ReadOnly prevents controllers from actually applying changes NATS resources.

Namespace restricts the controller to resources of the given namespace.

type ConsumerReconciler

type ConsumerReconciler struct {
	Scheme *runtime.Scheme

	JetStreamController
}

ConsumerReconciler reconciles a Consumer object

func (*ConsumerReconciler) Reconcile

func (r *ConsumerReconciler) 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.

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

func (*ConsumerReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type JetStreamController

type JetStreamController interface {
	client.Client

	// ReadOnly returns true when no changes should be made by the controller.
	ReadOnly() bool

	// ValidNamespace ok if the controllers namespace restriction allows the given namespace.
	ValidNamespace(namespace string) bool

	// WithJetStreamClient provides a jetStream client to the given operation.
	// The client uses the controllers connection configuration merged with opts.
	//
	// The given opts values take precedence over the controllers base configuration.
	//
	// Returns the error of the operation or errors during client setup.
	WithJetStreamClient(opts api.ConnectionOpts, ns string, op func(js jetstream.JetStream) error) error

	// WithJSMClient provides a jsm.go client to the given operation.
	WithJSMClient(opts api.ConnectionOpts, ns string, op func(jsm *jsm.Manager) error) error

	RequeueInterval() time.Duration
}

func NewJSController

func NewJSController(k8sClient client.Client, natsConfig *NatsConfig, controllerConfig *Config) (JetStreamController, error)

type JetStreamResource

type JetStreamResource interface {
	GetName() string
	GetNamespace() string
}

type JetStreamResourceList

type JetStreamResourceList []JetStreamResource

type KeyValueReconciler

type KeyValueReconciler struct {
	Scheme *runtime.Scheme
	JetStreamController
}

KeyValueReconciler reconciles a KeyValue object

func (*KeyValueReconciler) Reconcile

func (r *KeyValueReconciler) 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.

It performs three main operations: - Initialize finalizer and ready condition if not present - Delete KeyValue if it is marked for deletion. - Create or Update the KeyValue

A call to reconcile may perform only one action, expecting the reconciliation to be triggered again by an update. For example: Setting the finalizer triggers a second reconciliation. Reconcile returns after setting the finalizer, to prevent parallel reconciliations performing the same steps.

func (*KeyValueReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type NatsConfig

type NatsConfig struct {
	ClientName  string   `json:"name,omitempty"`
	ServerURL   string   `json:"url,omitempty"`
	Certificate string   `json:"tls_cert,omitempty"`
	Key         string   `json:"tls_key,omitempty"`
	TLSFirst    bool     `json:"tls_first,omitempty"`
	CAs         []string `json:"tls_ca,omitempty"`
	Credentials string   `json:"credential,omitempty"`
	NKey        string   `json:"nkey,omitempty"`
	Token       string   `json:"token,omitempty"`
	User        string   `json:"username,omitempty"`
	Password    string   `json:"password,omitempty"`
	JsDomain    string   `json:"js_domain,omitempty"`
}

func (*NatsConfig) Copy

func (o *NatsConfig) Copy() *NatsConfig

func (*NatsConfig) HasAuth

func (o *NatsConfig) HasAuth() bool

func (*NatsConfig) Hash

func (o *NatsConfig) Hash() (string, error)

func (*NatsConfig) Overlay

func (o *NatsConfig) Overlay(overlay *NatsConfig)

func (*NatsConfig) UnsetAuth

func (o *NatsConfig) UnsetAuth()

type ObjectStoreReconciler

type ObjectStoreReconciler struct {
	Scheme *runtime.Scheme

	JetStreamController
}

ObjectStoreReconciler reconciles a ObjectStore object

func (*ObjectStoreReconciler) Reconcile

func (r *ObjectStoreReconciler) 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.

It performs three main operations: - Initialize finalizer and ready condition if not present - Delete ObjectStore if it is marked for deletion. - Create or Update the ObjectStore

A call to reconcile may perform only one action, expecting the reconciliation to be triggered again by an update. For example: Setting the finalizer triggers a second reconciliation. Reconcile returns after setting the finalizer, to prevent parallel reconciliations performing the same steps.

func (*ObjectStoreReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type StreamReconciler

type StreamReconciler struct {
	Scheme *runtime.Scheme

	JetStreamController
}

StreamReconciler reconciles a Stream object

func (*StreamReconciler) Reconcile

func (r *StreamReconciler) 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.

It performs three main operations: - Initialize finalizer and ready condition if not present - Delete stream if it is marked for deletion. - Create or Update the stream

A call to reconcile may perform only one action, expecting the reconciliation to be triggered again by an update. For example: Setting the finalizer triggers a second reconciliation. Reconcile returns after setting the finalizer, to prevent parallel reconciliations performing the same steps.

func (*StreamReconciler) SetupWithManager

func (r *StreamReconciler) 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