common

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package common holds common constants used across Everest.

Index

Constants

View Source
const (
	// Everest ...
	Everest = "everest"
	// PXCOperatorName holds operator name in k8s.
	PXCOperatorName = "percona-xtradb-cluster-operator"
	// PSMDBOperatorName holds operator name in k8s.
	PSMDBOperatorName = "percona-server-mongodb-operator"
	// PGOperatorName holds operator name in k8s.
	PGOperatorName = "percona-postgresql-operator"

	// SystemNamespace is the namespace where everest is installed.
	SystemNamespace = "everest-system"
	// MonitoringNamespace is the namespace where monitoring configs are created.
	MonitoringNamespace = "everest-monitoring"
	// PerconaEverestDeploymentName stores the name of everest API Server deployment.
	PerconaEverestDeploymentName = "percona-everest"
	// PerconaEverestOperatorDeploymentName stores the name of everest operator deployment.
	PerconaEverestOperatorDeploymentName = "everest-operator-controller-manager"
	// EverestContainerNameInDeployment is the name of the Everest container in the deployment.
	EverestContainerNameInDeployment = "everest"

	// EverestOperatorName holds the name for Everest operator.
	EverestOperatorName = "everest-operator"

	// EverestAccountsSecretName is the name of the secret that holds accounts.
	EverestAccountsSecretName = "everest-accounts"
	// EverestJWTSecretName is the name of the secret that holds JWT secret.
	EverestJWTSecretName = "everest-jwt"
	// EverestJWTPrivateKeyFile is the path to the JWT private key.
	EverestJWTPrivateKeyFile = "/etc/jwt/id_rsa"
	// EverestJWTPublicKeyFile is the path to the JWT public key.
	EverestJWTPublicKeyFile = "/etc/jwt/id_rsa.pub"

	// EverestRBACRolePrefix is the prefix for roles.
	EverestRBACRolePrefix = "role:"
	// EverestAdminUser is the name of the admin user.
	EverestAdminUser = "admin"
	// EverestAdminRole is the name of the admin role.
	EverestAdminRole = EverestRBACRolePrefix + "admin"

	// EverestSettingsConfigMapName is the name of the Everest settings ConfigMap.
	EverestSettingsConfigMapName = "everest-settings"
	// EverestTokenCookie is the name of the cookie that holds the token.
	EverestTokenCookie = "everest_token"
	// EverestRBACConfigMapName is the name of the Everest RBAC ConfigMap.
	EverestRBACConfigMapName = "everest-rbac"
	// KubernetesManagedByLabel is the label used to identify resources managed by Everest.
	KubernetesManagedByLabel = "app.kubernetes.io/managed-by"
	// ForegroundDeletionFinalizer is the finalizer used to delete resources in foreground.
	ForegroundDeletionFinalizer = "foregroundDeletion"

	// EverestAPIExtnResourceName is the name of the Everest API extension header
	// that holds the name of the resource being served by an API endpoint.
	EverestAPIExtnResourceName = "x-everest-resource-name"
)
View Source
const InitialPasswordWarningMessage = `` /* 289-byte string literal not displayed */

InitialPasswordWarningMessage is the message that is shown to the user after the installation/upgrade, regarding insecure admin password.

Variables

This section is empty.

Functions

func CheckConstraint added in v1.1.0

func CheckConstraint[V version](v V, c string) bool

CheckConstraint returns true if the version `v` satisfies the constraint.

v can be passed either as string or *goversion.Version, otherwise this function will panic.

func CheckK8sRequirements added in v1.1.0

func CheckK8sRequirements(supVer *SupportedVersion, l *zap.SugaredLogger, kubeClient serverVersionGetter) error

CheckK8sRequirements checks Kubernetes requirements.

func CompareVersions added in v1.0.0

func CompareVersions[T1, T2 version](v1 T1, v2 T2) int

CompareVersions compares two versions. Returns: -1 if v1 < v2 0 if v1 == v2 1 if v1 > v2

Arguments can be passed either as string or *goversion.Version, otherwise this function will panic.

func CreateInitialAdminAccount added in v1.0.0

func CreateInitialAdminAccount(
	ctx context.Context,
	c accounts.Interface,
) error

CreateInitialAdminAccount creates the initial admin account with a random plain-text password.

func RunStepsWithSpinner added in v1.1.0

func RunStepsWithSpinner(
	ctx context.Context,
	steps []Step,
	out io.Writer,
) error

RunStepsWithSpinner runs a list of steps with a loading spinner animation.

Types

type EverestSettings added in v1.0.0

type EverestSettings struct {
	OIDCConfigRaw string `mapstructure:"oidc.config"`
}

EverestSettings represents the everest settings.

func (*EverestSettings) FromMap added in v1.0.0

func (e *EverestSettings) FromMap(m map[string]string) error

FromMap tries to convert a map the EverestSettings struct.

func (*EverestSettings) OIDCConfig added in v1.0.0

func (e *EverestSettings) OIDCConfig() (OIDCConfig, error)

OIDCConfig returns the OIDCConfig struct from the raw string.

func (*EverestSettings) ToMap added in v1.0.0

func (e *EverestSettings) ToMap() (map[string]string, error)

ToMap converts the EverestSettings struct to a map struct.

type OIDCConfig added in v1.0.0

type OIDCConfig struct {
	IssuerURL string `yaml:"issuerUrl"`
	ClientID  string `yaml:"clientId"`
}

OIDCConfig represents the OIDC provider configuration.

func (*OIDCConfig) Raw added in v1.0.0

func (c *OIDCConfig) Raw() (string, error)

Raw converts the OIDCConfig struct to a raw YAML string.

type Step added in v1.1.0

type Step struct {
	// Desc is a human readable description of the step.
	Desc string
	// F is the function that will be called to execute the step.
	F func(ctx context.Context) error
}

Step is a helper type for organising the steps of long running CLI operations like install, uninstall, upgrades, etc.

type SupportedVersion added in v1.1.0

type SupportedVersion struct {
	Catalog       goversion.Constraints
	Cli           goversion.Constraints
	Kubernetes    goversion.Constraints
	Olm           goversion.Constraints
	PGOperator    goversion.Constraints
	PXCOperator   goversion.Constraints
	PSMBDOperator goversion.Constraints
}

SupportedVersion provides a list of contraints per component.

func NewSupportedVersion added in v1.1.0

func NewSupportedVersion(meta *versionpb.MetadataVersion) (*SupportedVersion, error)

NewSupportedVersion returns a new SupportedVersion struct.

Jump to

Keyboard shortcuts

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