controllers

package
v0.5.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinalizerName              = "oracle.db.anthosapis.com"
	PhysBackupTimeLimitDefault = 60 * time.Minute
	StatusReady                = "Ready"
	StatusInProgress           = "InProgress"

	RestoreInProgress = "Restore" + StatusInProgress
	CreateInProgress  = "Create" + StatusInProgress

	PITRLabel                   = "pitr"
	IncarnationLabel            = "incarnation"
	ParentIncarnationLabel      = "parent-incarnation"
	SCNAnnotation               = "scn"
	TimestampAnnotation         = "timestamp"
	DatabaseImageAnnotation     = "database-image"
	ParameterUpdateStateMachine = "ParameterUpdateStateMachine"
	DatabaseContainerName       = "oracledb"
)
View Source
const (

	// OperatorName is the default operator name.
	OperatorName = "operator"

	// DefaultUID is the default Database pod user uid.
	DefaultUID = int64(54321)
	// DefaultGID is the default Database pod user gid.
	DefaultGID = int64(54322)

	StoppedReplicaCnt = 0
	DefaultReplicaCnt = 1
)

Variables

View Source
var (
	// SvcName is a string template for service names.
	SvcName = "%s-svc"
	// AgentSvcName is a string template for agent service names.
	AgentSvcName = "%s-agent-svc"
	// DbdaemonSvcName is a string template for dbdaemon service names.
	DbdaemonSvcName = "%s-dbdaemon-svc"
	// SvcEndpoint is a string template for service endpoints.
	SvcEndpoint = "%s.%s" // SvcName.namespaceName

	// StsName is a string template for Database stateful set names.
	StsName = "%s-sts"
	// AgentDeploymentName is a string template for agent deployment names.
	AgentDeploymentName = "%s-agent-deployment"
	// PvcMountName is a string template for pvc names.
	PvcMountName = "%s-pvc-%s" // inst.name-pvc-mount, e.g. mydb-pvc-u02
	// CmName is a string template for config map names.
	CmName = "%s-cm"
	// DatabaseTaskType is the value of the 'task-type' label assigned to db pod.
	DatabaseTaskType = "oracle-db"
	// MonitorTaskType is the value of the 'task-type' label assigned to the monitoring deployment.
	MonitorTaskType = "monitor"
	// DefaultDiskSpecs is the default DiskSpec settings.
	DefaultDiskSpecs = map[string]commonv1alpha1.DiskSpec{
		"DataDisk": {
			Name: "DataDisk",
			Size: resource.MustParse("100Gi"),
		},
		"LogDisk": {
			Name: "LogDisk",
			Size: resource.MustParse("150Gi"),
		},
		"BackupDisk": {
			Name: "BackupDisk",
			Size: resource.MustParse("100Gi"),
		},
	}
)
View Source
var AccessSecretVersionFunc = func(ctx context.Context, name string) (string, error) {

	client, closeConn, err := newGsmClient(ctx)
	if err != nil {
		return "", fmt.Errorf("config_agent_helpers/AccessSecretVersionFunc: failed to create secretmanager client: %v", err)
	}
	defer closeConn()

	req := &secretmanagerpb.AccessSecretVersionRequest{
		Name: name,
	}

	result, err := client.AccessSecretVersion(ctx, req)
	if err != nil {
		return "", fmt.Errorf("config_agent_helpers/AccessSecretVersionFunc: failed to access secret version: %v", err)
	}

	return string(result.Payload.Data[:]), nil
}

AccessSecretVersionFunc accesses the payload for the given secret version if one exists. The version can be a version number as a string (e.g. "5") or an alias (e.g. "latest").

