controllers

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionTypeError = "Error"
)

Variables

This section is empty.

Functions

func ClickhouseRoleExists added in v0.19.0

func ClickhouseRoleExists(ctx context.Context, avnGen avngen.Client, r *v1alpha1.ClickhouseRole) error

func CreateUserConfiguration added in v0.14.0

func CreateUserConfiguration(userConfig any) (map[string]any, error)

func GetClickhouseDatabaseByName added in v0.30.0

func GetClickhouseDatabaseByName(ctx context.Context, avnGen avngen.Client, project, service, name string) (*clickhouse.DatabaseOut, error)

func GetDatabaseByName added in v0.30.0

func GetDatabaseByName(
	ctx context.Context,
	avnGen avngen.Client,
	projectName, serviceName, dbName string,
) (*service.DatabaseOut, error)

func GetIsRunningAnnotation added in v0.30.0

func GetIsRunningAnnotation(o client.Object) string

GetIsRunningAnnotation returns "true" for running/rebalancing resources, and "false" for powered-off resources.

func GetKafkaConnectorByName added in v0.30.0

func GetKafkaConnectorByName(ctx context.Context, avnGen avngen.Client, projectName, serviceName, name string) (*kafkaconnect.ConnectorOut, error)

func GetPasswordFromSecret added in v0.31.0

func GetPasswordFromSecret(ctx context.Context, k8sClient client.Client, resource PasswordSource) (string, error)

GetPasswordFromSecret retrieves and validates the password from connInfoSecretSource

func IsMarkedAsPoweredOff added in v0.41.0

func IsMarkedAsPoweredOff(o client.Object) bool

IsMarkedAsPoweredOff returns true when the running annotation explicitly marks a service as powered off.

func IsReadyToUse added in v0.30.0

func IsReadyToUse(o client.Object) bool

IsReadyToUse returns true when the client.Object's controller has processed the latest manifest changes and the resource is in a running state in Aiven. For services, this includes both running and powered-off states. This indicates the resource is ready for use and has reached its desired state.

func NewAivenGeneratedClient added in v0.18.0

func NewAivenGeneratedClient(token, kubeVersion, operatorVersion string) (avngen.Client, error)

NewAivenGeneratedClient returns Aiven generated client client (aiven/go-client-codegen)

func NewNotFound added in v0.18.0

func NewNotFound(msg string) error

func NilIfZero added in v0.29.0

func NilIfZero[T comparable](v T) *T

NilIfZero returns a pointer to the value, or nil if the value equals its zero value

func SetupControllers added in v0.9.0

func SetupControllers(mgr ctrl.Manager, defaultToken, kubeVersion, operatorVersion string) error

func SetupControllersWithConfig added in v0.35.0

func SetupControllersWithConfig(mgr ctrl.Manager, cfg SetupConfig) error

func UpdateUserConfiguration added in v0.14.0

func UpdateUserConfiguration(userConfig any) (map[string]any, error)

Types

type AivenController added in v0.35.0

type AivenController[T v1alpha1.AivenManagedObject] interface {
	// Observe the external resource and return its current state.
	// This method should:
	// - Check if the resource exists on Aiven side
	// - Verify preconditions (e.g., parent service is running)
	// - Determine if the resource is up-to-date with the desired state
	// - Fetch connection details (credentials, etc.)
	// - Update status fields on the object if needed
	//
	// Observe should be idempotent and not modify the external resource.
	Observe(ctx context.Context, obj T) (Observation, error)

	// Create a new resource.
	// This is called when Observe indicates the resource doesn't exist.
	// It may return optional information about the created external resource (for example, connection details).
	Create(ctx context.Context, obj T) (CreateResult, error)

	// Update an existing resource.
	// This is called when Observe indicates the resource exists but is not up-to-date.
	Update(ctx context.Context, obj T) (UpdateResult, error)

	// Delete the resource.
	// This is called when the Kubernetes object is being deleted.
	// If the resource is already deleted (not found), should return nil.
	Delete(ctx context.Context, obj T) error
}

AivenController manages the lifecycle of a resource. Controllers implement this interface to define how to process their specific resource type. Implementations are expected to update status fields and annotations directly on obj.

type ClickhouseDatabaseController added in v0.41.0

