deploymentcontroller

package
v0.0.0-...-5152f1c Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeploymentController

func NewDeploymentController(
	name string,
	manifest []byte,
	recorder events.Recorder,
	operatorClient v1helpers.OperatorClientWithFinalizers,
	kubeClient kubernetes.Interface,
	deployInformer appsinformersv1.DeploymentInformer,
	optionalInformers []factory.Informer,
	optionalManifestHooks []ManifestHookFunc,
	optionalDeploymentHooks ...DeploymentHookFunc,
) factory.Controller

NewDeploymentController creates a new instance of DeploymentController, returning it as a factory.Controller interface. Under the hood it uses the NewDeploymentControllerBuilder to construct the controller.

Types

type DeploymentController

type DeploymentController struct {
	// contains filtered or unexported fields
}

DeploymentController is a generic controller that manages a deployment.

This controller supports removable operands, as configured in pkg/operator/management.

This controller optionally produces the following conditions: <name>Available: indicates that the deployment controller was successfully deployed and at least one Deployment replica is available. <name>Progressing: indicates that the Deployment is in progress. <name>Degraded: produced when the sync() method returns an error.

func NewDeploymentControllerBuilder

func NewDeploymentControllerBuilder(
	name string,
	manifest []byte,
	recorder events.Recorder,
	operatorClient v1helpers.OperatorClientWithFinalizers,
	kubeClient kubernetes.Interface,
	deployInformer appsinformersv1.DeploymentInformer,
) *DeploymentController

NewDeploymentControllerBuilder initializes and returns a pointer to a minimal DeploymentController.

func (*DeploymentController) Name

func (c *DeploymentController) Name() string

Name returns the name of the DeploymentController.

func (*DeploymentController) ToController

func (c *DeploymentController) ToController() (factory.Controller, error)

ToController converts the DeploymentController into a factory.Controller. It aggregates and returns all errors reported during the builder phase.

func (*DeploymentController) WithConditions

func (c *DeploymentController) WithConditions(conditions ...string) *DeploymentController

WithConditions sets the operational conditions under which the DeploymentController will operate. Only 'Available', 'Progressing' and 'Degraded' are valid conditions; other values are ignored.

func (*DeploymentController) WithDeploymentHooks

func (c *DeploymentController) WithDeploymentHooks(hooks ...DeploymentHookFunc) *DeploymentController

WithDeploymentHooks adds custom hook functions that are called during the sync. These hooks can perform operations or modifications at specific points in the Deployment.

func (*DeploymentController) WithExtraInformers

func (c *DeploymentController) WithExtraInformers(informers ...factory.Informer) *DeploymentController

WithExtraInformers appends additional informers to the DeploymentController. These informers are used to watch for additional resources that might affect the Deployment's state.

func (*DeploymentController) WithManifestHooks

func (c *DeploymentController) WithManifestHooks(hooks ...ManifestHookFunc) *DeploymentController

WithManifestHooks adds custom hook functions that are called during the handling of the Deployment manifest. These hooks can manipulate the manifest or perform specific checks before its convertion into a Deployment object.

type DeploymentHookFunc

type DeploymentHookFunc func(*opv1.OperatorSpec, *appsv1.Deployment) error

DeploymentHookFunc is a hook function to modify the Deployment.

func WithImageHook

func WithImageHook() DeploymentHookFunc

WithImageHook sets the image associated with the deployment with the value provided for CLI_IMAGE env variable.

func WithReplicasHook

func WithReplicasHook(nodeLister corev1listers.NodeLister) DeploymentHookFunc

WithReplicasHook sets the deployment.Spec.Replicas field according to the number of available nodes. The number of nodes is determined by the node selector specified in the field deployment.Spec.Templates.NodeSelector.

type ManifestHookFunc

type ManifestHookFunc func(*opv1.OperatorSpec, []byte) ([]byte, error)

ManifestHookFunc is a hook function to modify the manifest in raw format. The hook must not modify the original manifest!

Jump to

Keyboard shortcuts

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