View Source
var AllowedImpdpParams = map[string]bool{
	"TABLE_EXISTS_ACTION": true,
	"REMAP_TABLE":         true,
	"REMAP_SCHEMA":        true,
	"REMAP_TABLESPACE":    true,
	"REMAP_DATAFILE":      true,
	"PARALLEL":            true,
	"NETWORK_LINK":        true,
}
View Source
var CheckStatusInstanceFunc = func(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, instName, cdbName, namespace, clusterIP, DBDomain string, log logr.Logger) (string, error) {
	if clusterIP != "" {
		log.Info("resources/checkStatusInstance", "inst name", instName, "clusterIP", clusterIP)
	} else {
		log.Info("resources/checkStatusInstance", "inst name", instName)
	}

	checkStatusReq := &CheckStatusRequest{
		Name:            instName,
		CdbName:         cdbName,
		CheckStatusType: CheckStatusRequest_INSTANCE,
		DbDomain:        DBDomain,
	}
	cdOut, err := CheckStatus(ctx, r, dbClientFactory, namespace, instName, *checkStatusReq)
	if err != nil {
		return "", fmt.Errorf("resource/checkStatusInstance: failed on CheckStatus call: %v", err)
	}
	log.Info("resource/CheckStatusInstance: DONE with this output", "out", cdOut)

	return cdOut.Status, nil
}

checkStatusInstance attempts to determine a state of an database instance. In particular:

  • has provisioning finished?
  • is Instance up and accepting connection requests?
View Source
var ExecCmdFunc = func(p ExecCmdParams, cmd string) (string, error) {
	var cmdOut, cmdErr bytes.Buffer

	cmdShell := []string{"sh", "-c", cmd}

	req := p.Client.CoreV1().RESTClient().Post().Resource("pods").Name(p.Pod).
		Namespace(p.Ns).SubResource("exec")

	req.VersionedParams(&corev1.PodExecOptions{
		Container: p.Con.Name,
		Command:   cmdShell,
		Stdout:    true,
		Stderr:    true,
	}, scheme.ParameterCodec)

	exec, err := remotecommand.NewSPDYExecutor(p.RestConfig, "POST", req.URL())
	if err != nil {
		return "", fmt.Errorf("failed to init executor: %v", err)
	}

	// exec.Stream might return timout error, use a backoff with 4 retries
	// 100ms, 500ms, 2.5s, 12.5s
	var backoff = wait.Backoff{
		Steps:    4,
		Duration: 100 * time.Millisecond,
		Factor:   5.0,
		Jitter:   0.1,
	}
	if err := retry.OnError(backoff, func(error) bool { return true }, func() error {
		e := exec.Stream(remotecommand.StreamOptions{
			Stdout: &cmdOut,
			Stderr: &cmdErr,
			Tty:    false,
		})
		if e != nil {
			log.Error(fmt.Sprintf("exec.Stream failed, retrying, err: %v, stderr: %v, stdout: %v",
				e, cmdErr.String(), cmdOut.String()))
		}
		return e
	}); err != nil {
		return "", fmt.Errorf("failed to run a command [%v], err: %v, stderr: %v, stdout: %v",
			cmd, err, cmdErr.String(), cmdOut.String())
	}

	if cmdErr.Len() > 0 {
		return "", fmt.Errorf("stderr: %v", cmdErr.String())
	}

	return cmdOut.String(), nil
}

ExecCmdFunc invokes pod/exec.

Functions

func ApplyDataPatch

func ApplyDataPatch(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req ApplyDataPatchRequest) (*lropb.Operation, error)

ApplyDataPatch calls dbdaemon->ApplyDataPatch()

func BootstrapDatabase

func BootstrapDatabase(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req BootstrapDatabaseRequest) (*lropb.Operation, error)

BootstrapDatabase bootstrap a CDB after creation or restore.

func BounceDatabase

func BounceDatabase(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req BounceDatabaseRequest) error

BounceDatabase shutdown/startup the database as requested.

func CreateCDB

func CreateCDB(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req CreateCDBRequest) (*lropb.Operation, error)

CreateCDB creates a CDB using dbca.

func CreateDatabase

func CreateDatabase(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req CreateDatabaseRequest) (string, error)