type ClickhouseDatabaseController struct {
	client.Client
	// contains filtered or unexported fields
}

ClickhouseDatabaseController reconciles a ClickhouseDatabase object.

func (*ClickhouseDatabaseController) Create added in v0.41.0

func (*ClickhouseDatabaseController) Delete added in v0.41.0

func (*ClickhouseDatabaseController) Observe added in v0.41.0

func (*ClickhouseDatabaseController) Update added in v0.41.0

type ClickhouseGrantController added in v0.41.0

type ClickhouseGrantController struct {
	client.Client
	// contains filtered or unexported fields
}

ClickhouseGrantController reconciles a ClickhouseGrant object.

func (*ClickhouseGrantController) Create added in v0.41.0

func (*ClickhouseGrantController) Delete added in v0.41.0

func (*ClickhouseGrantController) Observe added in v0.41.0

func (*ClickhouseGrantController) Update added in v0.41.0

type ClickhouseReconciler added in v0.3.0

type ClickhouseReconciler struct {
	Controller
}

ClickhouseReconciler reconciles a Clickhouse object

func (*ClickhouseReconciler) Reconcile added in v0.3.0

func (r *ClickhouseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ClickhouseReconciler) SetupWithManager added in v0.3.0

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

SetupWithManager sets up the controller with the Manager.

type ClickhouseRoleController added in v0.43.0

type ClickhouseRoleController struct {
	client.Client
	// contains filtered or unexported fields
}

ClickhouseRoleController reconciles a ClickhouseRole object.

func (*ClickhouseRoleController) Create added in v0.43.0

func (*ClickhouseRoleController) Delete added in v0.43.0

func (*ClickhouseRoleController) Observe added in v0.43.0

func (*ClickhouseRoleController) Update added in v0.43.0

type ClickhouseUserController added in v0.35.0

type ClickhouseUserController struct {
	client.Client
	// contains filtered or unexported fields
}

ClickhouseUserController reconciles a ClickhouseUser object

func (*ClickhouseUserController) Create added in v0.35.0

func (*ClickhouseUserController) Delete added in v0.35.0

func (*ClickhouseUserController) Observe added in v0.35.0

func (*ClickhouseUserController) Update added in v0.35.0

type ConnectionPoolController added in v0.41.0

type ConnectionPoolController struct {
	client.Client
	// contains filtered or unexported fields
}

ConnectionPoolController reconciles a ConnectionPool object.

func (*ConnectionPoolController) Create added in v0.41.0

func (*ConnectionPoolController) Delete added in v0.41.0

func (*ConnectionPoolController) Observe added in v0.41.0

func (*ConnectionPoolController) Update added in v0.41.0

type Controller

type Controller struct {
	client.Client

	Log             logr.Logger
	Scheme          *runtime.Scheme
	Recorder        record.EventRecorder
	DefaultToken    string
	KubeVersion     string
	OperatorVersion string
	PollInterval    time.Duration
	// contains filtered or unexported fields
}

Controller reconciles the Aiven objects

type CreateResult added in v0.35.0

type CreateResult = Observation

CreateResult is returned from Create and carries optional information about the created external resource (for example, connection details).

type DatabaseController added in v0.43.0

type DatabaseController struct {
	client.Client
	// contains filtered or unexported fields
}

DatabaseController reconciles a Database object.

func (*DatabaseController) Create added in v0.43.0

func (*DatabaseController) Delete added in v0.43.0

func (*DatabaseController) Observe added in v0.43.0

func (*DatabaseController) Update added in v0.43.0

type ErrRequeueNeeded added in v0.35.0

type ErrRequeueNeeded struct {
	OriginalError error
}

ErrRequeueNeeded is an error type that indicates that the reconciliation should be requeued. It is used to handle errors that are expected to be resolved on a subsequent retries.

func (ErrRequeueNeeded) Error added in v0.35.0

func (e ErrRequeueNeeded) Error() string

func (ErrRequeueNeeded) Unwrap added in v0.35.0

func (e ErrRequeueNeeded) Unwrap() error

type FlinkReconciler added in v0.26.0

type FlinkReconciler struct {
	Controller
}

FlinkReconciler reconciles a Flink object

