database

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckDatabaseHealthError          = "Check database health error"
	CreateDatabaseCrError             = "Create database CR error"
	UpdateDatabaseCrError             = "Update database CR error"
	GenerateDatabaseCrError           = "Generate database CR error"
	GetDatabaseCrError                = "Get database CR error"
	SetOwnerReferenceError            = "Set owner reference error"
	DefaultUnstructuredConverterError = "Default unstructured converter error"
)
View Source
const (
	DownScalingDatabase     = "DatabaseDownScaling"
	UpScalingDatabase       = "DatabaseUpScaling"
	RollingUpgradesDatabase = "DatabaseRollingUpgrades"

	MessageDatabaseCreate = "Database  %s already created."

	MessageDatabaseUpdate = "Database  %s already update."

	MessageDatabaseDownScaling     = "Database downscale from %d to %d"
	MessageDatabaseUpScaling       = "Database upscale from %d to %d"
	MessageDatabaseRollingUpgrades = "Database resource from %s to %s"
)
View Source
const (
	InClusterDatabasePort        = "5432"
	InClusterDatabaseUserName    = "postgres"
	InClusterDatabaseName        = "postgres"
	InClusterDatabasePasswordKey = "password"
)
View Source
const (
	HarborCore         = "core"
	HarborClair        = "clair"
	HarborNotaryServer = "notaryServer"
	HarborNotarySigner = "notarySigner"

	CoreDatabase         = "core"
	ClairDatabase        = "clair"
	NotaryServerDatabase = "notaryserver"
	NotarySignerDatabase = "notarysigner"

	CoreSecretName         = "core"
	ClairSecretName        = "clair"
	NotaryServerSecretName = "notary-server"
	NotarySignerSecretName = "notary-signer"
)
View Source
const (
	DefaultDatabaseReplica = 3
	DefaultDatabaseMemory  = "1Gi"
	DefaultDatabaseVersion = "12"
)

Variables

This section is empty.

Functions

func GenInClusterPasswordSecretName

func GenInClusterPasswordSecretName(teamID, name string) string

func IsEqual

func IsEqual(actualCR, expectCR api.Postgresql) bool

isEqual check whether cache cr is equal expect.

Types

type Connect

type Connect struct {
	Host     string
	Port     string
	Password string
	Username string
	Database string
}

func (*Connect) GenDatabaseUrl

func (c *Connect) GenDatabaseUrl() string

GenDatabaseUrl returns database connection url

type PostgreSQLReconciler

type PostgreSQLReconciler struct {
	HarborCluster *goharborv1.HarborCluster
	Ctx           context.Context
	Client        k8s.Client
	Recorder      record.EventRecorder
	Log           logr.Logger
	DClient       k8s.DClient
	Scheme        *runtime.Scheme
	ExpectCR      *unstructured.Unstructured
	ActualCR      *unstructured.Unstructured
	Labels        map[string]string
}

func (*PostgreSQLReconciler) Delete

func (postgres *PostgreSQLReconciler) Delete() (*lcm.CRStatus, error)

func (*PostgreSQLReconciler) Deploy

func (postgres *PostgreSQLReconciler) Deploy() (*lcm.CRStatus, error)

Deploy reconcile will deploy database cluster if that does not exist. It does: - check postgres.does exist - create any new postgresqls.acid.zalan.do CRs - create postgres connection secret It does not: - perform any postgresqls downscale (left for downscale phase) - perform any postgresqls upscale (left for upscale phase) - perform any pod upgrade (left for rolling upgrade phase)

func (*PostgreSQLReconciler) DeployComponentSecret

func (postgres *PostgreSQLReconciler) DeployComponentSecret(conn *Connect, component, secretName, propertyName string) error

DeployComponentSecret deploy harbor component database secret

func (*PostgreSQLReconciler) GetDatabaseConn

func (postgres *PostgreSQLReconciler) GetDatabaseConn(secretName string) (*Connect, error)

GetDatabaseConn is getting database connection

func (*PostgreSQLReconciler) GetDatabaseName

func (postgres *PostgreSQLReconciler) GetDatabaseName() string

func (*PostgreSQLReconciler) GetDatabases