CreateDatabase creates PDB as requested.

func CreateListener

func CreateListener(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req *CreateListenerRequest) error

CreateListener invokes dbdaemon.CreateListener.

func CreateStandby

func CreateStandby(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req CreateStandbyRequest) (*lropb.Operation, error)

CreateStandby creates a standby database.

func CreateUsers

func CreateUsers(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req CreateUsersRequest) (string, error)

CreateUsers creates users as requested.

func DataPumpExport

func DataPumpExport(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req DataPumpExportRequest) (*lropb.Operation, error)

DataPumpExport exports data pump file to GCS path provided.

func DataPumpImport

func DataPumpImport(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req DataPumpImportRequest) (*lropb.Operation, error)

DataPumpImport imports data dump file provided in GCS path.

func DeleteDatabase

func DeleteDatabase(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req DeleteDatabaseRequest) error

DeleteDatabase deletes the specified Database(PDB)

func DeleteLROOperation

func DeleteLROOperation(ctx context.Context, dbClientFactory DatabaseClientFactory, r client.Reader, id, namespace, instName string) error

DeleteLROOperation deletes LRO operation for the specified namespace instance and operation id.

func DiskSpecs

func DiskSpecs(inst *v1alpha1.Instance, config *v1alpha1.Config) []commonv1alpha1.DiskSpec

func GetBackupGcsPath

func GetBackupGcsPath(backup *v1alpha1.Backup) string

GetBackupGcsPath resolves the actual gcs path based on backup spec.

func GetDBDomain

func GetDBDomain(inst *v1alpha1.Instance) string

GetDBDomain figures out DBDomain from DBUniqueName and DBDomain.

func GetLROOperation

func GetLROOperation(ctx context.Context, dbClientFactory DatabaseClientFactory, r client.Reader, id, namespace, instName string) (*lropb.Operation, error)

GetLROOperation returns LRO operation for the specified namespace instance and operation id.

func GetLogLevelArgs

func GetLogLevelArgs(config *v1alpha1.Config) map[string][]string

GetLogLevelArgs returns agent args for log level.

func GetPVCNameAndMount

func GetPVCNameAndMount(instName, diskName string) (string, string)

GetPVCNameAndMount returns PVC names and their corresponding mount.

func IsAlreadyExistsError

func IsAlreadyExistsError(err error) bool

IsAlreadyExistsError returns true if given error is caused by object already exists.

func IsLROOperationDone

func IsLROOperationDone(ctx context.Context, dbClientFactory DatabaseClientFactory, r client.Reader, id, namespace, instName string) (bool, error)

Check for LRO job status Return (true, nil) if LRO is done without errors. Return (true, err) if LRO is done with an error. Return (false, nil) if LRO still in progress. Return (false, err) if other error occurred.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if given error is caused by object not found.

func MonitoringPodTemplate

func MonitoringPodTemplate(inst *v1alpha1.Instance, monitoringSecret *corev1.Secret, images map[string]string) corev1.PodTemplateSpec

func NewAgentSvc

func NewAgentSvc(inst *v1alpha1.Instance, scheme *runtime.Scheme) (*corev1.Service, error)

NewAgentSvc returns the service for the agent.

func NewConfigMap

func NewConfigMap(inst *v1alpha1.Instance, scheme *runtime.Scheme, cmName string) (*corev1.ConfigMap, error)

NewConfigMap returns the config map for database env variables.

func NewDBDaemonSvc

func NewDBDaemonSvc(inst *v1alpha1.Instance, scheme *runtime.Scheme) (*corev1.Service, error)

NewDBDaemonSvc returns the service for the database daemon server.

func NewPVCs

NewPVCs returns PVCs.

func NewPodTemplate

func NewPodTemplate(sp StsParams, cdbName, DBDomain string) corev1.PodTemplateSpec

NewPodTemplate returns the pod template for the database statefulset.

func NewSnapshotInst

