common

package
v4.94.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: BSD-3-Clause Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PgInstanceNameSuffix = "-pg"
	PgSecretName         = "pg-creds"
)

Variables

This section is empty.

Functions

func AddCredentialsSecret added in v4.46.0

func AddCredentialsSecret(comp InfoGetter, svc *runtime.ServiceRuntime, fieldList []string, opts ...CredentialSecretOption) (string, error)

AddCredentialsSecret creates secrets and passwords for use with helm based services. This is to avoid issues with re-generating passwords if helm internal password generators are used. The function accepts a list of fields that should be populated with passwords. It returns the name of the secret resource, so it can be referenced later. The name of the inner secret object is the same as the resource name. Additionally it exposes the generated passwords as connection details, for easier retrieval.

func AddGenericSecret added in v4.73.0

func AddGenericSecret(comp InfoGetter, svc *runtime.ServiceRuntime, suffix string, fieldList []string, opts ...CredentialSecretOption) (string, error)

AddGenericSecret generates passwords the same way AddCredentialsSecret does. With the difference that the resource name can be chosen. This is helpful if multiple different random generated passwords are necessary.

func AddPDBSettings added in v4.86.0

func AddPDBSettings[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *fnproto.Result

func AddSaWithRole

func AddSaWithRole(ctx context.Context, svc *runtime.ServiceRuntime, policies []rbacv1.PolicyRule, compName, namespace, suffix string) error

AddSaWithRole creates a service account with the given policy and binds it to the role.

func AddUserAlerting added in v4.42.0

func AddUserAlerting[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *fnproto.Result

AddUserAlerting adds user alerting to the Redis instance.

func BootstrapInstanceNs added in v4.45.0

func BootstrapInstanceNs(ctx context.Context, comp Composite, serviceName, namespaceResName string, svc *runtime.ServiceRuntime) error

func CreateNetworkPolicy added in v4.44.0

func CreateNetworkPolicy(comp Composite, svc *runtime.ServiceRuntime) error

CreateNetworkPolicy creates network policy in the instance namespace to allow other namespaces access to the service

func CreateTlsCerts added in v4.44.0

func CreateTlsCerts(ctx context.Context, ns string, serviceName string, svc *runtime.ServiceRuntime) error

func CustomCreateNetworkPolicy added in v4.69.0

func CustomCreateNetworkPolicy(sourceNS []string, instanceNs, name string, allowAll bool, svc *runtime.ServiceRuntime) error

CustomCreateNetworkPolicy creates a more flexible network policy Use this method when, for instance, a service needs a sub-service with more refined network policy access

func DisableBilling added in v4.60.0

func DisableBilling(instanceNamespace string, svc *runtime.ServiceRuntime) error

DisableBilling deploys a special config map to the appcat control namespace. This configMap contains a key that specifies if a given namespace should be billed or not. The configMap can also be used for other configurations in the future.

func GetDesiredReleaseValues added in v4.61.0

func GetDesiredReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)

GetDesiredReleaseValues returns the desired releaseValues for the given release name.

func GetObservedReleaseValues added in v4.53.0

func GetObservedReleaseValues(svc *runtime.ServiceRuntime, releaseName string) (map[string]interface{}, error)

GetObservedReleaseValues returns the observed releaseValues for the given release name.

func GetReleaseValues added in v4.49.0

func GetReleaseValues(r *xhelmv1.Release) (map[string]interface{}, error)

GetReleaseValues returns the parsed values from the given release.

func MailgunAlerting added in v4.42.0

func MailgunAlerting[T client.Object](ctx context.Context, obj T, svc *runtime.ServiceRuntime) *xfnproto.Result

func NewRelease added in v4.53.0

func NewRelease(ctx context.Context, svc *runtime.ServiceRuntime, comp InfoGetter, values map[string]any, cd ...xhelmv1.ConnectionDetail) (*xhelmv1.Release, error)

NewRelease returns a new release with some defaults set.

func SetNestedObjectValue added in v4.65.0

func SetNestedObjectValue(values map[string]interface{}, path []string, val interface{}) error

SetNestedObjectValue is necessary as unstructured can't handle anything except basic values and maps. this is a recursive function, it will traverse the map until it reaches the last element of the path. If it encounters any non-map values while traversing, it will throw an error.

func SetRandomSchedules

func SetRandomSchedules(backup BackupScheduler, maintenance MaintenanceScheduler)

SetRandomSchedules initializes the backup and maintenance schedules if the user did not explicitly provide a schedule. The maintenance will be set to a random time on Tuesday night between 21:00 and 5:00, and the backup schedule will be set to once a day between 20:00 and 4:00. If neither maintenance nor backup is set, the function will make sure that there will be backup scheduled one hour before the maintenance.

func SetSELinuxSecurityContextDeployment added in v4.64.2

func SetSELinuxSecurityContextDeployment(depl *appsv1.Deployment, comp InfoGetter, svc *runtime.ServiceRuntime) error

func SetSELinuxSecurityContextStatefulset added in v4.64.2

func SetSELinuxSecurityContextStatefulset(sts *appsv1.StatefulSet, comp InfoGetter, svc *runtime.ServiceRuntime) error

Types

type Alerter added in v4.42.0

type Alerter interface {
	GetVSHNMonitoring() vshnv1.VSHNMonitoring
	GetInstanceNamespace() string
}

Required to get info required for alerting.

type AllowedNamespaceGetter added in v4.69.0

type AllowedNamespaceGetter interface {
	GetAllowAllNamespaces() bool
	GetAllowedNamespaces() []string
}

type BackupScheduler

type BackupScheduler interface {
	GetBackupSchedule() string
	SetBackupSchedule(string)
}

BackupScheduler can schedule backups

type Composite added in v4.62.2

type Composite interface {
	InfoGetter
	client.Object
	SetInstanceNamespaceStatus()
	AllowedNamespaceGetter
}

Composite can get and set the relevant information on a given composite.

type CredentialSecretOption added in v4.79.0

type CredentialSecretOption func(obj *corev1.Secret, cd []xkube.ConnectionDetail) []xkube.ConnectionDetail

func AddStaticFieldToSecret added in v4.79.0

func AddStaticFieldToSecret(staticFields map[string]string) CredentialSecretOption

AddStaticFieldToSecret adds predefined staticFields into a secret. This is helpful if multiple you need to add a static username to a secret for example.

type InfoGetter added in v4.46.0

type InfoGetter interface {
	GetBackupSchedule() string
	GetBackupRetention() vshnv1.K8upRetentionPolicy
	GetServiceName() string
	GetLabels() map[string]string
	GetSize() vshnv1.VSHNSizeSpec
	GetInstances() int
	GetFullMaintenanceSchedule() vshnv1.VSHNDBaaSMaintenanceScheduleSpec
	GetMonitoring() vshnv1.VSHNMonitoring
	GetSecurity() *vshnv1.Security
	InstanceNamespaceInfo
	GetPDBLabels() map[string]string
}

InfoGetter will return various information about the given AppCat composite.

type InstanceNamespaceInfo added in v4.45.2

type InstanceNamespaceInfo interface {
	GetName() string
	GetClaimNamespace() string
	GetInstanceNamespace() string
	GetLabels() map[string]string
}

InstanceNamespaceInfo provides all the necessary information to create an instance namespace.

type MaintenanceScheduler

type MaintenanceScheduler interface {
	GetMaintenanceDayOfWeek() string
	SetMaintenanceDayOfWeek(string)
	GetMaintenanceTimeOfDay() *v1.TimeOfDay
}

type PostgreSQLDependencyBuilder added in v4.83.0

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

func NewPostgreSQLDependencyBuilder added in v4.83.0

func NewPostgreSQLDependencyBuilder(svc *runtime.ServiceRuntime, comp InfoGetter) *PostgreSQLDependencyBuilder

func (*PostgreSQLDependencyBuilder) AddPGBouncerConfig added in v4.83.0

func (a *PostgreSQLDependencyBuilder) AddPGBouncerConfig(pgBouncerConfig map[string]string) *PostgreSQLDependencyBuilder

func (*PostgreSQLDependencyBuilder) AddParameters added in v4.83.0

func (*PostgreSQLDependencyBuilder) CreateDependency added in v4.83.0

func (a *PostgreSQLDependencyBuilder) CreateDependency() error

func (*PostgreSQLDependencyBuilder) SetCustomMaintenanceSchedule added in v4.83.0

func (a *PostgreSQLDependencyBuilder) SetCustomMaintenanceSchedule(timeOfDayMaintenance vshnv1.TimeOfDay) *PostgreSQLDependencyBuilder

type Resources added in v4.53.0

type Resources struct {
	ReqMem resource.Quantity
	ReqCPU resource.Quantity
	Mem    resource.Quantity
	CPU    resource.Quantity
	Disk   resource.Quantity
}

func GetResources added in v4.44.0

func GetResources(size *vshnv1.VSHNSizeSpec, plan utils.Resources) (Resources, []error)

GetResources will return a `Resources` object with the correctly calculated requests, limits and disk space according to the definitions in the plan as well as the overrides in the claim.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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