controller

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHookFailed indicates a hook executed and failed.
	ErrHookFailed = errors.New("hook failed")
	// ErrHookInProgress indicates a hook is currently running.
	ErrHookInProgress = errors.New("hook in progress")
)

Functions

This section is empty.

Types

type DirectSetupRunner added in v0.11.0

type DirectSetupRunner struct {
	// Executor is an optional SQLExecutor (e.g. *sql.DB). If nil, RunSetupSQL connects using adminDSN.
	Executor SQLExecutor
}

DirectSetupRunner executes setup SQL in-process if it was not already handled by the database provider. This is the default runner for Diverge.

func (*DirectSetupRunner) RunSetupSQL added in v0.11.0

func (r *DirectSetupRunner) RunSetupSQL(ctx context.Context, env *divergeiov1alpha1.Environment, setupSQL, adminDSN string) error

RunSetupSQL executes setup SQL in-process against the admin DSN or using the configured executor.

type EnvironmentReconciler

type EnvironmentReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	Recorder         *events.Recorder
	Router           routing.Router
	DatabaseProvider database.DatabaseProvider
	ChangeDetector   changeset.ChangeDetector
	Notifier         notifier.Notifier
	StatusReporter   notifier.StatusReporter
	Deployer         deployer.Deployer
	TestRunner       divtesting.TestRunner
	AsyncProvisioner async.Provisioner
	FeatureProvider  features.FeatureProvider
	SetupJobImage    string
	SetupRunner      SetupRunner
}

EnvironmentReconciler reconciles a Environment object

func (*EnvironmentReconciler) Reconcile

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

Reconcile performs its designated operation.

func (*EnvironmentReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type HookJobConfig added in v0.7.0

type HookJobConfig struct {
	JobName      string
	Namespace    string
	Image        string
	Args         []string
	EnvVars      []corev1.EnvVar
	EnvFrom      []corev1.EnvFromSource
	Volumes      []corev1.Volume
	VolumeMounts []corev1.VolumeMount
	Timeout      int32
	Owner        metav1.Object
	Labels       map[string]string
}

HookJobConfig holds the parameters for creating a hook Job.

type JobSetupRunner added in v0.11.0

type JobSetupRunner struct {
	Reconciler *EnvironmentReconciler
}

JobSetupRunner executes setup SQL via a Kubernetes Job for isolated environments. Deprecated: In-process database setup via SQLExecutor is preferred for performance, reliability, and security.

func (*JobSetupRunner) RunSetupSQL added in v0.11.0

func (r *JobSetupRunner) RunSetupSQL(ctx context.Context, env *divergeiov1alpha1.Environment, setupSQL, adminDSN string) error

RunSetupSQL delegates execution to the reconciler's runSetupSQLJob method.

type PreviewGroupReconciler

type PreviewGroupReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	Recorder         *events.Recorder
	Notifier         notifier.PreviewGroupNotifier
	StatusReporter   notifier.StatusReporter
	DatabaseProvider database.DatabaseProvider
	EnableGAMMA      bool // Enable GAMMA mesh routing (requires Istio Ambient)
}

PreviewGroupReconciler reconciles a PreviewGroup object. It acts as an "operator of operators", creating and managing child Environment CRs for each service in the group.

func (*PreviewGroupReconciler) Reconcile

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

Reconcile performs its designated operation.

func (*PreviewGroupReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SQLExecutor added in v0.11.0

type SQLExecutor interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

SQLExecutor defines the contract for executing SQL queries.

type SetupRunner added in v0.11.0

type SetupRunner interface {
	RunSetupSQL(ctx context.Context, env *divergeiov1alpha1.Environment, setupSQL, adminDSN string) error
}

SetupRunner executes initial DDL or schema setup for provisioned databases.

Jump to

Keyboard shortcuts

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