func NewSnapshotInst(inst *v1alpha1.Instance, scheme *runtime.Scheme, pvcName, snapName, volumeSnapshotClassName string) (*snapv1.VolumeSnapshot, error)

NewSnapshot returns the snapshot for the given instance and pv.

func NewSts

NewSts returns the statefulset for the database pod.

func PhysicalBackup

func PhysicalBackup(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req PhysicalBackupRequest) (*lropb.Operation, error)

PhysicalBackup starts an RMAN backup and stores it in the GCS bucket provided.

func PhysicalBackupDelete

func PhysicalBackupDelete(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req PhysicalBackupDeleteRequest) error

PhysicalBackupDelete deletes backup data on local or GCS.

func PhysicalRestore

func PhysicalRestore(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req PhysicalRestoreRequest) (*lropb.Operation, error)

PhysicalRestore restores an RMAN backup (downloaded from GCS).

func PromoteStandby

func PromoteStandby(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req PromoteStandbyRequest) error

PromoteStandby promotes standby database to primary.

func RecoverConfigFile

func RecoverConfigFile(ctx context.Context, dbClientFactory DatabaseClientFactory, r client.Reader, namespace, instName, cdbName string) error

func RequestedMemoryInMi

func RequestedMemoryInMi() (int, error)

func SetParameter

func SetParameter(ctx context.Context, dbClientFactory DatabaseClientFactory, r client.Reader, namespace, instName, key, value string) (bool, error)

SetParameter sets database parameter as requested.

func SetUpDataGuard

func SetUpDataGuard(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req SetUpDataGuardRequest) error

SetUpDataGuard updates Data Guard configuration.

func UpdateUsers

func UpdateUsers(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req UpdateUsersRequest) error

UpdateUsers update/create users as requested.

Types

type ApplyDataPatchRequest

type ApplyDataPatchRequest struct {
	LroInput *LROInput
}

type BootstrapDatabaseRequest

type BootstrapDatabaseRequest struct {
	CdbName      string
	Version      string
	Host         string
	DbUniqueName string
	Dbdomain     string
	Mode         BootstrapDatabaseRequestBootstrapMode
	LroInput     *LROInput
}

type BootstrapDatabaseRequestBootstrapMode

type BootstrapDatabaseRequestBootstrapMode int32
const (
	BootstrapDatabaseRequest_ProvisionUnseeded BootstrapDatabaseRequestBootstrapMode = 0
	BootstrapDatabaseRequest_ProvisionSeeded   BootstrapDatabaseRequestBootstrapMode = 1
	BootstrapDatabaseRequest_Restore           BootstrapDatabaseRequestBootstrapMode = 2
)

type BootstrapStandbyRequest

type BootstrapStandbyRequest struct {
	CdbName  string
	Version  string
	Dbdomain string
}

type BootstrapStandbyResponsePDB

type BootstrapStandbyResponsePDB struct {
	PdbName string
	Users   []*BootstrapStandbyResponseUser
}

func BootstrapStandby

func BootstrapStandby(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req BootstrapStandbyRequest) ([]*BootstrapStandbyResponsePDB, error)

BootstrapStandby performs bootstrap steps for standby instance.

type BootstrapStandbyResponseUser

type BootstrapStandbyResponseUser struct {
	UserName string
	Privs    []string
}

type BounceDatabaseRequest

type BounceDatabaseRequest struct {
	Sid string
	// avoid_config_backup: by default we backup the config except for scenarios
	// when it isn't possible (like bootstrapping)
	AvoidConfigBackup bool
}

type CheckStatusRequest

type CheckStatusRequest struct {
	Name            string
	CdbName         string
	CheckStatusType CheckStatusRequest_Type
	DbDomain        string
}

type CheckStatusRequest_Type

type CheckStatusRequest_Type int32
const (
	CheckStatusRequest_UNKNOWN_TYPE CheckStatusRequest_Type = 0
	CheckStatusRequest_INSTANCE     CheckStatusRequest_Type = 1
)

