spec

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 11 Imported by: 16

Documentation

Index

Constants

View Source
const (
	PGSyncUserAdd = iota
	PGsyncUserAlter
	PGSyncAlterSet // handle ALTER ROLE SET parameter = value
	PGSyncUserRename
)

Possible values for the sync user operation (removal of users is not supported yet)

Variables

This section is empty.

Functions

func GetOperatorNamespace

func GetOperatorNamespace() string

GetOperatorNamespace assumes serviceaccount secret is mounted by kubernetes Placing this func here instead of pgk/util avoids circular import

Types

type ControllerConfig

type ControllerConfig struct {
	RestConfig          *rest.Config `json:"-"`
	InfrastructureRoles map[string]PgUser

	NoDatabaseAccess     bool
	NoTeamsAPI           bool
	CRDReadyWaitInterval time.Duration
	CRDReadyWaitTimeout  time.Duration
	ConfigMapName        NamespacedName
	Namespace            string
	IgnoredAnnotations   []string

	EnableJsonLogging bool
}

ControllerConfig describes configuration of the controller

type ControllerStatus

type ControllerStatus struct {
	LastSyncTime    int64
	Clusters        int
	WorkerQueueSize map[int]int
}

ControllerStatus describes status of the controller

type Diff

type Diff struct {
	EventTime   time.Time
	ProcessTime time.Time
	Diff        []string
}

Diff describes diff

type LogEntry

type LogEntry struct {
	Time        time.Time
	Level       logrus.Level
	ClusterName *NamespacedName `json:",omitempty"`
	Worker      *uint32         `json:",omitempty"`
	Message     string
}

LogEntry describes log entry in the RingLogger

type NamespacedName

type NamespacedName types.NamespacedName

NamespacedName describes the namespace/name pairs used in Kubernetes names.

func (*NamespacedName) Decode

func (n *NamespacedName) Decode(value string) error

Decode converts a (possibly unqualified) string into the namespaced name object.

func (*NamespacedName) DecodeWorker

func (n *NamespacedName) DecodeWorker(value, operatorNamespace string) error

DecodeWorker separates the decode logic to (unit) test from obtaining the operator namespace that depends on k8s mounting files at runtime

func (NamespacedName) MarshalJSON

func (n NamespacedName) MarshalJSON() ([]byte, error)

MarshalJSON defines marshaling rule for the namespaced name type.

func (NamespacedName) String

func (n NamespacedName) String() string

func (*NamespacedName) UnmarshalJSON

func (n *NamespacedName) UnmarshalJSON(data []byte) error

UnmarshalJSON converts a byte slice to NamespacedName

type PgSyncUserRequest

type PgSyncUserRequest struct {
	Kind syncUserOperation
	User PgUser
}

PgSyncUserRequest has information about a single request to sync a user.

type PgUser

type PgUser struct {
	Origin     RoleOrigin        `yaml:"-"`
	Name       string            `yaml:"-"`
	Namespace  string            `yaml:"-"`
	Password   string            `yaml:"-"`
	Flags      []string          `yaml:"user_flags"`
	MemberOf   []string          `yaml:"inrole"`
	Parameters map[string]string `yaml:"db_parameters"`
	AdminRole  string            `yaml:"admin_role"`
	IsDbOwner  bool              `yaml:"is_db_owner"`
	Deleted    bool              `yaml:"deleted"`
}

PgUser contains information about a single user.

func (*PgUser) Valid added in v1.6.0

func (user *PgUser) Valid() bool

type PgUserMap

type PgUserMap map[string]PgUser

PgUserMap maps user names to the definitions.

type QueueDump

type QueueDump struct {
	Keys []string
	List []interface{}
}

QueueDump describes cache.FIFO queue

type RoleOrigin

type RoleOrigin int

RoleOrigin contains the code of the origin of a role

const (
	RoleOriginUnknown RoleOrigin = iota
	RoleOriginManifest
	RoleOriginInfrastructure
	RoleOriginTeamsAPI
	RoleOriginSystem
	RoleOriginBootstrap
	RoleConnectionPooler
)

The rolesOrigin constant values must be sorted by the role priority for resolveNameConflict(...) to work.

func (RoleOrigin) String

func (r RoleOrigin) String() string

type UserSyncer

type UserSyncer interface {
	ProduceSyncRequests(dbUsers PgUserMap, newUsers PgUserMap) (req []PgSyncUserRequest)
	ExecuteSyncRequests(req []PgSyncUserRequest, db *sql.DB) error
}

UserSyncer defines an interface for the implementations to sync users from the manifest to the DB.

Jump to

Keyboard shortcuts

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