controller

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatePending  = "PENDING_USER"
	StateApproved = "APPROVED"
	StateAborted  = "ABORTED"
	StateApplied  = "APPLIED"
)
View Source
const (
	ReasonCreatedDevDB  = "CreatedDevDB"
	ReasonCleanUpDevDB  = "CleanUpDevDB"
	ReasonScaledUpDevDB = "ScaledUpDevDB"
)

Variables

This section is empty.

Functions

func AutomaticDevDBSpec added in v0.7.18

func AutomaticDevDBSpec(drv dbv1alpha1.Driver, schemaBound bool) (*corev1.PodSpec, string, error)

AutomaticDevDBSpec returns a PodSpec for a development database based on the target URL.

Types

type AtlasDriftCheckReconciler added in v0.8.0

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

AtlasDriftCheckReconciler reconciles an AtlasDriftCheck.

It checks the target database for drift and reports the result in the resource status. It does not change the database.

func NewAtlasDriftCheckReconciler added in v0.8.0

func NewAtlasDriftCheckReconciler(mgr Manager, _ bool) *AtlasDriftCheckReconciler

func (*AtlasDriftCheckReconciler) AllowCustomConfig added in v0.8.0

func (r *AtlasDriftCheckReconciler) AllowCustomConfig()

AllowCustomConfig allows the controller to check targets that use a custom atlas.hcl config.

func (*AtlasDriftCheckReconciler) Reconcile added in v0.8.0

Reconcile runs a drift check and schedules the next one. Failures are reported in the status and retried without the controller's error backoff.

func (*AtlasDriftCheckReconciler) SetAtlasClient added in v0.8.0

func (r *AtlasDriftCheckReconciler) SetAtlasClient(fn AtlasExecFn)

SetAtlasClient sets the Atlas client for the reconciler.

func (*AtlasDriftCheckReconciler) SetupWithManager added in v0.8.0

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

SetupWithManager sets up the controller with the Manager.

type AtlasExec

type AtlasExec interface {
	// MigrateApplySlice runs the `migrate apply` command and returns the successful runs.
	MigrateApplySlice(context.Context, *atlasexec.MigrateApplyParams) ([]*atlasexec.MigrateApply, error)
	// MigrateDown runs the `migrate down` command.
	MigrateDown(context.Context, *atlasexec.MigrateDownParams) (*atlasexec.MigrateDown, error)
	// MigrateDriftSlice runs the `migrate drift` command and returns one report per target.
	MigrateDriftSlice(context.Context, *atlasexec.MigrateDriftParams) ([]*atlasexec.MigrateDrift, error)
	// MigrateStatus runs the `migrate status` command.
	MigrateStatus(context.Context, *atlasexec.MigrateStatusParams) (*atlasexec.MigrateStatus, error)
	// SchemaApplySlice runs the `schema apply` command and returns the successful runs.
	SchemaApplySlice(context.Context, *atlasexec.SchemaApplyParams) ([]*atlasexec.SchemaApply, error)
	// SchemaInspect runs the `schema inspect` command.
	SchemaInspect(ctx context.Context, params *atlasexec.SchemaInspectParams) (string, error)
	// SchemaPush runs the `schema push` command.
	SchemaPush(context.Context, *atlasexec.SchemaPushParams) (*atlasexec.SchemaPush, error)
	// SchemaPlan runs the `schema plan` command.
	SchemaPlan(context.Context, *atlasexec.SchemaPlanParams) (*atlasexec.SchemaPlan, error)
	// SchemaPlanList runs the `schema plan list` command.
	SchemaPlanList(context.Context, *atlasexec.SchemaPlanListParams) ([]atlasexec.SchemaPlanFile, error)
	// SecurityScan runs the `security scan` command.
	SecurityScan(context.Context, *atlasexec.SecurityScanParams) (*atlasexec.SecurityScan, error)
	// WhoAmI runs the `whoami` command.
	WhoAmI(context.Context, *atlasexec.WhoAmIParams) (*atlasexec.WhoAmI, error)
	// Login runs the `login` command (e.g. with --grant-only for offline tokens).
	Login(context.Context, *atlasexec.LoginParams) error
	// SetStdout specifies a writer to stream stdout to for every command.
	SetStdout(io.Writer)
	// SetStderr specifies a writer to stream stderr to for every command.
	SetStderr(io.Writer)
}

AtlasExec is the interface for the atlas exec client.

func NewAtlasExec

func NewAtlasExec(dir string, c *Cloud, home string) (AtlasExec, error)

NewAtlasExec returns a new AtlasExec with the given directory and cloud configuration. The atlas binary is expected to be in the $PATH. If DATA_DIR is set, it creates a resource-specific directory and sets HOME to it, allowing Atlas CLI to store its data (.atlas) under the mounted PVC.