type CheckStatusResponse

type CheckStatusResponse struct {
	Status       string
	ErrorMessage string
}

func CheckStatus

func CheckStatus(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req CheckStatusRequest) (*CheckStatusResponse, error)

CheckStatus runs a requested set of state checks. The Instance state check consists of:

  • checking the provisioning done file.
  • running a CDB connection test via DB Daemon.

type ConnCloseFunc

type ConnCloseFunc func()

type CreateCDBRequest

type CreateCDBRequest struct {
	OracleHome       string
	Sid              string
	DbUniqueName     string
	CharacterSet     string
	MemoryPercent    int32
	AdditionalParams []string
	Version          string
	DbDomain         string
	LroInput         *LROInput
}

type CreateDatabaseRequest

type CreateDatabaseRequest struct {
	CdbName string
	Name    string
	// only being used for plaintext password scenario.
	// GSM doesn't use this field.
	Password                  string
	DbDomain                  string
	AdminPasswordGsmSecretRef *GsmSecretReference
	// only being used for plaintext password scenario.
	// GSM doesn't use this field.
	LastPassword string
}

type CreateDatabaseResponse

type CreateDatabaseResponse struct {
	Status       string
	ErrorMessage string
}

type CreateListenerRequest

type CreateListenerRequest struct {
	Name       string
	Port       int32
	Protocol   string
	OracleHome string
	DbDomain   string
}

type CreateStandbyRequest

type CreateStandbyRequest struct {
	PrimaryHost         string
	PrimaryPort         int32
	PrimaryService      string
	PrimaryUser         string
	PrimaryCredential   *Credential
	StandbyDbUniqueName string
	StandbyLogDiskSize  int64
	StandbyDbDomain     string
	BackupGcsPath       string
	LroInput            *LROInput
}

type CreateUsersRequest

type CreateUsersRequest struct {
	CdbName        string
	PdbName        string
	CreateUsersCmd []string
	GrantPrivsCmd  []string
	DbDomain       string
	User           []*User
}

type Credential

type Credential struct {
	// Types that are assignable to Source:
	//	*Credential_GsmSecretReference
	Source isCredentialSource
}

func (*Credential) GetGsmSecretReference

func (x *Credential) GetGsmSecretReference() *GsmSecretReference

type CredentialGsmSecretReference

type CredentialGsmSecretReference struct {
	GsmSecretReference *GsmSecretReference
}

type DataGuardStatusRequest

type DataGuardStatusRequest struct {
	StandbyDbUniqueName string
}

type DataGuardStatusResponse

type DataGuardStatusResponse struct {
	Output []string
}

func DataGuardStatus

func DataGuardStatus(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req DataGuardStatusRequest) (*DataGuardStatusResponse, error)

DataGuardStatus returns Data Guard configuration status and standby DB status.

type DataPumpExportRequest

type DataPumpExportRequest struct {
	PdbName       string
	DbDomain      string
	ObjectType    string
	Objects       string
	GcsPath       string
	GcsLogPath    string
	LroInput      *LROInput
	FlashbackTime string
}

type DataPumpImportRequest

type DataPumpImportRequest struct {
	PdbName  string
	DbDomain string
	// GCS path to input dump file
	GcsPath string
	// GCS path to output log file
	GcsLogPath string
	// Additional command options from the user.
	Options  map[string]string
	LroInput *LROInput
}

type DatabaseClientFactory

type DatabaseClientFactory interface {
	// New returns new Client.
	// connection close function should be invoked by the caller if
	// error is nil.
	New(ctx context.Context, r client.Reader, namespace, instName string) (dbdpb.DatabaseDaemonClient, func() error, error)
}

DatabaseClientFactory is a GRPC implementation of DatabaseClientFactory. Exists for test mock.

type DeleteDatabaseRequest

type DeleteDatabaseRequest struct {
	Name     string
	DbDomain string
}

