controller

package
v0.0.0-...-ed0ccfb Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RatioForJitter = 2
)

Variables

View Source
var (
	// ErrNewSecret is returned when a secret was not able to be retrieved and so a new secret
	// was generated.
	ErrNewSecret = errors.New("creating new secret")

	// ErrNewStatefulSet is returned when a statefulset was not able to be retrieved and
	// so a new statefulset was generated.
	ErrNewStatefulSet = errors.New("creating new statefulset")

	// ErrNewService is returned when a service was not able to be retrieved and
	// so a new service was generated.
	ErrNewService = errors.New("creating new service")

	// ErrSecretImmutable is returned when a secret is immutable and can not be changed.
	ErrSecretImmutable = errors.New("secret is immutable")
)

Functions

func AddPGBouncerConf

func AddPGBouncerConf(
	accountSvr accountsvr.Server,
	secret *corev1.Secret,
)

func GetLogConstructor

func GetLogConstructor(mgr manager.Manager, obj runtime.Object) (func(*reconcile.Request) logr.Logger, error)

func GetSecretKV

func GetSecretKV(secret *corev1.Secret, key string) string

func NewDatabaseAccountName

func NewDatabaseAccountName(_ context.Context) dbov1.PostgreSQLResourceName

NewDatabaseAccountName returns a newly generated database/username.

func SecretAddOwnerRefs

func SecretAddOwnerRefs(secret *corev1.Secret, dbAccount *dbov1.DatabaseAccount)

func SecretGet

func SecretGet(ctx context.Context, r client.Reader, dbAccount *dbov1.DatabaseAccount) (*corev1.Secret, error)

func SecretGetByName

func SecretGetByName(ctx context.Context, r client.Reader, name types.NamespacedName) (*corev1.Secret, error)

func SecretRun

func SecretRun(
	ctx context.Context,
	r client.Reader,
	w client.Writer,
	accountSvr accountsvr.Server,
	dbAccount *dbov1.DatabaseAccount,
	f SecretFunc,
) error

func ServiceGet

func ServiceGet(
	ctx context.Context,
	r client.Reader,
	dbAccount *dbov1.DatabaseAccount,
) (*corev1.Service, error)

func SetSecretKV

func SetSecretKV(secret *corev1.Secret, key, value string)

Types

type DatabaseAccountReconciler

type DatabaseAccountReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	Recorder      Recorder
	AccountServer accountsvr.Server
	Config        *dbov1.DatabaseAccountControllerConfig
}

DatabaseAccountReconciler reconciles a DatabaseAccount object.

func (*DatabaseAccountReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the DatabaseAccount object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile

func (*DatabaseAccountReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type Recorder

type Recorder interface {
	NormalEvent(*v1.DatabaseAccount, RecorderReason, string)
	WarningEvent(*v1.DatabaseAccount, RecorderReason, string)
}

func NewRecorder

func NewRecorder(r record.EventRecorder) Recorder

type RecorderEventType

type RecorderEventType string
const (
	RecorderNormal  RecorderEventType = "Normal"
	RecorderWarning RecorderEventType = "Warning"
)

func (RecorderEventType) String

func (r RecorderEventType) String() string

type RecorderReason

type RecorderReason string
const (
	ReasonQueued         RecorderReason = "Queued"
	ReasonUserCreate     RecorderReason = "UserCreate"
	ReasonDatabaseCreate RecorderReason = "DatabaseCreate"
	ReasonRelayCreate    RecorderReason = "RelayCreate"
	ReasonReady          RecorderReason = "Ready"
)

func (RecorderReason) String

func (r RecorderReason) String() string

type RecorderWrapper

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

func (*RecorderWrapper) Event

func (r *RecorderWrapper) Event(
	dbAccount *v1.DatabaseAccount,
	eventType RecorderEventType,
	reason RecorderReason,
	message string,
)

func (*RecorderWrapper) NormalEvent

func (r *RecorderWrapper) NormalEvent(dbAccount *v1.DatabaseAccount, reason RecorderReason, message string)

func (*RecorderWrapper) WarningEvent

func (r *RecorderWrapper) WarningEvent(dbAccount *v1.DatabaseAccount, reason RecorderReason, message string)

type SecretFunc

type SecretFunc func(secret *corev1.Secret) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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