func (*FlinkReconciler) Reconcile added in v0.26.0

func (r *FlinkReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*FlinkReconciler) SetupWithManager added in v0.26.0

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

SetupWithManager sets up the controller with the Manager.

type GrafanaReconciler added in v0.7.0

type GrafanaReconciler struct {
	Controller
}

GrafanaReconciler reconciles a Grafana object

func (*GrafanaReconciler) Reconcile added in v0.7.0

func (r *GrafanaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*GrafanaReconciler) SetupWithManager added in v0.7.0

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

SetupWithManager sets up the controller with the Manager.

type Handlers

type Handlers interface {
	// contains filtered or unexported methods
}

Handlers represents Aiven API handlers It intended to be a layer between Kubernetes and Aiven API that handles all aspects of the Aiven services lifecycle.

type KafkaACLController added in v0.41.0

type KafkaACLController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaACLController reconciles a KafkaACL object

func (*KafkaACLController) Create added in v0.41.0

func (*KafkaACLController) Delete added in v0.41.0

func (*KafkaACLController) Observe added in v0.41.0

func (*KafkaACLController) Update added in v0.41.0

type KafkaConnectReconciler

type KafkaConnectReconciler struct {
	Controller
}

KafkaConnectReconciler reconciles a KafkaConnect object

func (*KafkaConnectReconciler) Reconcile

func (r *KafkaConnectReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*KafkaConnectReconciler) SetupWithManager

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

type KafkaConnectorController added in v0.43.0

type KafkaConnectorController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaConnectorController reconciles a KafkaConnector object.

func (*KafkaConnectorController) Create added in v0.43.0

func (*KafkaConnectorController) Delete added in v0.43.0

func (*KafkaConnectorController) Observe added in v0.43.0

func (*KafkaConnectorController) Update added in v0.43.0

type KafkaNativeACLController added in v0.41.0

type KafkaNativeACLController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaNativeACLController reconciles a KafkaNativeACL object.

func (*KafkaNativeACLController) Create added in v0.41.0

func (*KafkaNativeACLController) Delete added in v0.41.0

func (*KafkaNativeACLController) Observe added in v0.41.0

func (*KafkaNativeACLController) Update added in v0.41.0

Update is a no-op: the spec is immutable, so an existing ACL never needs updating.

type KafkaQuotaController added in v0.41.0

type KafkaQuotaController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaQuotaController reconciles a KafkaQuota object.

func (*KafkaQuotaController) Create added in v0.41.0

func (*KafkaQuotaController) Delete added in v0.41.0

func (*KafkaQuotaController) Observe added in v0.41.0

func (*KafkaQuotaController) Update added in v0.41.0

type KafkaReconciler

type KafkaReconciler struct {
	Controller
}

KafkaReconciler reconciles a Kafka object

func (*KafkaReconciler) Reconcile

func (r *KafkaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*KafkaReconciler) SetupWithManager

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

type KafkaSchemaController added in v0.38.0

type KafkaSchemaController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaSchemaController reconciles a KafkaSchema object.

func (*KafkaSchemaController) Create added in v0.38.0

func (*KafkaSchemaController) Delete added in v0.38.0

func (*KafkaSchemaController) Observe added in v0.38.0

Observe decides whether the registry already serves what the spec describes. Drift detection is driven by an annotation fingerprint of the last applied schema.

func (*KafkaSchemaController) Update added in v0.38.0

type KafkaSchemaRegistryACLController added in v0.41.0

type KafkaSchemaRegistryACLController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaSchemaRegistryACLController reconciles a KafkaSchemaRegistryACL object

func (*KafkaSchemaRegistryACLController) Create added in v0.41.0

func (*KafkaSchemaRegistryACLController) Delete added in v0.41.0

func (*KafkaSchemaRegistryACLController) Observe added in v0.41.0

func (*KafkaSchemaRegistryACLController) Update added in v0.41.0

Update is no-op.

type KafkaTopicController added in v0.36.0

type KafkaTopicController struct {
	client.Client
	// contains filtered or unexported fields
}

KafkaTopicController reconciles a KafkaTopic object

func (*KafkaTopicController) Create added in v0.36.0

func (*KafkaTopicController) Delete added in v0.36.0