type ExecCmdParams

type ExecCmdParams struct {
	Pod        string
	Ns         string
	Con        *corev1.Container
	Sch        *runtime.Scheme
	RestConfig *rest.Config
	Client     kubernetes.Interface
}

ExecCmdParams stores parameters for invoking pod/exec.

type FetchDatabaseIncarnationResponse

type FetchDatabaseIncarnationResponse struct {
	Incarnation string
}

func FetchDatabaseIncarnation

func FetchDatabaseIncarnation(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string) (*FetchDatabaseIncarnationResponse, error)

FetchDatabaseIncarnation fetches the database incarnation number.

type GRPCDatabaseClientFactory

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

func (*GRPCDatabaseClientFactory) New

func (d *GRPCDatabaseClientFactory) New(ctx context.Context, r client.Reader, namespace, instName string) (dbdpb.DatabaseDaemonClient, func() error, error)

New returns a new database daemon client

type GetParameterTypeValueRequest

type GetParameterTypeValueRequest struct {
	Keys []string
}

type GetParameterTypeValueResponse

type GetParameterTypeValueResponse struct {
	Types  []string
	Values []string
}

func GetParameterTypeValue

func GetParameterTypeValue(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req GetParameterTypeValueRequest) (*GetParameterTypeValueResponse, error)

GetParameterTypeValue returns parameters' type and value by querying DB.

type GsmSecretReference

type GsmSecretReference struct {
	ProjectId   string
	SecretId    string
	Version     string
	LastVersion string
}

type LROInput

type LROInput struct {
	OperationId string
}

type PhysicalBackupDeleteRequest

type PhysicalBackupDeleteRequest struct {
	BackupTag string
	LocalPath string
	GcsPath   string
}

type PhysicalBackupMetadataRequest

type PhysicalBackupMetadataRequest struct {
	BackupTag string
}

type PhysicalBackupMetadataResponse

type PhysicalBackupMetadataResponse struct {
	BackupScn         string
	BackupIncarnation string
	BackupTimestamp   *timestamppb.Timestamp
}

func PhysicalBackupMetadata

func PhysicalBackupMetadata(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req PhysicalBackupMetadataRequest) (*PhysicalBackupMetadataResponse, error)

PhysicalBackupMetadata fetches backup scn/timestamp/incarnation with provided backup tag.

type PhysicalBackupRequest

type PhysicalBackupRequest struct {
	BackupSubType PhysicalBackupRequest_Type
	BackupItems   []string
	Backupset     bool
	Compressed    bool
	CheckLogical  bool
	// DOP = degree of parallelism for physical backup.
	Dop         int32
	Level       int32
	Filesperset int32
	SectionSize int32
	LocalPath   string
	GcsPath     string
	LroInput    *LROInput
	BackupTag   string
}

type PhysicalBackupRequest_Type

type PhysicalBackupRequest_Type int32
const (
	PhysicalBackupRequest_UNKNOWN_TYPE PhysicalBackupRequest_Type = 0
	PhysicalBackupRequest_INSTANCE     PhysicalBackupRequest_Type = 1
	PhysicalBackupRequest_DATABASE     PhysicalBackupRequest_Type = 2
	PhysicalBackupRequest_TABLESPACE   PhysicalBackupRequest_Type = 3
	PhysicalBackupRequest_DATAFILE     PhysicalBackupRequest_Type = 4
)

type PhysicalRestoreRequest

type PhysicalRestoreRequest struct {
	InstanceName string
	CdbName      string
	// DOP = degree of parallelism for a restore from a physical backup.
	Dop               int32
	LocalPath         string
	GcsPath           string
	LroInput          *LROInput
	LogGcsPath        string
	Incarnation       string
	BackupIncarnation string
	StartTime         *timestamppb.Timestamp
	EndTime           *timestamppb.Timestamp
	StartScn          int64
	EndScn            int64
}

type PromoteStandbyRequest