type AtlasExecFn

type AtlasExecFn func(dir string, c *Cloud, home string) (AtlasExec, error)

AtlasExecFn is a function that returns an AtlasExec configured with the given working directory, cloud configuration, and HOME directory.

type AtlasMigrationReconciler

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

AtlasMigrationReconciler reconciles a AtlasMigration object

func NewAtlasMigrationReconciler

func NewAtlasMigrationReconciler(mgr Manager, prewarmDevDB bool) *AtlasMigrationReconciler

func (*AtlasMigrationReconciler) AllowCustomConfig added in v0.7.0

func (r *AtlasMigrationReconciler) AllowCustomConfig()

AllowCustomConfig allows the controller to use custom atlas.hcl config.

func (*AtlasMigrationReconciler) Reconcile

func (r *AtlasMigrationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, err 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.

func (*AtlasMigrationReconciler) SetAtlasClient added in v0.7.0

func (r *AtlasMigrationReconciler) SetAtlasClient(fn AtlasExecFn)

SetAtlasClient sets the Atlas client for the reconciler.

func (*AtlasMigrationReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*AtlasMigrationReconciler) WatchSecrets added in v0.7.48

func (r *AtlasMigrationReconciler) WatchSecrets()

WatchSecrets registers a Secret event handler so the controller re-reconciles when a referenced Secret changes. It requires list/watch on Secrets in every namespace the operator watches.

When it is not called, the caller must also keep Secrets out of the manager's cache (client.CacheOptions.DisableFor), otherwise the cache-backed client re-creates this informer on the first Secret read and blocks on it. See WATCH_SECRETS in cmd/main.go.

Either way the controller reads, creates and updates the Secret that holds the state of a local or ConfigMap migration directory, so it always needs get/create/update on Secrets in the namespaces it manages.

type AtlasSchemaReconciler

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

AtlasSchemaReconciler reconciles a AtlasSchema object

func NewAtlasSchemaReconciler

func NewAtlasSchemaReconciler(mgr Manager, prewarmDevDB bool) *AtlasSchemaReconciler

func (*AtlasSchemaReconciler) AllowCustomConfig added in v0.7.0

func (r *AtlasSchemaReconciler) AllowCustomConfig()

AllowCustomConfig allows the controller to use custom atlas.hcl config.

func (*AtlasSchemaReconciler) Reconcile

func (r *AtlasSchemaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, err 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.

func (*AtlasSchemaReconciler) SetAtlasClient added in v0.7.0

func (r *AtlasSchemaReconciler) SetAtlasClient(fn AtlasExecFn)

SetAtlasClient sets the Atlas client function.

func (*AtlasSchemaReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*AtlasSchemaReconciler) WatchSecrets added in v0.7.48

func (r *AtlasSchemaReconciler) WatchSecrets()

WatchSecrets registers a Secret event handler so the controller re-reconciles when a referenced Secret changes. It requires list/watch on Secrets in every namespace the operator watches.

When it is not called, the caller must also keep Secrets out of the manager's cache (client.CacheOptions.DisableFor), otherwise the cache-backed client re-creates this informer on the first Secret read and blocks on it. See WATCH_SECRETS in cmd/main.go.

type AtlasSecurityScanReconciler added in v0.8.0

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

AtlasSecurityScanReconciler reconciles an AtlasSecurityScan object.

func NewAtlasSecurityScanReconciler added in v0.8.0

func NewAtlasSecurityScanReconciler(mgr Manager) *AtlasSecurityScanReconciler

func (*AtlasSecurityScanReconciler) AllowCustomConfig added in v0.8.0

func (r *AtlasSecurityScanReconciler) AllowCustomConfig()

AllowCustomConfig allows the controller to use custom atlas.hcl config.

func (*AtlasSecurityScanReconciler) Reconcile added in v0.8.0

func (r *AtlasSecurityScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, err 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.

func (*AtlasSecurityScanReconciler) SetAtlasClient added in v0.8.0

func (r *AtlasSecurityScanReconciler) SetAtlasClient(fn AtlasExecFn)

SetAtlasClient sets the Atlas client function.

func (*AtlasSecurityScanReconciler) SetupWithManager added in v0.8.0

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

SetupWithManager sets up the controller with the Manager.

type Cloud

type Cloud struct {
	Token string
	Repo  string
	URL   string
}

Cloud holds the cloud configuration.

type Manager

type Manager interface {
	GetClient() client.Client
	GetAPIReader() client.Reader
	GetScheme() *runtime.Scheme
	GetEventRecorderFor(name string) record.EventRecorder
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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