func (*KafkaTopicController) Observe added in v0.36.0

func (*KafkaTopicController) Update added in v0.36.0

type MySQLReconciler added in v0.6.0

type MySQLReconciler struct {
	Controller
}

MySQLReconciler reconciles a MySQL object

func (*MySQLReconciler) Reconcile added in v0.6.0

func (r *MySQLReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*MySQLReconciler) SetupWithManager added in v0.6.0

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

SetupWithManager sets up the controller with the Manager.

type Observation added in v0.35.0

type Observation struct {
	// ResourceExists indicates whether the external resource exists on Aiven side.
	ResourceExists bool

	// ResourceUpToDate indicates whether the external resource matches the desired state.
	// Only meaningful when ResourceExists is true.
	ResourceUpToDate bool

	// SecretDetails contains secret data for the resource (credentials, endpoints, CA certs, etc.).
	// Will be written to the connInfoSecretTarget if not nil and not empty.
	// Keys should NOT include prefixes - the reconciler will apply the appropriate prefix.
	// Example keys: "HOST", "PORT", "USERNAME", "PASSWORD", "CA_CERT"
	SecretDetails SecretDetails
}

Observation is the result of observing the resource. Can be extended with additional fields as needed.

type OpenSearchACLConfigController added in v0.37.0

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

OpenSearchACLConfigController reconciles an OpenSearchACLConfig object.

func (*OpenSearchACLConfigController) Create added in v0.37.0

func (*OpenSearchACLConfigController) Delete added in v0.37.0

func (*OpenSearchACLConfigController) Observe added in v0.37.0

func (*OpenSearchACLConfigController) Update added in v0.37.0

type OpenSearchHandler added in v0.3.0

type OpenSearchHandler struct{}

type OpenSearchReconciler added in v0.3.0

type OpenSearchReconciler struct {
	Controller
}

OpenSearchReconciler reconciles a OpenSearch object

func (*OpenSearchReconciler) Reconcile added in v0.3.0

func (r *OpenSearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*OpenSearchReconciler) SetupWithManager added in v0.3.0

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

SetupWithManager sets up the controller with the Manager.

type PasswordSource added in v0.31.0

type PasswordSource interface {
	metav1.Object
	GetConnInfoSecretSource() *v1alpha1.ConnInfoSecretSource
}

PasswordSource defines an interface for resources that can provide password sources

type PostgreSQLReconciler

type PostgreSQLReconciler struct {
	Controller
}

PostgreSQLReconciler reconciles a PostgreSQL object

func (*PostgreSQLReconciler) Reconcile

func (r *PostgreSQLReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*PostgreSQLReconciler) SetupWithManager

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

type ProjectController added in v0.41.0

type ProjectController struct {
	client.Client
	// contains filtered or unexported fields
}

ProjectController reconciles a Project object.

func (*ProjectController) Create added in v0.41.0

func (*ProjectController) Delete added in v0.41.0

func (r *ProjectController) Delete(ctx context.Context, project *v1alpha1.Project) error

func (*ProjectController) Observe added in v0.41.0

func (*ProjectController) Update added in v0.41.0

type ProjectVPCHandler

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

type ProjectVPCReconciler

type ProjectVPCReconciler struct {
	Controller
}

ProjectVPCReconciler reconciles a ProjectVPC object

func (*ProjectVPCReconciler) Reconcile

func (r *ProjectVPCReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ProjectVPCReconciler) SetupWithManager

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

type Reconciler added in v0.35.0

type Reconciler[T v1alpha1.AivenManagedObject] struct {
	Controller
	// contains filtered or unexported fields
}

Reconciler handles the boilerplate reconciliation logic for Aiven resources. It orchestrates the ExternalClient lifecycle methods and manages: - Finalizers - Status conditions - Secrets (connection details) - Events - Requeue logic

func (*Reconciler[T]) Reconcile added in v0.35.0

func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

Reconcile performs the full reconciliation loop for a managed resource.

func (*Reconciler[T]) SetupWithManager added in v0.35.0

func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*Reconciler[T]) WithIndexes added in v0.39.0

func (r *Reconciler[T]) WithIndexes(fns ...func(context.Context, ctrl.Manager) error) *Reconciler[T]

