Documentation
¶
Index ¶
- Variables
- func BuildReconcileRequests(ctx context.Context, client client.Client, scheme *runtime.Scheme, ...) []reconcile.Request
- func ComputeEnvVar(format string, keys ...string) string
- func CopyDir(f fs.FS, root, path string, ret *map[string]string)
- func CreateOrUpdate[T client.Object](ctx Context, key types.NamespacedName, mutators ...ObjectMutator[T]) (T, controllerutil.OperationResult, error)
- func DeleteIfExists[T client.Object](ctx Context, name types.NamespacedName) error
- func Env(name string, value string) corev1.EnvVar
- func EnvFromBool(name string, vb bool) corev1.EnvVar
- func EnvFromConfig(name, configName, key string) corev1.EnvVar
- func EnvFromSecret(name, secretName, key string) corev1.EnvVar
- func EnvVarPlaceholder(key string) string
- func GetAllStackDependencies(ctx Context, stackName string, to any) error
- func GetDevEnvVars(stack *v1beta1.Stack, service interface{ ... }) []corev1.EnvVar
- func GetIfExists(ctx Context, stackName string, to client.Object) (bool, error)
- func GetModuleVersion(ctx Context, stack *v1beta1.Stack, module v1beta1.Module) (string, error)
- func GetNamespacedResourceName(namespace, name string) types.NamespacedName
- func GetObjectName(stack, name string) string
- func GetResourceName(name string) types.NamespacedName
- func GetSingleDependency(ctx Context, stackName string, to client.Object) error
- func GetSpecFromUnstructured(u *unstructured.Unstructured) (map[string]any, bool)
- func GetStackNameFromUnstructured(u *unstructured.Unstructured) (string, bool)
- func HasControllerReference(ctx Context, owner client.Object, object client.Object) (bool, error)
- func HasDependency(ctx Context, stackName string, to client.Object) (bool, error)
- func HasOwnerReference(ctx Context, owner client.Object, object client.Object) (bool, error)
- func HashFromConfigMaps(configMaps ...*corev1.ConfigMap) string
- func HashFromResources(resources ...*unstructured.Unstructured) string
- func Init(i ...Initializer)
- func IsApplicationError(err error) bool
- func IsGreaterOrEqual(version string, than string) bool
- func IsLower(version string, than string) bool
- func ListEventPublishers(ctx Context, stackName string) ([]unstructured.Unstructured, error)
- func LogDeletion(ctx Context, obj client.Object, caller string)
- func LowerCamelCaseKind(ctx Context, ob client.Object) string
- func LowerCaseKind(ctx Context, ob client.Object) string
- func MapObjectToReconcileRequests[T client.Object](items ...T) []reconcile.Request
- func MergeEnvVars(base, overrides []corev1.EnvVar) []corev1.EnvVar
- func NewContext(mgr Manager, ctx context.Context) *defaultContext
- func NewDefaultManager(m ctrl.Manager, platform Platform) *defaultManager
- func NewVolumeFromConfigMap(name string, configMap *corev1.ConfigMap) corev1.Volume
- func NewVolumeMount(name, mountPath string, readOnly bool) corev1.VolumeMount
- func Setup(mgr ctrl.Manager, platform Platform) error
- func ShellScript(cmd string, args ...any) []string
- func Watch(mgr Manager, t client.Object) func(ctx context.Context, object client.Object) []reconcile.Request
- func WatchDependents(mgr Manager, t client.Object) func(ctx context.Context, object client.Object) []reconcile.Request
- func WithTemporaryNamespace(ctx Context, name string, callback func() error) error
- func WithWatchVersions[T client.Object](options *ReconcilerOptions[T])
- type ApplicationError
- type Context
- type Finalizer
- type Initializer
- func WithIndex[T client.Object](name string, eval func(t T) []string) Initializer
- func WithModuleReconciler[T v1beta1.Module](fn func(ctx Context, stack *v1beta1.Stack, req T, version string) error, ...) Initializer
- func WithResourceReconciler[T v1beta1.Dependent](fn func(ctx Context, stack *v1beta1.Stack, req T) error, ...) Initializer
- func WithSimpleIndex[T client.Object](name string, eval func(t T) string) Initializer
- func WithStackDependencyReconciler[T v1beta1.Dependent](fn func(ctx Context, stack *v1beta1.Stack, req T) error, ...) Initializer
- func WithStdReconciler[T v1beta1.Object](ctrl func(ctx Context, req T) error, opts ...ReconcilerOption[T]) Initializer
- type Manager
- type ModuleController
- type ObjectController
- type ObjectMutator
- func WithAnnotations[T client.Object](newAnnotations map[string]string) ObjectMutator[T]
- func WithController[T client.Object](scheme *k8sruntime.Scheme, owner client.Object) ObjectMutator[T]
- func WithLabels[T client.Object](newLabels map[string]string) ObjectMutator[T]
- func WithOwner[T client.Object](scheme *k8sruntime.Scheme, owner client.Object) ObjectMutator[T]
- type Platform
- type ReconcilerOption
- func WithFinalizer[T client.Object](name string, callback Finalizer[T]) ReconcilerOption[T]
- func WithOwn[T client.Object](v client.Object, opts ...builder.OwnsOption) ReconcilerOption[T]
- func WithRaw[T client.Object](fn func(Context, *builder.Builder) error) ReconcilerOption[T]
- func WithWatch[T client.Object, WATCHED client.Object](fn func(ctx Context, object WATCHED) []reconcile.Request) ReconcilerOption[T]
- func WithWatchDependency[T client.Object](t v1beta1.Dependent) ReconcilerOption[T]
- func WithWatchSettings[T client.Object]() ReconcilerOption[T]
- func WithWatchStack[T client.Object]() ReconcilerOption[T]
- type ReconcilerOptions
- type ReconcilerOptionsWatch
- type StackDependentObjectController
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("no configuration found") ErrMultipleInstancesFound = errors.New("multiple resources found") )
var ErrNoVersionFound = errors.New("no version found")
ErrNoVersionFound is returned when no version can be resolved for a module through any of the configured sources (module, stack, or versionsFromFile).
Functions ¶
func BuildReconcileRequests ¶
func ComputeEnvVar ¶
func CreateOrUpdate ¶
func CreateOrUpdate[T client.Object](ctx Context, key types.NamespacedName, mutators ...ObjectMutator[T]) (T, controllerutil.OperationResult, error)
func DeleteIfExists ¶
func EnvFromConfig ¶
func EnvFromSecret ¶
func EnvVarPlaceholder ¶
func GetAllStackDependencies ¶
func GetDevEnvVars ¶
func GetDevEnvVars(stack *v1beta1.Stack, service interface { IsDebug() bool IsDev() bool }) []corev1.EnvVar
TODO: The stack reconciler can create a config map container env var for dev and debug This way, we avoid the need to fetch the stack object at each reconciliation loop
func GetModuleVersion ¶
func GetNamespacedResourceName ¶
func GetNamespacedResourceName(namespace, name string) types.NamespacedName
func GetObjectName ¶
func GetResourceName ¶
func GetResourceName(name string) types.NamespacedName
func GetSingleDependency ¶
func GetSpecFromUnstructured ¶ added in v3.8.1
func GetSpecFromUnstructured(u *unstructured.Unstructured) (map[string]any, bool)
GetSpecFromUnstructured safely extracts .spec as map[string]any.
func GetStackNameFromUnstructured ¶ added in v3.8.1
func GetStackNameFromUnstructured(u *unstructured.Unstructured) (string, bool)
GetStackNameFromUnstructured safely extracts .spec.stack from an unstructured object.
func HasControllerReference ¶
func HasDependency ¶
func HasOwnerReference ¶
func HashFromConfigMaps ¶
func HashFromResources ¶
func HashFromResources(resources ...*unstructured.Unstructured) string
func Init ¶
func Init(i ...Initializer)
func IsApplicationError ¶
func IsGreaterOrEqual ¶
func ListEventPublishers ¶
func ListEventPublishers(ctx Context, stackName string) ([]unstructured.Unstructured, error)
func MergeEnvVars ¶ added in v3.8.2
MergeEnvVars merges overrides into base env vars with deduplication. Keys from overrides take precedence. The result is sorted by env var name for deterministic output that avoids unnecessary Kubernetes reconciliations.
func NewContext ¶
func NewDefaultManager ¶
func NewVolumeFromConfigMap ¶
func NewVolumeMount ¶
func NewVolumeMount(name, mountPath string, readOnly bool) corev1.VolumeMount
func ShellScript ¶
func WatchDependents ¶
func WithTemporaryNamespace ¶
func WithWatchVersions ¶
func WithWatchVersions[T client.Object](options *ReconcilerOptions[T])
Types ¶
type ApplicationError ¶
type ApplicationError struct {
// contains filtered or unexported fields
}
func NewApplicationError ¶
func NewApplicationError() *ApplicationError
func NewMissingSettingsError ¶
func NewMissingSettingsError(msg string) *ApplicationError
func NewPendingError ¶
func NewPendingError() *ApplicationError
func NewStackNotFoundError ¶
func NewStackNotFoundError() *ApplicationError
func (*ApplicationError) Error ¶
func (e *ApplicationError) Error() string
func (*ApplicationError) Is ¶
func (e *ApplicationError) Is(err error) bool
func (*ApplicationError) WithMessage ¶
func (e *ApplicationError) WithMessage(msg string, args ...any) *ApplicationError
type Initializer ¶
func WithModuleReconciler ¶
func WithModuleReconciler[T v1beta1.Module](fn func(ctx Context, stack *v1beta1.Stack, req T, version string) error, opts ...ReconcilerOption[T]) Initializer
func WithResourceReconciler ¶
func WithResourceReconciler[T v1beta1.Dependent](fn func(ctx Context, stack *v1beta1.Stack, req T) error, opts ...ReconcilerOption[T]) Initializer
func WithSimpleIndex ¶
func WithSimpleIndex[T client.Object](name string, eval func(t T) string) Initializer
func WithStackDependencyReconciler ¶
func WithStackDependencyReconciler[T v1beta1.Dependent](fn func(ctx Context, stack *v1beta1.Stack, req T) error, opts ...ReconcilerOption[T]) Initializer
func WithStdReconciler ¶
func WithStdReconciler[T v1beta1.Object](ctrl func(ctx Context, req T) error, opts ...ReconcilerOption[T]) Initializer
type ModuleController ¶
type ObjectController ¶
type ObjectController[T client.Object] func(ctx Context, reconcilerOptions *ReconcilerOptions[T], req T) error
func ForObjectController ¶
func ForObjectController[T v1beta1.Object](controller ObjectController[T]) ObjectController[T]
func ForStackDependency ¶
func ForStackDependency[T v1beta1.Dependent](ctrl StackDependentObjectController[T], allowDeleted bool) ObjectController[T]
type ObjectMutator ¶
func WithAnnotations ¶
func WithAnnotations[T client.Object](newAnnotations map[string]string) ObjectMutator[T]
func WithController ¶
func WithController[T client.Object](scheme *k8sruntime.Scheme, owner client.Object) ObjectMutator[T]
func WithLabels ¶
func WithLabels[T client.Object](newLabels map[string]string) ObjectMutator[T]
func WithOwner ¶
func WithOwner[T client.Object](scheme *k8sruntime.Scheme, owner client.Object) ObjectMutator[T]
type ReconcilerOption ¶
type ReconcilerOption[T client.Object] func(*ReconcilerOptions[T])
func WithFinalizer ¶
func WithFinalizer[T client.Object](name string, callback Finalizer[T]) ReconcilerOption[T]
func WithOwn ¶
func WithOwn[T client.Object](v client.Object, opts ...builder.OwnsOption) ReconcilerOption[T]
func WithWatchDependency ¶
func WithWatchDependency[T client.Object](t v1beta1.Dependent) ReconcilerOption[T]
func WithWatchSettings ¶
func WithWatchSettings[T client.Object]() ReconcilerOption[T]
func WithWatchStack ¶
func WithWatchStack[T client.Object]() ReconcilerOption[T]
type ReconcilerOptions ¶
type ReconcilerOptionsWatch ¶
type ReconcilerOptionsWatch struct {
Handler func(mgr Manager, builder *builder.Builder, target client.Object) (handler.EventHandler, []builder.WatchesOption)
}
type StackDependentObjectController ¶
type StackDependentObjectController[T v1beta1.Dependent] func(ctx Context, stack *v1beta1.Stack, reconcilerOptions *ReconcilerOptions[T], req T) error
func ForModule ¶
func ForModule[T v1beta1.Module](underlyingController ModuleController[T]) StackDependentObjectController[T]