Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import existing databases #57

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions helm/crds/provisioning.totalsoft.ro_azuredatabases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
- domain
type: object
type: array
importDatabaseId:
description: 'Existing database to be used instead of creating a new
one eg: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb'
type: string
platformRef:
description: Target platform (custom resource name).
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ spec:
- domain
type: object
type: array
importDatabaseId:
description: 'Existing database to be used instead of creating a new
one eg: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb'
type: string
managedInstance:
description: Target managed instance spec.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func azureDbDeployFunc(platform string, tenant *platformv1.Tenant,
pulumi.RetainOnDelete(PulumiRetainOnDelete),
pulumi.IgnoreChanges(ignoreChanges),
pulumi.Aliases([]pulumi.Alias{{Name: pulumi.String(dbNameV1)}}),
pulumi.Import(pulumi.ID(dbSpec.Spec.ImportDatabaseId)),
)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func azureManagedDbDeployFunc(platform string, tenant *platformv1.Tenant,
pulumi.RetainOnDelete(PulumiRetainOnDelete),
pulumi.IgnoreChanges(ignoreChanges),
pulumi.Aliases([]pulumi.Alias{{Name: pulumi.String(dbNameV1)}}),
pulumi.Import(pulumi.ID(dbSpec.Spec.ImportDatabaseId)),
)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/provisioning/v1alpha1/azureDatabaseTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type AzureDatabaseSpec struct {
// eg: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb
// +optional
SourceDatabaseId string `json:"sourceDatabaseId,omitempty"`
// Existing database to be used instead of creating a new one
// eg: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb
// +optional
ImportDatabaseId string `json:"importDatabaseId,omitempty"`
// +optional
Exports []AzureDatabaseExportsSpec `json:"exports,omitempty"`
ProvisioningMeta `json:",inline"`
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/provisioning/v1alpha1/azureManagedDatabaseTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ type AzureManagedDatabaseSpec struct {
// Restore from external backup. Leave empty for a new empty database.
// +optional
RestoreFrom AzureManagedDatabaseRestoreSpec `json:"restoreFrom,omitempty"`
// Existing database to be used instead of creating a new one
// eg: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb
// +optional
ImportDatabaseId string `json:"importDatabaseId,omitempty"`
// Export provisioning values spec.
// +optional
Exports []AzureManagedDatabaseExportsSpec `json:"exports,omitempty"`
Expand Down

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

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