Skip to content

Commit

Permalink
support migration from use-existing-source to local db when sourceDat…
Browse files Browse the repository at this point in the history
…a is not provided in dbclaim (#177)
  • Loading branch information
bjeevan-ib authored Sep 17, 2023
1 parent dd6e19a commit 6df566f
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 24 deletions.
6 changes: 6 additions & 0 deletions api/v1/databaseclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ type Status struct {

// DbState of the DB. inprogress, "", ready
DbState DbState `json:"DbState,omitempty"`

// SourceDataFrom specifies an existing database or backup to use when initially provisioning the database.
// if the dbclaim has already provisioned a database, this field is ignored
// This field used when claim is use-existing-db and attempting to migrate to newdb
// +optional
SourceDataFrom *SourceDataFrom `json:"sourceDataFrom,omitempty"`
}

// DbState keeps track of state of the DB.
Expand Down
5 changes: 5 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 150 additions & 0 deletions config/crd/bases/persistance.atlas.infoblox.com_databaseclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,81 @@ spec:
description: The optional Shape values are arbitrary and help
drive instance selection
type: string
sourceDataFrom:
description: SourceDataFrom specifies an existing database or
backup to use when initially provisioning the database. if the
dbclaim has already provisioned a database, this field is ignored
This field used when claim is use-existing-db and attempting
to migrate to newdb
properties:
database:
description: Database defines the connection information to
an existing db
properties:
dsn:
description: 'DSN is the connection string used to reach
the postgres database must have protocol specifier at
beginning (example: mysql:// postgres:// )'
type: string
secretRef:
description: 'SecretRef specifies a secret to use for
connecting to the postgresdb (should be master/root)
TODO: document/validate the secret format required'
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
required:
- dsn
type: object
s3:
description: S3 defines the location of a DB backup in an
S3 bucket
properties:
bucket:
type: string
prefix:
description: Prefix is the path prefix of the S3 bucket
within which the backup to restore is located.
type: string
region:
type: string
secretRef:
description: 'SecretRef specifies a secret to use for
connecting to the s3 bucket via AWS client TODO: document/validate
the secret format required'
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
sourceEngine:
description: SourceEngine is the engine used to create
the backup.
type: string
sourceEngineVersion:
description: 'SourceEngineVersion is the version of the
engine used to create the backup. Example: "5.7.30"'
type: string
required:
- bucket
- region
- sourceEngine
- sourceEngineVersion
type: object
type:
description: Type specifies the type of source
type: string
required:
- type
type: object
type:
description: Specifies the type of database to provision. Only
postgres is supported.
Expand Down Expand Up @@ -342,6 +417,81 @@ spec:
description: The optional Shape values are arbitrary and help
drive instance selection
type: string
sourceDataFrom:
description: SourceDataFrom specifies an existing database or
backup to use when initially provisioning the database. if the
dbclaim has already provisioned a database, this field is ignored
This field used when claim is use-existing-db and attempting
to migrate to newdb
properties:
database:
description: Database defines the connection information to
an existing db
properties:
dsn:
description: 'DSN is the connection string used to reach
the postgres database must have protocol specifier at
beginning (example: mysql:// postgres:// )'
type: string
secretRef:
description: 'SecretRef specifies a secret to use for
connecting to the postgresdb (should be master/root)
TODO: document/validate the secret format required'
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
required:
- dsn
type: object
s3:
description: S3 defines the location of a DB backup in an
S3 bucket
properties:
bucket:
type: string
prefix:
description: Prefix is the path prefix of the S3 bucket
within which the backup to restore is located.
type: string
region:
type: string
secretRef:
description: 'SecretRef specifies a secret to use for
connecting to the s3 bucket via AWS client TODO: document/validate
the secret format required'
properties:
name:
type: string
namespace:
type: string
required:
- name
type: object
sourceEngine:
description: SourceEngine is the engine used to create
the backup.
type: string
sourceEngineVersion:
description: 'SourceEngineVersion is the version of the
engine used to create the backup. Example: "5.7.30"'
type: string
required:
- bucket
- region
- sourceEngine
- sourceEngineVersion
type: object
type:
description: Type specifies the type of source
type: string
required:
- type
type: object
type:
description: Specifies the type of database to provision. Only
postgres is supported.
Expand Down
Loading

0 comments on commit 6df566f

Please sign in to comment.