type PromoteStandbyRequest struct {
	PrimaryHost         string
	PrimaryPort         int32
	PrimaryService      string
	PrimaryUser         string
	PrimaryCredential   *Credential
	StandbyDbUniqueName string
	StandbyHost         string
}

type SetUpDataGuardRequest

type SetUpDataGuardRequest struct {
	PrimaryHost         string
	PrimaryPort         int32
	PrimaryService      string
	PrimaryUser         string
	PrimaryCredential   *Credential
	StandbyDbUniqueName string
	StandbyHost         string
	PasswordFileGcsPath string
}

type StsParams

type StsParams struct {
	Inst           *v1alpha1.Instance
	Scheme         *runtime.Scheme
	Namespace      string
	Images         map[string]string
	SvcName        string
	StsName        string
	PrivEscalation bool
	ConfigMap      *corev1.ConfigMap
	Restore        *v1alpha1.RestoreSpec
	Disks          []commonv1alpha1.DiskSpec
	Config         *v1alpha1.Config
	Log            logr.Logger
	Services       []commonv1alpha1.Service
}

StsParams stores parameters for creating a database stateful set.

type UpdateUsersRequest

type UpdateUsersRequest struct {
	PdbName   string
	UserSpecs []*User
}

type User

type User struct {
	Name string
	// only being used for plaintext password scenario.
	// GSM doesn't use this field.
	Password             string
	Privileges           []string
	PasswordGsmSecretRef *GsmSecretReference
	// only being used for plaintext password scenario.
	// GSM doesn't use this field.
	LastPassword string
}

type UsersChangedRequest

type UsersChangedRequest struct {
	PdbName   string
	UserSpecs []*User
}

type UsersChangedResponse

type UsersChangedResponse struct {
	Changed    bool
	Suppressed []*UsersChangedResponseSuppressed
}

func UsersChanged

func UsersChanged(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req UsersChangedRequest) (*UsersChangedResponse, error)

UsersChanged determines whether there is change on users (update/delete/create).

type UsersChangedResponseSuppressed

type UsersChangedResponseSuppressed struct {
	SuppressType UsersChangedResponseType
	UserName     string
	// sql is the suppressed cmd which can update the user to the spec defined
	// state
	Sql string
}

type UsersChangedResponseType

type UsersChangedResponseType int32
const (
	UsersChangedResponse_UNKNOWN_TYPE UsersChangedResponseType = 0
	UsersChangedResponse_DELETE       UsersChangedResponseType = 1
	UsersChangedResponse_CREATE       UsersChangedResponseType = 2
)

type VerifyPhysicalBackupRequest

type VerifyPhysicalBackupRequest struct {
	GcsPath string
}

type VerifyPhysicalBackupResponse

type VerifyPhysicalBackupResponse struct {
	ErrMsgs []string
}

func VerifyPhysicalBackup

func VerifyPhysicalBackup(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req VerifyPhysicalBackupRequest) (*VerifyPhysicalBackupResponse, error)

VerifyPhysicalBackup verifies the existence of physical backup.

type VerifyStandbySettingsRequest

type VerifyStandbySettingsRequest struct {
	PrimaryHost         string
	PrimaryPort         int32
	PrimaryService      string
	PrimaryUser         string
	PrimaryCredential   *Credential
	StandbyDbUniqueName string
	StandbyCdbName      string
	BackupGcsPath       string
	PasswordFileGcsPath string
	StandbyVersion      string
}

type VerifyStandbySettingsResponse

type VerifyStandbySettingsResponse struct {
	Errors []*standbyhelpers.StandbySettingErr
}

func VerifyStandbySettings

func VerifyStandbySettings(ctx context.Context, r client.Reader, dbClientFactory DatabaseClientFactory, namespace, instName string, req VerifyStandbySettingsRequest) (*VerifyStandbySettingsResponse, error)

VerifyStandbySettings does preflight checks on standby settings.

Jump to

Keyboard shortcuts

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