Documentation
¶
Index ¶
- Constants
- func GenInClusterPasswordSecretName(teamID, name string) string
- func IsEqual(actualCR, expectCR api.Postgresql) bool
- type Connect
- type PostgreSQLReconciler
- func (postgres *PostgreSQLReconciler) Delete() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) Deploy() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) DeployComponentSecret(conn *Connect, component, secretName, propertyName string) error
- func (postgres *PostgreSQLReconciler) GetDatabaseConn(secretName string) (*Connect, error)
- func (postgres *PostgreSQLReconciler) GetDatabaseName() string
- func (postgres *PostgreSQLReconciler) GetDatabases() map[string]string
- func (postgres *PostgreSQLReconciler) GetExternalDatabaseConn(secretName string, client k8s.Client) (*Connect, error)
- func (postgres *PostgreSQLReconciler) GetExternalDatabaseInfo() (*Connect, *pgx.Conn, error)
- func (postgres *PostgreSQLReconciler) GetInClusterDatabaseConn(name, pw string) (*Connect, error)
- func (postgres *PostgreSQLReconciler) GetInClusterDatabaseInfo() (*Connect, *pgx.Conn, error)
- func (postgres *PostgreSQLReconciler) GetInClusterDatabasePassword() (string, error)
- func (postgres *PostgreSQLReconciler) GetInClusterHost(name string) (string, error)
- func (postgres *PostgreSQLReconciler) GetMasterPodsIP() (string, error)
- func (postgres *PostgreSQLReconciler) GetPostgreReplica() int32
- func (postgres *PostgreSQLReconciler) GetPostgreResource() api.Resources
- func (postgres *PostgreSQLReconciler) GetPostgreStorageSize() string
- func (postgres *PostgreSQLReconciler) GetPostgreVersion() string
- func (postgres *PostgreSQLReconciler) GetSecret(secretName string) (map[string][]byte, error)
- func (postgres *PostgreSQLReconciler) GetStatefulSetPods() (*corev1.PodList, error)
- func (postgres *PostgreSQLReconciler) Provision() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) Readiness() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) Reconcile() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) Scale() (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) ScaleDown(newReplicas uint64) (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) ScaleUp(newReplicas uint64) (*lcm.CRStatus, error)
- func (postgres *PostgreSQLReconciler) Update() (*lcm.CRStatus, error)
Constants ¶
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" )
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" )
const ( InClusterDatabasePort = "5432" InClusterDatabaseUserName = "postgres" InClusterDatabaseName = "postgres" InClusterDatabasePasswordKey = "password" )
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" )
const ( DefaultDatabaseReplica = 3 DefaultDatabaseMemory = "1Gi" DefaultDatabaseVersion = "12" )
Variables ¶
This section is empty.
Functions ¶
func IsEqual ¶
func IsEqual(actualCR, expectCR api.Postgresql) bool
isEqual check whether cache cr is equal expect.
Types ¶
type Connect ¶
func (*Connect) GenDatabaseUrl ¶
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)