WithIndexes registers field indexers for the controller-runtime cache.

func (*Reconciler[T]) WithWatches added in v0.39.0

func (r *Reconciler[T]) WithWatches(fns ...func(*builder.Builder) *builder.Builder) *Reconciler[T]

WithWatches registers extra watches that compose with the controller's builder.

type SecretDetails added in v0.35.0

type SecretDetails = map[string]string

type SecretFinalizerGCController

type SecretFinalizerGCController struct {
	client.Client

	Log logr.Logger
}

SecretFinalizerGCController manages the protection finalizer of the client token secrets, to give the controllers a chance to delete the aiven instances

func (*SecretFinalizerGCController) Reconcile

func (*SecretFinalizerGCController) SetupWithManager

func (c *SecretFinalizerGCController) SetupWithManager(mgr ctrl.Manager, hasDefaultToken bool) error

type SecretSourceResource added in v0.32.0

type SecretSourceResource interface {
	client.Object
	GetConnInfoSecretSource() *v1alpha1.ConnInfoSecretSource
}

SecretSourceResource defines an interface for resources that can have connInfoSecretSource

type SecretWatchController added in v0.32.0

type SecretWatchController struct {
	client.Client

	Log logr.Logger
}

SecretWatchController watches for changes to secrets referenced by connInfoSecretSource and triggers reconciliation of the dependent resources

func (*SecretWatchController) Reconcile added in v0.32.0

func (c *SecretWatchController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*SecretWatchController) SetupWithManager added in v0.32.0

func (c *SecretWatchController) SetupWithManager(mgr ctrl.Manager) error

type ServiceIntegrationController added in v0.36.0

type ServiceIntegrationController struct {
	client.Client
	// contains filtered or unexported fields
}

ServiceIntegrationController reconciles a ServiceIntegration object

func (*ServiceIntegrationController) Create added in v0.36.0

func (*ServiceIntegrationController) Delete added in v0.36.0

func (*ServiceIntegrationController) Observe added in v0.36.0

func (*ServiceIntegrationController) Update added in v0.36.0

type ServiceIntegrationEndpointController added in v0.41.0

type ServiceIntegrationEndpointController struct {
	client.Client
	// contains filtered or unexported fields
}

ServiceIntegrationEndpointController reconciles a ServiceIntegrationEndpoint object

func (*ServiceIntegrationEndpointController) Create added in v0.41.0

func (*ServiceIntegrationEndpointController) Delete added in v0.41.0

func (*ServiceIntegrationEndpointController) Observe added in v0.41.0

func (*ServiceIntegrationEndpointController) Update added in v0.41.0

type ServiceUserController added in v0.36.0

type ServiceUserController struct {
	client.Client
	// contains filtered or unexported fields
}

ServiceUserController reconciles a ServiceUser object

func (*ServiceUserController) Create added in v0.36.0

func (*ServiceUserController) Delete added in v0.36.0

func (*ServiceUserController) Observe added in v0.36.0

func (*ServiceUserController) Update added in v0.36.0

type SetupConfig added in v0.35.0

type SetupConfig struct {
	DefaultToken    string
	KubeVersion     string
	OperatorVersion string
	PollInterval    time.Duration
}

type UpdateResult added in v0.35.0

type UpdateResult = Observation

UpdateResult is returned from Update and carries optional information about the external resource (for example, connection details).

type UpgradePipelineStepController added in v0.40.0

type UpgradePipelineStepController struct {
	client.Client
	// contains filtered or unexported fields
}

UpgradePipelineStepController reconciles an UpgradePipelineStep object.

func (*UpgradePipelineStepController) Create added in v0.40.0

func (*UpgradePipelineStepController) Delete added in v0.40.0

func (*UpgradePipelineStepController) Observe added in v0.40.0

func (*UpgradePipelineStepController) Update added in v0.40.0

type ValkeyHandler added in v0.27.0

type ValkeyHandler struct{}

type ValkeyReconciler added in v0.27.0

type ValkeyReconciler struct {
	Controller
}

ValkeyReconciler reconciles a Valkey object

func (*ValkeyReconciler) Reconcile added in v0.27.0

func (r *ValkeyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ValkeyReconciler) SetupWithManager added in v0.27.0

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