Documentation
¶
Overview ¶
Package common holds common constants used across Everest.
Index ¶
- Constants
- Variables
- func CheckConstraint[V version](v V, c string) bool
- func CompareVersions[T1, T2 version](v1 T1, v2 T2) int
- func CreateInitialAdminAccount(ctx context.Context, c accounts.Interface) error
- func ExtractToken(ctx context.Context) (*jwt.Token, error)
- type EverestSettings
- type OIDCConfig
- type SupportedVersion
Constants ¶
const ( // Everest ... Everest = "everest" // MySQLProductName holds the name of the product. MySQLProductName = "MySQL" // MySQLOperatorName holds operator name in k8s. MySQLOperatorName = "percona-xtradb-cluster-operator" // MongoDBProductName holds the name of the product. MongoDBProductName = "MongoDB" // MongoDBOperatorName holds operator name in k8s. MongoDBOperatorName = "percona-server-mongodb-operator" // PostgreSQLProductName holds the name of the product. PostgreSQLProductName = "PostgreSQL" // PostgreSQLOperatorName holds operator name in k8s. PostgreSQLOperatorName = "percona-postgresql-operator" // DefaultDBNamespaceName is the name of the default DB namespace during installation. DefaultDBNamespaceName = "everest" // 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 = "everest-server" // PerconaEverestDeploymentNameLegacy stores the legacy name (> 1.4.0) of everest API Server deployment. // This is kept only for backward compatibility. PerconaEverestDeploymentNameLegacy = "percona-everest" // PerconaEverestCatalogName is the name of the Everest catalog source. PerconaEverestCatalogName = "everest-catalog" // PerconaEverestOperatorDeploymentName stores the name of everest operator deployment. PerconaEverestOperatorDeploymentName = "everest-operator" // EverestContainerNameInDeployment is the name of the Everest container in the deployment. EverestContainerNameInDeployment = "everest" // VictoriaMetricsOperatorDeploymentName stores the name of VictoriaMetrics operator deployment. VictoriaMetricsOperatorDeploymentName = "vm-operator" // KubeStateMetricsDeploymentName stores the name of kube-state-metrics deployment. KubeStateMetricsDeploymentName = "kube-state-metrics" // PerconaEverestCRDLabel is the label used to identify Everest CRDs. PerconaEverestCRDLabel = "everest.percona.com/crd" // EverestOperatorName holds the name for Everest operator. EverestOperatorName = "everest-operator" // VictoriaMetricsOperatorName holds the name for VictoriaMetrics operator. VictoriaMetricsOperatorName = "victoriametrics-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" // EverestBlocklistSecretName is the name of the secret that holds JWT blocklist. EverestBlocklistSecretName = "everest-blocklist" // 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" // EverestAccountsFileName is the key used in everest-accounts secret EverestAccountsFileName = "users.yaml" // EverestSettingsConfigMapName is the name of the Everest settings ConfigMap. EverestSettingsConfigMapName = "everest-settings" // 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" // DatabaseClusterNameLabel is the label used to identify resources by DB cluster name. DatabaseClusterNameLabel = "clusterName" // ForegroundDeletionFinalizer is the finalizer used to delete resources in foreground. ForegroundDeletionFinalizer = "foregroundDeletion" // UserCtxKey is the key used to store the user in the context. UserCtxKey = "user" // 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" )
const InitialPasswordWarningMessage = "Run the following command to get the initial admin password:\n\n" +
"\teverestctl accounts initial-admin-password\n\n" +
"NOTE: The initial password is stored in plain text. For security, change it immediately using the following command:\n\n" +
"\teverestctl accounts set-password --username admin"
InitialPasswordWarningMessage is the message that is shown to the user after the installation/upgrade, regarding insecure admin password.
Variables ¶
var DefaultOIDCScopes = []string{"openid", "profile", "email"}
DefaultOIDCScopes is the default scopes for OIDC.
var OperatorTypeToName = map[everestv1alpha1.EngineType]string{ everestv1alpha1.DatabaseEnginePXC: MySQLOperatorName, everestv1alpha1.DatabaseEnginePSMDB: MongoDBOperatorName, everestv1alpha1.DatabaseEnginePostgresql: PostgreSQLOperatorName, }
OperatorTypeToName maps the engine type to the operator name.
Functions ¶
func CheckConstraint ¶ added in v1.1.0
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 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
CreateInitialAdminAccount creates the initial admin account with a random plain-text password.
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.
type OIDCConfig ¶ added in v1.0.0
type OIDCConfig struct {
IssuerURL string `yaml:"issuerUrl"`
ClientID string `yaml:"clientId"`
Scopes []string `yaml:"scopes"`
}
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 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.