func (postgres *PostgreSQLReconciler) GetDatabases() map[string]string

func (*PostgreSQLReconciler) GetExternalDatabaseConn

func (postgres *PostgreSQLReconciler) GetExternalDatabaseConn(secretName string, client k8s.Client) (*Connect, error)

GetExternalDatabaseConn returns external database connection info

func (*PostgreSQLReconciler) GetExternalDatabaseInfo

func (postgres *PostgreSQLReconciler) GetExternalDatabaseInfo() (*Connect, *pgx.Conn, error)

GetExternalDatabaseInfo returns external database connection client

func (*PostgreSQLReconciler) GetInClusterDatabaseConn

func (postgres *PostgreSQLReconciler) GetInClusterDatabaseConn(name, pw string) (*Connect, error)

GetInClusterDatabaseConn returns inCluster database connection info

func (*PostgreSQLReconciler) GetInClusterDatabaseInfo

func (postgres *PostgreSQLReconciler) GetInClusterDatabaseInfo() (*Connect, *pgx.Conn, error)

GetInClusterDatabaseInfo returns inCluster database connection client

func (*PostgreSQLReconciler) GetInClusterDatabasePassword

func (postgres *PostgreSQLReconciler) GetInClusterDatabasePassword() (string, error)

GetInClusterDatabasePassword is get inCluster postgresql password

func (*PostgreSQLReconciler) GetInClusterHost

func (postgres *PostgreSQLReconciler) GetInClusterHost(name string) (string, error)

GetInClusterHost returns the Database master pod ip or service name

func (*PostgreSQLReconciler) GetMasterPodsIP

func (postgres *PostgreSQLReconciler) GetMasterPodsIP() (string, error)

GetMasterPodsIP returns postgresql master node ip

func (*PostgreSQLReconciler) GetPostgreReplica

func (postgres *PostgreSQLReconciler) GetPostgreReplica() int32

GetRedisServerReplica returns postgres replicas

func (*PostgreSQLReconciler) GetPostgreResource

func (postgres *PostgreSQLReconciler) GetPostgreResource() api.Resources

GetPostgreResource returns postgres resource

func (*PostgreSQLReconciler) GetPostgreStorageSize

func (postgres *PostgreSQLReconciler) GetPostgreStorageSize() string

GetPostgreStorageSize returns Postgre storage size

func (*PostgreSQLReconciler) GetPostgreVersion

func (postgres *PostgreSQLReconciler) GetPostgreVersion() string

func (*PostgreSQLReconciler) GetSecret

func (postgres *PostgreSQLReconciler) GetSecret(secretName string) (map[string][]byte, error)

GetSecret returns the database connection Secret

func (*PostgreSQLReconciler) GetStatefulSetPods

func (postgres *PostgreSQLReconciler) GetStatefulSetPods() (*corev1.PodList, error)

GetStatefulSetPods returns the postgresql master pod

func (*PostgreSQLReconciler) Provision

func (postgres *PostgreSQLReconciler) Provision() (*lcm.CRStatus, error)

func (*PostgreSQLReconciler) Readiness

func (postgres *PostgreSQLReconciler) Readiness() (*lcm.CRStatus, error)

Readiness reconcile will check postgre sql cluster if that has available. It does: - create postgre connection pool - ping postgre server - return postgre properties if postgre has available

func (*PostgreSQLReconciler) Reconcile

func (postgres *PostgreSQLReconciler) Reconcile() (*lcm.CRStatus, error)

Reconciler implements the reconcile logic of postgreSQL service

func (*PostgreSQLReconciler) Scale

func (postgres *PostgreSQLReconciler) Scale() (*lcm.CRStatus, error)

func (*PostgreSQLReconciler) ScaleDown

func (postgres *PostgreSQLReconciler) ScaleDown(newReplicas uint64) (*lcm.CRStatus, error)

func (*PostgreSQLReconciler) ScaleUp

func (postgres *PostgreSQLReconciler) ScaleUp(newReplicas uint64) (*lcm.CRStatus, error)

func (*PostgreSQLReconciler) Update

func (postgres *PostgreSQLReconciler) Update() (*lcm.CRStatus, error)

Update reconcile will update PostgreSQL CR.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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