зеркало из
1
0
Форкнуть 0

Make elastic pool id configurable on Azure SQL DB (#2184)

This commit is contained in:
Mathis Kretz 2022-03-31 21:48:13 +02:00 коммит произвёл GitHub
Родитель ea17d3e8e9
Коммит cfb40ee2e4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 24 добавлений и 9 удалений

Просмотреть файл

@ -75,6 +75,7 @@ type AzureSqlDatabaseSpec struct {
YearlyRetention string `json:"yearlyRetention,omitempty"`
WeekOfYear int32 `json:"weekOfYear,omitempty"`
ShortTermRetentionPolicy *SQLDatabaseShortTermRetentionPolicy `json:"shortTermRetentionPolicy,omitempty"`
ElasticPoolID string `json:"elasticPoolId,omitempty"`
}
// AzureSqlDatabase is the Schema for the azuresqldatabases API

Двоичные данные
charts/azure-service-operator-1.10.0.tgz Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -1,14 +1,14 @@
apiVersion: azure.microsoft.com/v1beta1
kind: AzureSqlDatabase
metadata:
name: azuresqldatabase-sample
name: azuresqldatabase-sample
labels: # Provide tags to add to AzureSqlDatabase as labels
tag1: value1
tag2: value2
spec:
location: westus
resourceGroup: resourcegroup-azure-operators
server: sqlserver-sample-777
server: sqlserver-sample-777
sku:
name: Basic
tier: Basic
@ -31,6 +31,9 @@ spec:
# The short term retention policy to use
# shortTermRetentionPolicy:
# RetentionDays is the backup retention period in days. This is how many days
# Point-in-Time Restore will be supported.
# retentionDays: 21
# RetentionDays is the backup retention period in days. This is how many days
# Point-in-Time Restore will be supported.
# retentionDays: 21
# The id of the elastic pool to place this database into. Needs to be matched with an appropriate sku
# elasticPoolId: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/some-resource-group-name/providers/Microsoft.Sql/servers/some-sql-server-name/elasticPools/some-elastic-pool-name

Просмотреть файл

@ -57,9 +57,10 @@ func (db *AzureSqlDbManager) Ensure(ctx context.Context, obj runtime.Object, opt
labels := helpers.LabelsToTags(instance.GetLabels())
azureSQLDatabaseProperties := azuresqlshared.SQLDatabaseProperties{
DatabaseName: dbName,
MaxSize: instance.Spec.MaxSize,
Sku: dbSku,
DatabaseName: dbName,
MaxSize: instance.Spec.MaxSize,
ElasticPoolID: instance.Spec.ElasticPoolID,
Sku: dbSku,
}
instance.Status.SetProvisioning("")

Просмотреть файл

@ -37,6 +37,9 @@ type SQLDatabaseProperties struct {
// MaxSize - The max size of the database
MaxSize *resource.Quantity
// ElasticPoolID - The resource identifier of the elastic pool containing this database.
ElasticPoolID string
// Sku - The database SKU.
//
// The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands:
@ -90,8 +93,15 @@ func SQLDatabasePropertiesToDatabase(properties SQLDatabaseProperties) (result s
if properties.MaxSize != nil {
maxSizeBytes = to.Int64Ptr(properties.MaxSize.Value())
}
var elasticPoolID *string
if properties.ElasticPoolID != "" {
elasticPoolID = &properties.ElasticPoolID
}
result = sql.DatabaseProperties{
MaxSizeBytes: maxSizeBytes,
MaxSizeBytes: maxSizeBytes,
ElasticPoolID: elasticPoolID,
}
return result