From 10a2b466b2a688508708337ca5a0a461157bf5d4 Mon Sep 17 00:00:00 2001 From: Bohdan Siryk Date: Fri, 9 Feb 2024 14:49:39 +0200 Subject: [PATCH] issue-702, improvement of cloud provider settings flow --- .secrets.baseline | 16 ++- Makefile | 2 +- apis/clusters/v1beta1/cassandra_webhook.go | 2 +- apis/clusters/v1beta1/generic_spec.go | 132 ++++++++++++++---- apis/clusters/v1beta1/kafka_webhook.go | 2 +- apis/clusters/v1beta1/kafka_webhook_test.go | 18 ++- apis/clusters/v1beta1/opensearch_types.go | 28 ---- apis/clusters/v1beta1/opensearch_webhook.go | 2 +- .../v1beta1/opensearch_webhook_test.go | 45 +++--- apis/clusters/v1beta1/postgresql_types.go | 3 + apis/clusters/v1beta1/redis_webhook.go | 2 +- apis/clusters/v1beta1/structs.go | 55 +++++++- apis/clusters/v1beta1/validation.go | 39 ++++-- .../clusters/v1beta1/zz_generated.deepcopy.go | 75 +++++++++- .../clusters.instaclustr.com_cadences.yaml | 2 +- .../clusters.instaclustr.com_cassandras.yaml | 99 ++++++++++++- ...lusters.instaclustr.com_kafkaconnects.yaml | 2 +- .../clusters.instaclustr.com_kafkas.yaml | 95 ++++++++++++- ...clusters.instaclustr.com_opensearches.yaml | 95 ++++++++++++- .../clusters.instaclustr.com_postgresqls.yaml | 2 +- .../bases/clusters.instaclustr.com_redis.yaml | 95 ++++++++++++- .../clusters.instaclustr.com_zookeepers.yaml | 2 +- .../samples/clusters_v1beta1_opensearch.yaml | 2 + controllers/clusters/cassandra_controller.go | 3 +- .../clusters/datatest/cassandra_v1beta1.yaml | 3 +- .../clusters/datatest/kafka_v1beta1.yaml | 2 +- .../clusters/datatest/opensearch_v1beta1.yaml | 2 +- .../clusters/datatest/redis_v1beta1.yaml | 3 +- controllers/clusters/kafka_controller.go | 3 +- controllers/clusters/opensearch_controller.go | 6 +- doc/clusters/cassandra.md | 100 +++++++------ doc/clusters/kafka.md | 56 +++++--- doc/clusters/opensearch.md | 100 ++++++++----- pkg/models/apiv2.go | 6 +- pkg/models/apiv2_generic.go | 2 +- 35 files changed, 847 insertions(+), 254 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 12024f26f..8f5639220 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -75,6 +75,10 @@ { "path": "detect_secrets.filters.allowlist.is_line_allowlisted" }, + { + "path": "detect_secrets.filters.common.is_baseline_file", + "filename": ".secrets.baseline" + }, { "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", "min_level": 2 @@ -315,21 +319,21 @@ "filename": "apis/clusters/v1beta1/postgresql_types.go", "hashed_secret": "5ffe533b830f08a0326348a9160afafc8ada44db", "is_verified": false, - "line_number": 351 + "line_number": 355 }, { "type": "Secret Keyword", "filename": "apis/clusters/v1beta1/postgresql_types.go", "hashed_secret": "a3d7d4a96d18c8fc5a1cf9c9c01c45b4690b4008", "is_verified": false, - "line_number": 357 + "line_number": 361 }, { "type": "Secret Keyword", "filename": "apis/clusters/v1beta1/postgresql_types.go", "hashed_secret": "a57ce131bd944bdf8ba2f2f93e179dc416ed0315", "is_verified": false, - "line_number": 477 + "line_number": 481 } ], "apis/clusters/v1beta1/redis_types.go": [ @@ -386,7 +390,7 @@ "filename": "apis/clusters/v1beta1/zz_generated.deepcopy.go", "hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c", "is_verified": false, - "line_number": 2198 + "line_number": 2290 } ], "apis/kafkamanagement/v1beta1/kafkauser_types.go": [ @@ -696,7 +700,7 @@ "filename": "doc/clusters/kafka.md", "hashed_secret": "92429d82a41e930486c6de5ebda9602d55c39986", "is_verified": false, - "line_number": 166 + "line_number": 184 } ], "doc/kafkamanagment/kafka-user.md": [ @@ -1126,5 +1130,5 @@ } ] }, - "generated_at": "2024-02-13T09:35:50Z" + "generated_at": "2024-02-12T11:41:39Z" } diff --git a/Makefile b/Makefile index 507a1cd2a..0b20f0367 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ test-webhooks: KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./apis/clusters/v1beta1 -coverprofile cover.out .PHONY: test - test: manifests generate fmt vet docker-build-server-stub run-server-stub envtest test-clusters test-clusterresources test-webhooks test-kafkamanagement test-users stop-server-stub + test: manifests generate fmt vet docker-build-server-stub run-server-stub envtest test-webhooks test-clusters test-clusterresources test-webhooks test-kafkamanagement test-users stop-server-stub .PHONY: goimports goimports: diff --git a/apis/clusters/v1beta1/cassandra_webhook.go b/apis/clusters/v1beta1/cassandra_webhook.go index 18ca3126c..10727c205 100644 --- a/apis/clusters/v1beta1/cassandra_webhook.go +++ b/apis/clusters/v1beta1/cassandra_webhook.go @@ -310,7 +310,7 @@ func (cs *CassandraSpec) validateDataCentresUpdate(oldSpec CassandraSpec) error return fmt.Errorf("deleting nodes is not supported. Number of nodes must be greater than: %v", oldDC.NodesNumber) } - err := newDC.validateImmutableCloudProviderSettingsUpdate(oldDC.CloudProviderSettings) + err := newDC.validateImmutableCloudProviderSettingsUpdate(&oldDC.GenericDataCentreSpec) if err != nil { return err } diff --git a/apis/clusters/v1beta1/generic_spec.go b/apis/clusters/v1beta1/generic_spec.go index a75507ed4..55aef4011 100644 --- a/apis/clusters/v1beta1/generic_spec.go +++ b/apis/clusters/v1beta1/generic_spec.go @@ -99,14 +99,47 @@ func (s *GenericClusterSpec) ClusterSettingsUpdateToInstAPI() *models.ClusterSet } type GenericDataCentreSpec struct { - Name string `json:"name,omitempty"` - Region string `json:"region"` + // A logical name for the data centre within a cluster. + // These names must be unique in the cluster. + Name string `json:"name"` + + // Region of the Data Centre. + Region string `json:"region"` + + // Name of a cloud provider service. CloudProvider string `json:"cloudProvider"` + + // For customers running in their own account. + // Your provider account can be found on the Create Cluster page on the Instaclustr Console, + // or the "Provider Account" property on any existing cluster. + // For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. + // //+kubebuilder:default:=INSTACLUSTR - ProviderAccountName string `json:"accountName,omitempty"` - Network string `json:"network"` - Tags map[string]string `json:"tags,omitempty"` - CloudProviderSettings []*CloudProviderSettings `json:"cloudProviderSettings,omitempty"` + ProviderAccountName string `json:"accountName,omitempty"` + + // The private network address block for the Data Centre specified using CIDR address notation. + // The network must have a prefix length between /12 and /22 and must be part of a private address space. + Network string `json:"network"` + + // List of tags to apply to the Data Centre. + // Tags are metadata labels which allow you to identify, categorize and filter clusters. + // This can be useful for grouping together clusters into applications, environments, or any category that you require. + Tags map[string]string `json:"tags,omitempty"` + + // AWS specific settings for the Data Centre. Cannot be provided with GCP or Azure settings. + // + //+kubebuilder:validation:MaxItems:=1 + AWSSettings []*AWSSettings `json:"awsSettings,omitempty"` + + // GCP specific settings for the Data Centre. Cannot be provided with AWS or Azure settings. + // + //+kubebuilder:validation:MaxItems:=1 + GCPSettings []*GCPSettings `json:"gcpSettings,omitempty"` + + // Azure specific settings for the Data Centre. Cannot be provided with AWS or GCP settings. + // + //+kubebuilder:validation:MaxItems:=1 + AzureSettings []*AzureSettings `json:"azureSettings,omitempty"` } func (s *GenericDataCentreSpec) Equals(o *GenericDataCentreSpec) bool { @@ -116,7 +149,9 @@ func (s *GenericDataCentreSpec) Equals(o *GenericDataCentreSpec) bool { s.ProviderAccountName == o.ProviderAccountName && s.Network == o.Network && areTagsEqual(s.Tags, o.Tags) && - slices.EqualsPtr(s.CloudProviderSettings, o.CloudProviderSettings) + slices.EqualsPtr(s.AWSSettings, o.AWSSettings) && + slices.EqualsPtr(s.GCPSettings, o.GCPSettings) && + slices.EqualsPtr(s.AzureSettings, o.AzureSettings) } func (s *GenericDataCentreSpec) FromInstAPI(model *models.GenericDataCentreFields) { @@ -126,28 +161,7 @@ func (s *GenericDataCentreSpec) FromInstAPI(model *models.GenericDataCentreField s.ProviderAccountName = model.ProviderAccountName s.Network = model.Network s.Tags = tagsFromInstAPI(model.Tags) - s.CloudProviderSettings = cloudProviderSettingsFromInstAPI(model) -} - -func (dc *GenericDataCentreSpec) CloudProviderSettingsToInstAPI() models.CloudProviderSettings { - instaModel := models.CloudProviderSettings{} - - switch dc.CloudProvider { - case models.AWSVPC: - for _, providerSettings := range dc.CloudProviderSettings { - instaModel.AWSSettings = append(instaModel.AWSSettings, providerSettings.AWSToInstAPI()) - } - case models.AZUREAZ: - for _, providerSettings := range dc.CloudProviderSettings { - instaModel.AzureSettings = append(instaModel.AzureSettings, providerSettings.AzureToInstAPI()) - } - case models.GCP: - for _, providerSettings := range dc.CloudProviderSettings { - instaModel.GCPSettings = append(instaModel.GCPSettings, providerSettings.GCPToInstAPI()) - } - } - - return instaModel + s.cloudProviderSettingsFromInstAPI(model.CloudProviderSettings) } func (s *GenericDataCentreSpec) ToInstAPI() models.GenericDataCentreFields { @@ -158,6 +172,64 @@ func (s *GenericDataCentreSpec) ToInstAPI() models.GenericDataCentreFields { Region: s.Region, ProviderAccountName: s.ProviderAccountName, Tags: tagsToInstAPI(s.Tags), - CloudProviderSettings: s.CloudProviderSettingsToInstAPI(), + CloudProviderSettings: s.cloudProviderSettingsToInstAPI(), + } +} + +func (s *GenericDataCentreSpec) cloudProviderSettingsToInstAPI() *models.CloudProviderSettings { + var instaModel *models.CloudProviderSettings + + switch { + case len(s.AWSSettings) > 0: + setting := s.AWSSettings[0] + instaModel = &models.CloudProviderSettings{AWSSettings: []*models.AWSSetting{{ + EBSEncryptionKey: setting.DiskEncryptionKey, + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + BackupBucket: setting.BackupBucket, + }}} + case len(s.GCPSettings) > 0: + setting := s.GCPSettings[0] + instaModel = &models.CloudProviderSettings{GCPSettings: []*models.GCPSetting{{ + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + DisableSnapshotAutoExpiry: setting.DisableSnapshotAutoExpiry, + }}} + case len(s.AzureSettings) > 0: + setting := s.AzureSettings[0] + instaModel = &models.CloudProviderSettings{AzureSettings: []*models.AzureSetting{{ + ResourceGroup: setting.ResourceGroup, + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + StorageNetwork: setting.StorageNetwork, + }}} + } + + return instaModel +} + +func (s *GenericDataCentreSpec) cloudProviderSettingsFromInstAPI(instaModel *models.CloudProviderSettings) { + if instaModel == nil { + return + } + + switch { + case len(instaModel.AWSSettings) > 0: + setting := instaModel.AWSSettings[0] + s.AWSSettings = []*AWSSettings{{ + DiskEncryptionKey: setting.EBSEncryptionKey, + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + BackupBucket: setting.BackupBucket, + }} + case len(instaModel.GCPSettings) > 0: + setting := instaModel.GCPSettings[0] + s.GCPSettings = []*GCPSettings{{ + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + DisableSnapshotAutoExpiry: setting.DisableSnapshotAutoExpiry, + }} + case len(instaModel.AzureSettings) > 0: + setting := instaModel.AzureSettings[0] + s.AzureSettings = []*AzureSettings{{ + ResourceGroup: setting.ResourceGroup, + CustomVirtualNetworkID: setting.CustomVirtualNetworkID, + StorageNetwork: setting.StorageNetwork, + }} } } diff --git a/apis/clusters/v1beta1/kafka_webhook.go b/apis/clusters/v1beta1/kafka_webhook.go index ff429d7b1..f41df993a 100644 --- a/apis/clusters/v1beta1/kafka_webhook.go +++ b/apis/clusters/v1beta1/kafka_webhook.go @@ -334,7 +334,7 @@ func (ks *KafkaSpec) validateImmutableDataCentresFieldsUpdate(oldSpec *KafkaSpec return fmt.Errorf("deleting nodes is not supported. Number of nodes must be greater than: %v", oldDC.NodesNumber) } - err := newDC.validateImmutableCloudProviderSettingsUpdate(oldDC.CloudProviderSettings) + err := newDC.validateImmutableCloudProviderSettingsUpdate(&oldDC.GenericDataCentreSpec) if err != nil { return err } diff --git a/apis/clusters/v1beta1/kafka_webhook_test.go b/apis/clusters/v1beta1/kafka_webhook_test.go index 66f51492e..6743f9620 100644 --- a/apis/clusters/v1beta1/kafka_webhook_test.go +++ b/apis/clusters/v1beta1/kafka_webhook_test.go @@ -194,10 +194,22 @@ var _ = Describe("Kafka Controller", Ordered, func() { Expect(k8sClient.Patch(ctx, &testKafkaManifest, patch)).ShouldNot(Succeed()) testKafkaManifest.Spec.DataCentres[0].Network = prevStringField - prevCloudProviderSettings := kafkaManifest.Spec.DataCentres[0].CloudProviderSettings - testKafkaManifest.Spec.DataCentres[0].CloudProviderSettings = []*CloudProviderSettings{prevCloudProviderSettings[0], prevCloudProviderSettings[0]} + prevAWSSettings := kafkaManifest.Spec.DataCentres[0].AWSSettings + testKafkaManifest.Spec.DataCentres[0].AWSSettings = []*AWSSettings{prevAWSSettings[0], prevAWSSettings[0]} Expect(k8sClient.Patch(ctx, &testKafkaManifest, patch)).ShouldNot(Succeed()) - testKafkaManifest.Spec.DataCentres[0].CloudProviderSettings = prevCloudProviderSettings + testKafkaManifest.Spec.DataCentres[0].AWSSettings = prevAWSSettings + + prevGCPSettings := kafkaManifest.Spec.DataCentres[0].GCPSettings + gcpSettings := &GCPSettings{CustomVirtualNetworkID: "test-network-id", DisableSnapshotAutoExpiry: true} + testKafkaManifest.Spec.DataCentres[0].GCPSettings = []*GCPSettings{gcpSettings, gcpSettings} + Expect(k8sClient.Patch(ctx, &testKafkaManifest, patch)).ShouldNot(Succeed()) + testKafkaManifest.Spec.DataCentres[0].GCPSettings = prevGCPSettings + + prevAzureSettings := kafkaManifest.Spec.DataCentres[0].AzureSettings + azureSettings := &AzureSettings{ResourceGroup: "test-resource-group", CustomVirtualNetworkID: "test-network-id", StorageNetwork: "test-storage-network"} + testKafkaManifest.Spec.DataCentres[0].AzureSettings = []*AzureSettings{azureSettings, azureSettings} + Expect(k8sClient.Patch(ctx, &testKafkaManifest, patch)).ShouldNot(Succeed()) + testKafkaManifest.Spec.DataCentres[0].AzureSettings = prevAzureSettings testKafkaManifest.Spec.DataCentres[0].Tags["test"] = "test" Expect(k8sClient.Patch(ctx, &testKafkaManifest, patch)).ShouldNot(Succeed()) diff --git a/apis/clusters/v1beta1/opensearch_types.go b/apis/clusters/v1beta1/opensearch_types.go index 9fd7120fc..ec710cdde 100644 --- a/apis/clusters/v1beta1/opensearch_types.go +++ b/apis/clusters/v1beta1/opensearch_types.go @@ -293,34 +293,6 @@ func tagsFromInstAPI(iTags []*models.Tag) map[string]string { return newTags } -func cloudProviderSettingsFromInstAPI(iDC *models.GenericDataCentreFields) (settings []*CloudProviderSettings) { - switch iDC.CloudProvider { - case models.AWSVPC: - for _, awsSetting := range iDC.AWSSettings { - settings = append(settings, &CloudProviderSettings{ - CustomVirtualNetworkID: awsSetting.CustomVirtualNetworkID, - DiskEncryptionKey: awsSetting.EBSEncryptionKey, - BackupBucket: awsSetting.BackupBucket, - }) - } - case models.GCP: - for _, gcpSetting := range iDC.GCPSettings { - settings = append(settings, &CloudProviderSettings{ - CustomVirtualNetworkID: gcpSetting.CustomVirtualNetworkID, - DisableSnapshotAutoExpiry: gcpSetting.DisableSnapshotAutoExpiry, - }) - } - case models.AZUREAZ: - for _, azureSetting := range iDC.AzureSettings { - settings = append(settings, &CloudProviderSettings{ - ResourceGroup: azureSetting.ResourceGroup, - }) - } - } - - return settings -} - func (c *OpenSearch) GetSpec() OpenSearchSpec { return c.Spec } func (c *OpenSearch) IsSpecEqual(spec OpenSearchSpec) bool { diff --git a/apis/clusters/v1beta1/opensearch_webhook.go b/apis/clusters/v1beta1/opensearch_webhook.go index 0ff3312f5..ca48a881e 100644 --- a/apis/clusters/v1beta1/opensearch_webhook.go +++ b/apis/clusters/v1beta1/opensearch_webhook.go @@ -351,7 +351,7 @@ func (oss *OpenSearchSpec) validateImmutableDataCentresUpdate(oldDCs []*OpenSear return fmt.Errorf("cannot update immutable data centre fields: new spec: %v: old spec: %v", newDCImmutableFields, oldDCImmutableFields) } - err := oldDC.validateImmutableCloudProviderSettingsUpdate(newDC.CloudProviderSettings) + err := oldDC.validateImmutableCloudProviderSettingsUpdate(&newDC.GenericDataCentreSpec) if err != nil { return err } diff --git a/apis/clusters/v1beta1/opensearch_webhook_test.go b/apis/clusters/v1beta1/opensearch_webhook_test.go index 99bf1cae3..a8c536646 100644 --- a/apis/clusters/v1beta1/opensearch_webhook_test.go +++ b/apis/clusters/v1beta1/opensearch_webhook_test.go @@ -66,21 +66,10 @@ var _ = Describe("Kafka Controller", Ordered, func() { Expect(k8sClient.Create(ctx, &testOpenSearchManifest)).ShouldNot(Succeed()) testOpenSearchManifest.Spec.DataCentres[0].ProviderAccountName = prevStringValue - providerSettings := openSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0] - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings = []*CloudProviderSettings{providerSettings, providerSettings} - Expect(k8sClient.Create(ctx, &testOpenSearchManifest)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings = []*CloudProviderSettings{providerSettings} - - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].ResourceGroup = "test" - Expect(k8sClient.Create(ctx, &testOpenSearchManifest)).ShouldNot(Succeed()) - - prevStringValue = openSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey = "" - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].CustomVirtualNetworkID = "test" - Expect(k8sClient.Create(ctx, &testOpenSearchManifest)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].ResourceGroup = "" - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].CustomVirtualNetworkID = "" - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey = prevStringValue + awsSettings := openSearchManifest.Spec.DataCentres[0].AWSSettings[0] + openSearchManifest.Spec.DataCentres[0].AWSSettings = []*AWSSettings{awsSettings, awsSettings} + Expect(k8sClient.Create(ctx, &openSearchManifest)).ShouldNot(Succeed()) + openSearchManifest.Spec.DataCentres[0].AWSSettings = []*AWSSettings{awsSettings} prevStringValue = openSearchManifest.Spec.DataCentres[0].Network testOpenSearchManifest.Spec.DataCentres[0].Network = "test/test" @@ -277,25 +266,25 @@ var _ = Describe("Kafka Controller", Ordered, func() { Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) testOpenSearchManifest.Spec.DataCentres[0].NumberOfRacks -= 1 - prevCloudProviderSettings := openSearchManifest.Spec.DataCentres[0].CloudProviderSettings - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings = []*CloudProviderSettings{prevCloudProviderSettings[0], prevCloudProviderSettings[0]} - Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings = []*CloudProviderSettings{prevCloudProviderSettings[0]} + prevAWSSettings := openSearchManifest.Spec.DataCentres[0].AWSSettings + openSearchManifest.Spec.DataCentres[0].AWSSettings = []*AWSSettings{prevAWSSettings[0], prevAWSSettings[0]} + Expect(k8sClient.Patch(ctx, &openSearchManifest, patch)).ShouldNot(Succeed()) + openSearchManifest.Spec.DataCentres[0].AWSSettings = prevAWSSettings - prevStringValue = openSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey = "test" + prevStringValue = openSearchManifest.Spec.DataCentres[0].AWSSettings[0].DiskEncryptionKey + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].DiskEncryptionKey = "test" Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].DiskEncryptionKey = prevStringValue + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].DiskEncryptionKey = prevStringValue - prevStringValue = openSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].ResourceGroup - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].ResourceGroup = "test" + prevStringValue = openSearchManifest.Spec.DataCentres[0].AWSSettings[0].CustomVirtualNetworkID + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].CustomVirtualNetworkID = "test" Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].ResourceGroup = prevStringValue + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].CustomVirtualNetworkID = prevStringValue - prevStringValue = openSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].CustomVirtualNetworkID - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].CustomVirtualNetworkID = "test" + prevStringValue = openSearchManifest.Spec.DataCentres[0].AWSSettings[0].BackupBucket + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].BackupBucket = "test" Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) - testOpenSearchManifest.Spec.DataCentres[0].CloudProviderSettings[0].CustomVirtualNetworkID = prevStringValue + testOpenSearchManifest.Spec.DataCentres[0].AWSSettings[0].BackupBucket = prevStringValue testOpenSearchManifest.Spec.DataCentres[0].Tags["test"] = "test" Expect(k8sClient.Patch(ctx, &testOpenSearchManifest, patch)).ShouldNot(Succeed()) diff --git a/apis/clusters/v1beta1/postgresql_types.go b/apis/clusters/v1beta1/postgresql_types.go index 1f49b3901..035f6df5b 100644 --- a/apis/clusters/v1beta1/postgresql_types.go +++ b/apis/clusters/v1beta1/postgresql_types.go @@ -125,6 +125,9 @@ func (pg *PostgreSQL) GetJobID(jobName string) string { func (pg *PostgreSQL) NewPatch() client.Patch { old := pg.DeepCopy() + if old.Annotations == nil { + old.Annotations = make(map[string]string) + } old.Annotations[models.ResourceStateAnnotation] = "" return client.MergeFrom(old) } diff --git a/apis/clusters/v1beta1/redis_webhook.go b/apis/clusters/v1beta1/redis_webhook.go index 3718885aa..97d28ac0d 100644 --- a/apis/clusters/v1beta1/redis_webhook.go +++ b/apis/clusters/v1beta1/redis_webhook.go @@ -279,7 +279,7 @@ func (rs *RedisSpec) validateDCsUpdate(oldSpec RedisSpec) error { return err } - err = newDC.validateImmutableCloudProviderSettingsUpdate(oldDC.CloudProviderSettings) + err = newDC.validateImmutableCloudProviderSettingsUpdate(&oldDC.GenericDataCentreSpec) if err != nil { return err } diff --git a/apis/clusters/v1beta1/structs.go b/apis/clusters/v1beta1/structs.go index eac0defd9..8a9744104 100644 --- a/apis/clusters/v1beta1/structs.go +++ b/apis/clusters/v1beta1/structs.go @@ -30,7 +30,7 @@ type CloudProviderSettings struct { ResourceGroup string `json:"resourceGroup,omitempty"` DiskEncryptionKey string `json:"diskEncryptionKey,omitempty"` BackupBucket string `json:"backupBucket,omitempty"` - DisableSnapshotAutoExpiry string `json:"disableSnapshotAutoExpiry,omitempty"` + DisableSnapshotAutoExpiry bool `json:"disableSnapshotAutoExpiry,omitempty"` } type DataCentre struct { @@ -832,3 +832,56 @@ func (g GenericResizeSettings) Equal(o GenericResizeSettings) bool { return true } + +type AWSSettings struct { + // ID of a KMS encryption key to encrypt data on nodes. + // KMS encryption key must be set in Cluster Resources through + //the Instaclustr Console before provisioning an encrypted Data Centre. + DiskEncryptionKey string `json:"encryptionKey,omitempty"` + + // VPC ID into which the Data Centre will be provisioned. + // The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC. + CustomVirtualNetworkID string `json:"customVirtualNetworkId,omitempty"` + + // Specify the S3 bucket to use for storing backup data for the cluster data centre. + // Only available for customers running in their own cloud provider accounts. + // Currently supported for OpenSearch clusters only. + BackupBucket string `json:"backupBucket,omitempty"` +} + +type GCPSettings struct { + // Network name or a relative Network or Subnetwork URI. + // The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet. + // + // Examples: + // Network URI: projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + // Network name: {network-name}, equivalent to projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + // Same-project subnetwork URI: projects/{riyoa-gcp-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + // Shared VPC subnetwork URI: projects/{riyoa-gcp-host-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + CustomVirtualNetworkID string `json:"customVirtualNetworkId,omitempty"` + + // Specify whether the GCS backup bucket should automatically expire data after 7 days or not. + // Setting this to true will disable automatic expiry and will allow for creation of custom snapshot + // repositories with customisable retention using the Index Management Plugin. + // The storage will have to be manually cleared after the cluster is deleted. + // Only available for customers running in their own cloud provider accounts. + // Currently supported for OpenSearch clusters only. + DisableSnapshotAutoExpiry bool `json:"disableSnapshotAutoExpiry,omitempty"` +} + +type AzureSettings struct { + // The name of the Azure Resource Group into which the Data Centre will be provisioned. + ResourceGroup string `json:"resourceGroup,omitempty"` + + // VNet ID into which the Data Centre will be provisioned. + // The VNet must have an available address space for the Data Centre's network + // allocation to be appended to the VNet. + // Currently supported for PostgreSQL clusters only. + CustomVirtualNetworkID string `json:"customVirtualNetworkId,omitempty"` + + // The private network address block to be used for the storage network. + // This is only used for certain node sizes, currently limited to those which use Azure NetApp Files: + // for all other node sizes, this field should not be provided. + // The network must have a prefix length between /16 and /28, and must be part of a private address range. + StorageNetwork string `json:"storageNetwork,omitempty"` +} diff --git a/apis/clusters/v1beta1/validation.go b/apis/clusters/v1beta1/validation.go index 041581066..54744546c 100644 --- a/apis/clusters/v1beta1/validation.go +++ b/apis/clusters/v1beta1/validation.go @@ -18,6 +18,7 @@ package v1beta1 import ( "context" + "errors" "fmt" "regexp" "strings" @@ -406,19 +407,13 @@ func (s *GenericDataCentreSpec) validateCreation() error { } } - if s.ProviderAccountName == models.DefaultAccountName && len(s.CloudProviderSettings) != 0 { + if s.ProviderAccountName == models.DefaultAccountName && s.hasCloudProviderSettings() { return fmt.Errorf("cloud provider settings can be used only with RIYOA accounts") } - if len(s.CloudProviderSettings) > 1 { - return fmt.Errorf("cloud provider settings should not have more than 1 item") - } - - for _, cp := range s.CloudProviderSettings { - err := cp.ValidateCreation() - if err != nil { - return err - } + err := s.validateCloudProviderSettings() + if err != nil { + return err } if !peerSubnetsRegExp.Match([]byte(s.Network)) { @@ -442,10 +437,30 @@ func (s *GenericDataCentreSpec) ValidateOnPremisesCreation() error { return nil } -func (s *GenericDataCentreSpec) validateImmutableCloudProviderSettingsUpdate(oldSettings []*CloudProviderSettings) error { - if !slices.EqualsPtr(s.CloudProviderSettings, oldSettings) { +func (s *GenericDataCentreSpec) validateImmutableCloudProviderSettingsUpdate(old *GenericDataCentreSpec) error { + if !slices.EqualsPtr(s.AWSSettings, old.AWSSettings) { + return models.ErrImmutableCloudProviderSettings + } + + if !slices.EqualsPtr(s.GCPSettings, old.GCPSettings) { return models.ErrImmutableCloudProviderSettings } + if !slices.EqualsPtr(s.AzureSettings, old.AzureSettings) { + return models.ErrImmutableCloudProviderSettings + } + + return nil +} + +func (s *GenericDataCentreSpec) validateCloudProviderSettings() error { + if sum := len(s.AWSSettings) + len(s.AzureSettings) + len(s.GCPSettings); sum > 1 { + return errors.New("only one of [awsSettings, gcpSettings, azureSettings] should be set") + } + return nil } + +func (s *GenericDataCentreSpec) hasCloudProviderSettings() bool { + return s.AWSSettings != nil || s.GCPSettings != nil && s.AzureSettings != nil +} diff --git a/apis/clusters/v1beta1/zz_generated.deepcopy.go b/apis/clusters/v1beta1/zz_generated.deepcopy.go index eedf2a10e..9dfb532d6 100644 --- a/apis/clusters/v1beta1/zz_generated.deepcopy.go +++ b/apis/clusters/v1beta1/zz_generated.deepcopy.go @@ -58,6 +58,21 @@ func (in *AWSConnectorSettings) DeepCopy() *AWSConnectorSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSSettings) DeepCopyInto(out *AWSSettings) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSSettings. +func (in *AWSSettings) DeepCopy() *AWSSettings { + if in == nil { + return nil + } + out := new(AWSSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AdvancedVisibility) DeepCopyInto(out *AdvancedVisibility) { *out = *in @@ -98,6 +113,21 @@ func (in *AzureConnectorSettings) DeepCopy() *AzureConnectorSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureSettings) DeepCopyInto(out *AzureSettings) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSettings. +func (in *AzureSettings) DeepCopy() *AzureSettings { + if in == nil { + return nil + } + out := new(AzureSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundledCassandraSpec) DeepCopyInto(out *BundledCassandraSpec) { *out = *in @@ -931,6 +961,21 @@ func (in *GCPConnectorSettings) DeepCopy() *GCPConnectorSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GCPSettings) DeepCopyInto(out *GCPSettings) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPSettings. +func (in *GCPSettings) DeepCopy() *GCPSettings { + if in == nil { + return nil + } + out := new(GCPSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenericClusterSpec) DeepCopyInto(out *GenericClusterSpec) { *out = *in @@ -967,13 +1012,35 @@ func (in *GenericDataCentreSpec) DeepCopyInto(out *GenericDataCentreSpec) { (*out)[key] = val } } - if in.CloudProviderSettings != nil { - in, out := &in.CloudProviderSettings, &out.CloudProviderSettings - *out = make([]*CloudProviderSettings, len(*in)) + if in.AWSSettings != nil { + in, out := &in.AWSSettings, &out.AWSSettings + *out = make([]*AWSSettings, len(*in)) for i := range *in { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] - *out = new(CloudProviderSettings) + *out = new(AWSSettings) + **out = **in + } + } + } + if in.GCPSettings != nil { + in, out := &in.GCPSettings, &out.GCPSettings + *out = make([]*GCPSettings, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(GCPSettings) + **out = **in + } + } + } + if in.AzureSettings != nil { + in, out := &in.AzureSettings, &out.AzureSettings + *out = make([]*AzureSettings, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AzureSettings) **out = **in } } diff --git a/config/crd/bases/clusters.instaclustr.com_cadences.yaml b/config/crd/bases/clusters.instaclustr.com_cadences.yaml index 1447943cd..7fe360a79 100644 --- a/config/crd/bases/clusters.instaclustr.com_cadences.yaml +++ b/config/crd/bases/clusters.instaclustr.com_cadences.yaml @@ -83,7 +83,7 @@ spec: customVirtualNetworkId: type: string disableSnapshotAutoExpiry: - type: string + type: boolean diskEncryptionKey: type: string resourceGroup: diff --git a/config/crd/bases/clusters.instaclustr.com_cassandras.yaml b/config/crd/bases/clusters.instaclustr.com_cassandras.yaml index f4f3c2d2e..7b16982a6 100644 --- a/config/crd/bases/clusters.instaclustr.com_cassandras.yaml +++ b/config/crd/bases/clusters.instaclustr.com_cassandras.yaml @@ -55,26 +55,70 @@ spec: properties: accountName: default: INSTACLUSTR + description: For customers running in their own account. Your + provider account can be found on the Create Cluster page on + the Instaclustr Console, or the "Provider Account" property + on any existing cluster. For customers provisioning on Instaclustr's + cloud provider accounts, this property may be omitted. type: string - clientToClusterEncryption: - type: boolean - cloudProvider: - type: string - cloudProviderSettings: + awsSettings: + description: AWS specific settings for the Data Centre. Cannot + be provided with GCP or Azure settings. items: properties: backupBucket: + description: Specify the S3 bucket to use for storing + backup data for the cluster data centre. Only available + for customers running in their own cloud provider accounts. + Currently supported for OpenSearch clusters only. type: string customVirtualNetworkId: + description: VPC ID into which the Data Centre will be + provisioned. The Data Centre's network allocation must + match the IPv4 CIDR block of the specified VPC. type: string - disableSnapshotAutoExpiry: + encryptionKey: + description: ID of a KMS encryption key to encrypt data + on nodes. KMS encryption key must be set in Cluster + Resources through the Instaclustr Console before provisioning + an encrypted Data Centre. type: string - diskEncryptionKey: + type: object + maxItems: 1 + type: array + azureSettings: + description: Azure specific settings for the Data Centre. Cannot + be provided with AWS or GCP settings. + items: + properties: + customVirtualNetworkId: + description: VNet ID into which the Data Centre will be + provisioned. The VNet must have an available address + space for the Data Centre's network allocation to be + appended to the VNet. Currently supported for PostgreSQL + clusters only. type: string resourceGroup: + description: The name of the Azure Resource Group into + which the Data Centre will be provisioned. + type: string + storageNetwork: + description: 'The private network address block to be + used for the storage network. This is only used for + certain node sizes, currently limited to those which + use Azure NetApp Files: for all other node sizes, this + field should not be provided. The network must have + a prefix length between /16 and /28, and must be part + of a private address range.' type: string type: object + maxItems: 1 type: array + clientToClusterEncryption: + type: boolean + cloudProvider: + description: Name of a cloud provider service. + type: string continuousBackup: type: boolean debezium: @@ -109,9 +153,43 @@ spec: type: object maxItems: 1 type: array + gcpSettings: + description: GCP specific settings for the Data Centre. Cannot + be provided with AWS or Azure settings. + items: + properties: + customVirtualNetworkId: + description: "Network name or a relative Network or Subnetwork + URI. The Data Centre's network allocation must match + the IPv4 CIDR block of the specified subnet. \n Examples: + Network URI: projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Network name: {network-name}, equivalent to projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Same-project subnetwork URI: projects/{riyoa-gcp-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + Shared VPC subnetwork URI: projects/{riyoa-gcp-host-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}." + type: string + disableSnapshotAutoExpiry: + description: Specify whether the GCS backup bucket should + automatically expire data after 7 days or not. Setting + this to true will disable automatic expiry and will + allow for creation of custom snapshot repositories with + customisable retention using the Index Management Plugin. + The storage will have to be manually cleared after the + cluster is deleted. Only available for customers running + in their own cloud provider accounts. Currently supported + for OpenSearch clusters only. + type: boolean + type: object + maxItems: 1 + type: array name: + description: A logical name for the data centre within a cluster. + These names must be unique in the cluster. type: string network: + description: The private network address block for the Data + Centre specified using CIDR address notation. The network + must have a prefix length between /12 and /22 and must be + part of a private address space. type: string nodeSize: type: string @@ -122,6 +200,7 @@ spec: privateLink: type: boolean region: + description: Region of the Data Centre. type: string replicationFactor: type: integer @@ -137,11 +216,17 @@ spec: tags: additionalProperties: type: string + description: List of tags to apply to the Data Centre. Tags + are metadata labels which allow you to identify, categorize + and filter clusters. This can be useful for grouping together + clusters into applications, environments, or any category + that you require. type: object required: - clientToClusterEncryption - cloudProvider - continuousBackup + - name - network - nodeSize - nodesNumber diff --git a/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml b/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml index 69910853b..fefddd33c 100644 --- a/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml +++ b/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml @@ -146,7 +146,7 @@ spec: customVirtualNetworkId: type: string disableSnapshotAutoExpiry: - type: string + type: boolean diskEncryptionKey: type: string resourceGroup: diff --git a/config/crd/bases/clusters.instaclustr.com_kafkas.yaml b/config/crd/bases/clusters.instaclustr.com_kafkas.yaml index 0665a2faa..b81e1f630 100644 --- a/config/crd/bases/clusters.instaclustr.com_kafkas.yaml +++ b/config/crd/bases/clusters.instaclustr.com_kafkas.yaml @@ -63,27 +63,105 @@ spec: properties: accountName: default: INSTACLUSTR + description: For customers running in their own account. Your + provider account can be found on the Create Cluster page on + the Instaclustr Console, or the "Provider Account" property + on any existing cluster. For customers provisioning on Instaclustr's + cloud provider accounts, this property may be omitted. type: string - cloudProvider: - type: string - cloudProviderSettings: + awsSettings: + description: AWS specific settings for the Data Centre. Cannot + be provided with GCP or Azure settings. items: properties: backupBucket: + description: Specify the S3 bucket to use for storing + backup data for the cluster data centre. Only available + for customers running in their own cloud provider accounts. + Currently supported for OpenSearch clusters only. type: string customVirtualNetworkId: + description: VPC ID into which the Data Centre will be + provisioned. The Data Centre's network allocation must + match the IPv4 CIDR block of the specified VPC. type: string - disableSnapshotAutoExpiry: + encryptionKey: + description: ID of a KMS encryption key to encrypt data + on nodes. KMS encryption key must be set in Cluster + Resources through the Instaclustr Console before provisioning + an encrypted Data Centre. type: string - diskEncryptionKey: + type: object + maxItems: 1 + type: array + azureSettings: + description: Azure specific settings for the Data Centre. Cannot + be provided with AWS or GCP settings. + items: + properties: + customVirtualNetworkId: + description: VNet ID into which the Data Centre will be + provisioned. The VNet must have an available address + space for the Data Centre's network allocation to be + appended to the VNet. Currently supported for PostgreSQL + clusters only. type: string resourceGroup: + description: The name of the Azure Resource Group into + which the Data Centre will be provisioned. + type: string + storageNetwork: + description: 'The private network address block to be + used for the storage network. This is only used for + certain node sizes, currently limited to those which + use Azure NetApp Files: for all other node sizes, this + field should not be provided. The network must have + a prefix length between /16 and /28, and must be part + of a private address range.' type: string type: object + maxItems: 1 + type: array + cloudProvider: + description: Name of a cloud provider service. + type: string + gcpSettings: + description: GCP specific settings for the Data Centre. Cannot + be provided with AWS or Azure settings. + items: + properties: + customVirtualNetworkId: + description: "Network name or a relative Network or Subnetwork + URI. The Data Centre's network allocation must match + the IPv4 CIDR block of the specified subnet. \n Examples: + Network URI: projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Network name: {network-name}, equivalent to projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Same-project subnetwork URI: projects/{riyoa-gcp-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + Shared VPC subnetwork URI: projects/{riyoa-gcp-host-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}." + type: string + disableSnapshotAutoExpiry: + description: Specify whether the GCS backup bucket should + automatically expire data after 7 days or not. Setting + this to true will disable automatic expiry and will + allow for creation of custom snapshot repositories with + customisable retention using the Index Management Plugin. + The storage will have to be manually cleared after the + cluster is deleted. Only available for customers running + in their own cloud provider accounts. Currently supported + for OpenSearch clusters only. + type: boolean + type: object + maxItems: 1 type: array name: + description: A logical name for the data centre within a cluster. + These names must be unique in the cluster. type: string network: + description: The private network address block for the Data + Centre specified using CIDR address notation. The network + must have a prefix length between /12 and /22 and must be + part of a private address space. type: string nodeSize: type: string @@ -100,13 +178,20 @@ spec: type: object type: array region: + description: Region of the Data Centre. type: string tags: additionalProperties: type: string + description: List of tags to apply to the Data Centre. Tags + are metadata labels which allow you to identify, categorize + and filter clusters. This can be useful for grouping together + clusters into applications, environments, or any category + that you require. type: object required: - cloudProvider + - name - network - nodeSize - nodesNumber diff --git a/config/crd/bases/clusters.instaclustr.com_opensearches.yaml b/config/crd/bases/clusters.instaclustr.com_opensearches.yaml index 4d82b8d2f..3cff6afc5 100644 --- a/config/crd/bases/clusters.instaclustr.com_opensearches.yaml +++ b/config/crd/bases/clusters.instaclustr.com_opensearches.yaml @@ -73,40 +73,125 @@ spec: properties: accountName: default: INSTACLUSTR + description: For customers running in their own account. Your + provider account can be found on the Create Cluster page on + the Instaclustr Console, or the "Provider Account" property + on any existing cluster. For customers provisioning on Instaclustr's + cloud provider accounts, this property may be omitted. type: string - cloudProvider: - type: string - cloudProviderSettings: + awsSettings: + description: AWS specific settings for the Data Centre. Cannot + be provided with GCP or Azure settings. items: properties: backupBucket: + description: Specify the S3 bucket to use for storing + backup data for the cluster data centre. Only available + for customers running in their own cloud provider accounts. + Currently supported for OpenSearch clusters only. type: string customVirtualNetworkId: + description: VPC ID into which the Data Centre will be + provisioned. The Data Centre's network allocation must + match the IPv4 CIDR block of the specified VPC. type: string - disableSnapshotAutoExpiry: + encryptionKey: + description: ID of a KMS encryption key to encrypt data + on nodes. KMS encryption key must be set in Cluster + Resources through the Instaclustr Console before provisioning + an encrypted Data Centre. type: string - diskEncryptionKey: + type: object + maxItems: 1 + type: array + azureSettings: + description: Azure specific settings for the Data Centre. Cannot + be provided with AWS or GCP settings. + items: + properties: + customVirtualNetworkId: + description: VNet ID into which the Data Centre will be + provisioned. The VNet must have an available address + space for the Data Centre's network allocation to be + appended to the VNet. Currently supported for PostgreSQL + clusters only. type: string resourceGroup: + description: The name of the Azure Resource Group into + which the Data Centre will be provisioned. + type: string + storageNetwork: + description: 'The private network address block to be + used for the storage network. This is only used for + certain node sizes, currently limited to those which + use Azure NetApp Files: for all other node sizes, this + field should not be provided. The network must have + a prefix length between /16 and /28, and must be part + of a private address range.' type: string type: object + maxItems: 1 + type: array + cloudProvider: + description: Name of a cloud provider service. + type: string + gcpSettings: + description: GCP specific settings for the Data Centre. Cannot + be provided with AWS or Azure settings. + items: + properties: + customVirtualNetworkId: + description: "Network name or a relative Network or Subnetwork + URI. The Data Centre's network allocation must match + the IPv4 CIDR block of the specified subnet. \n Examples: + Network URI: projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Network name: {network-name}, equivalent to projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Same-project subnetwork URI: projects/{riyoa-gcp-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + Shared VPC subnetwork URI: projects/{riyoa-gcp-host-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}." + type: string + disableSnapshotAutoExpiry: + description: Specify whether the GCS backup bucket should + automatically expire data after 7 days or not. Setting + this to true will disable automatic expiry and will + allow for creation of custom snapshot repositories with + customisable retention using the Index Management Plugin. + The storage will have to be manually cleared after the + cluster is deleted. Only available for customers running + in their own cloud provider accounts. Currently supported + for OpenSearch clusters only. + type: boolean + type: object + maxItems: 1 type: array name: + description: A logical name for the data centre within a cluster. + These names must be unique in the cluster. type: string network: + description: The private network address block for the Data + Centre specified using CIDR address notation. The network + must have a prefix length between /12 and /22 and must be + part of a private address space. type: string numberOfRacks: type: integer privateLink: type: boolean region: + description: Region of the Data Centre. type: string tags: additionalProperties: type: string + description: List of tags to apply to the Data Centre. Tags + are metadata labels which allow you to identify, categorize + and filter clusters. This can be useful for grouping together + clusters into applications, environments, or any category + that you require. type: object required: - cloudProvider + - name - network - region type: object diff --git a/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml b/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml index e6b0ac9d8..1fcf88cea 100644 --- a/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml +++ b/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml @@ -70,7 +70,7 @@ spec: customVirtualNetworkId: type: string disableSnapshotAutoExpiry: - type: string + type: boolean diskEncryptionKey: type: string resourceGroup: diff --git a/config/crd/bases/clusters.instaclustr.com_redis.yaml b/config/crd/bases/clusters.instaclustr.com_redis.yaml index 06400ae3b..95b8761b5 100644 --- a/config/crd/bases/clusters.instaclustr.com_redis.yaml +++ b/config/crd/bases/clusters.instaclustr.com_redis.yaml @@ -56,29 +56,107 @@ spec: properties: accountName: default: INSTACLUSTR + description: For customers running in their own account. Your + provider account can be found on the Create Cluster page on + the Instaclustr Console, or the "Provider Account" property + on any existing cluster. For customers provisioning on Instaclustr's + cloud provider accounts, this property may be omitted. type: string - cloudProvider: - type: string - cloudProviderSettings: + awsSettings: + description: AWS specific settings for the Data Centre. Cannot + be provided with GCP or Azure settings. items: properties: backupBucket: + description: Specify the S3 bucket to use for storing + backup data for the cluster data centre. Only available + for customers running in their own cloud provider accounts. + Currently supported for OpenSearch clusters only. type: string customVirtualNetworkId: + description: VPC ID into which the Data Centre will be + provisioned. The Data Centre's network allocation must + match the IPv4 CIDR block of the specified VPC. type: string - disableSnapshotAutoExpiry: + encryptionKey: + description: ID of a KMS encryption key to encrypt data + on nodes. KMS encryption key must be set in Cluster + Resources through the Instaclustr Console before provisioning + an encrypted Data Centre. type: string - diskEncryptionKey: + type: object + maxItems: 1 + type: array + azureSettings: + description: Azure specific settings for the Data Centre. Cannot + be provided with AWS or GCP settings. + items: + properties: + customVirtualNetworkId: + description: VNet ID into which the Data Centre will be + provisioned. The VNet must have an available address + space for the Data Centre's network allocation to be + appended to the VNet. Currently supported for PostgreSQL + clusters only. type: string resourceGroup: + description: The name of the Azure Resource Group into + which the Data Centre will be provisioned. + type: string + storageNetwork: + description: 'The private network address block to be + used for the storage network. This is only used for + certain node sizes, currently limited to those which + use Azure NetApp Files: for all other node sizes, this + field should not be provided. The network must have + a prefix length between /16 and /28, and must be part + of a private address range.' + type: string + type: object + maxItems: 1 + type: array + cloudProvider: + description: Name of a cloud provider service. + type: string + gcpSettings: + description: GCP specific settings for the Data Centre. Cannot + be provided with AWS or Azure settings. + items: + properties: + customVirtualNetworkId: + description: "Network name or a relative Network or Subnetwork + URI. The Data Centre's network allocation must match + the IPv4 CIDR block of the specified subnet. \n Examples: + Network URI: projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Network name: {network-name}, equivalent to projects/{riyoa-gcp-project-name}/global/networks/{network-name}. + Same-project subnetwork URI: projects/{riyoa-gcp-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}. + Shared VPC subnetwork URI: projects/{riyoa-gcp-host-project-name}/regions/{region-id}/subnetworks/{subnetwork-name}." type: string + disableSnapshotAutoExpiry: + description: Specify whether the GCS backup bucket should + automatically expire data after 7 days or not. Setting + this to true will disable automatic expiry and will + allow for creation of custom snapshot repositories with + customisable retention using the Index Management Plugin. + The storage will have to be manually cleared after the + cluster is deleted. Only available for customers running + in their own cloud provider accounts. Currently supported + for OpenSearch clusters only. + type: boolean type: object + maxItems: 1 type: array masterNodes: type: integer name: + description: A logical name for the data centre within a cluster. + These names must be unique in the cluster. type: string network: + description: The private network address block for the Data + Centre specified using CIDR address notation. The network + must have a prefix length between /12 and /22 and must be + part of a private address space. type: string nodeSize: type: string @@ -94,6 +172,7 @@ spec: maxItems: 1 type: array region: + description: Region of the Data Centre. type: string replicaNodes: type: integer @@ -108,10 +187,16 @@ spec: tags: additionalProperties: type: string + description: List of tags to apply to the Data Centre. Tags + are metadata labels which allow you to identify, categorize + and filter clusters. This can be useful for grouping together + clusters into applications, environments, or any category + that you require. type: object required: - cloudProvider - masterNodes + - name - network - nodeSize - region diff --git a/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml b/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml index 415a59a57..badcbe5d3 100644 --- a/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml +++ b/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml @@ -65,7 +65,7 @@ spec: customVirtualNetworkId: type: string disableSnapshotAutoExpiry: - type: string + type: boolean diskEncryptionKey: type: string resourceGroup: diff --git a/config/samples/clusters_v1beta1_opensearch.yaml b/config/samples/clusters_v1beta1_opensearch.yaml index c5bef4e3e..ff7d11d71 100644 --- a/config/samples/clusters_v1beta1_opensearch.yaml +++ b/config/samples/clusters_v1beta1_opensearch.yaml @@ -30,6 +30,8 @@ spec: numberOfRacks: 3 privateLink: false region: US_EAST_1 +# awsSettings: +# - backupBucket: instaclustr-us-east-1-backups-preprod # ingestNodes: ## - nodeSize: SRH-DI-PRD-m6g.large-10 # - nodeSize: SRH-DI-DEV-t4g.small-5 diff --git a/controllers/clusters/cassandra_controller.go b/controllers/clusters/cassandra_controller.go index f0af56ded..385d82b17 100644 --- a/controllers/clusters/cassandra_controller.go +++ b/controllers/clusters/cassandra_controller.go @@ -316,9 +316,10 @@ func (r *CassandraReconciler) handleCreateCluster( } if c.Status.State != models.DeletedStatus { + patch := c.NewPatch() c.Annotations[models.ResourceStateAnnotation] = models.CreatedEvent controllerutil.AddFinalizer(c, models.DeletionFinalizer) - err := r.Update(ctx, c) + err := r.Patch(ctx, c, patch) if err != nil { r.EventRecorder.Eventf(c, models.Warning, models.CreationFailed, "Failed to update resource metadata. Reason: %v", err, diff --git a/controllers/clusters/datatest/cassandra_v1beta1.yaml b/controllers/clusters/datatest/cassandra_v1beta1.yaml index a6556b429..ffbf3ab63 100644 --- a/controllers/clusters/datatest/cassandra_v1beta1.yaml +++ b/controllers/clusters/datatest/cassandra_v1beta1.yaml @@ -23,10 +23,9 @@ spec: clientToClusterEncryption: true nodeSize: "CAS-DEV-t4g.small-5" # accountName: "asdf" -# cloudProviderSettings: +# awsSettings: # - customVirtualNetworkId: "vpc-12345678" # diskEncryptionKey: "123e4567-e89b-12d3-a456-426614174000" -# resourceGroup: "asdfadfsdfas" # - name: "Second Data Centre" # region: "US_EAST_1" # cloudProvider: "AWS_VPC" diff --git a/controllers/clusters/datatest/kafka_v1beta1.yaml b/controllers/clusters/datatest/kafka_v1beta1.yaml index fc2a07b18..e2631fd1a 100644 --- a/controllers/clusters/datatest/kafka_v1beta1.yaml +++ b/controllers/clusters/datatest/kafka_v1beta1.yaml @@ -54,7 +54,7 @@ spec: network: "10.0.0.0/16" region: "US_EAST_1" accountName: "Custrom" - cloudProviderSettings: + awsSettings: # - customVirtualNetworkId: "vpc-12345678" - diskEncryptionKey: "123e4567-e89b-12d3-a456-426614174000" # resourceGroup: "asdfadfsdfas" diff --git a/controllers/clusters/datatest/opensearch_v1beta1.yaml b/controllers/clusters/datatest/opensearch_v1beta1.yaml index d400d98e9..9361339c8 100644 --- a/controllers/clusters/datatest/opensearch_v1beta1.yaml +++ b/controllers/clusters/datatest/opensearch_v1beta1.yaml @@ -27,7 +27,7 @@ spec: privateLink: false region: US_EAST_1 accountName: "Custom" - cloudProviderSettings: + awsSettings: - diskEncryptionKey: "123e4567-e89b-12d3-a456-426614174000" tags: tag: "oneTag" diff --git a/controllers/clusters/datatest/redis_v1beta1.yaml b/controllers/clusters/datatest/redis_v1beta1.yaml index 0477c9c4c..638e80f4e 100644 --- a/controllers/clusters/datatest/redis_v1beta1.yaml +++ b/controllers/clusters/datatest/redis_v1beta1.yaml @@ -27,7 +27,6 @@ spec: nodesNumber: 3 name: "testDC2" # accountName: "Custrom" -# cloudProviderSettings: +# awsSettings: # - customVirtualNetworkId: "vpc-12345678" # diskEncryptionKey: "123e4567-e89b-12d3-a456-426614174000" -# resourceGroup: "asdfadfsdfas" diff --git a/controllers/clusters/kafka_controller.go b/controllers/clusters/kafka_controller.go index 38b04ce09..5905f9754 100644 --- a/controllers/clusters/kafka_controller.go +++ b/controllers/clusters/kafka_controller.go @@ -186,9 +186,10 @@ func (r *KafkaReconciler) handleCreateCluster(ctx context.Context, k *v1beta1.Ka } if k.Status.State != models.DeletedStatus { + patch := k.NewPatch() k.Annotations[models.ResourceStateAnnotation] = models.CreatedEvent controllerutil.AddFinalizer(k, models.DeletionFinalizer) - err := r.Update(ctx, k) + err := r.Patch(ctx, k, patch) if err != nil { r.EventRecorder.Eventf(k, models.Warning, models.CreationFailed, "Failed to update resource metadata. Reason: %v", err, diff --git a/controllers/clusters/opensearch_controller.go b/controllers/clusters/opensearch_controller.go index bf5ea6d5a..d439e1a94 100644 --- a/controllers/clusters/opensearch_controller.go +++ b/controllers/clusters/opensearch_controller.go @@ -250,18 +250,18 @@ func (r *OpenSearchReconciler) HandleCreateCluster( logger logr.Logger, ) (reconcile.Result, error) { logger = logger.WithName("OpenSearch creation event") - var err error if o.Status.ID == "" { - err = r.createCluster(ctx, o, logger) + err := r.createCluster(ctx, o, logger) if err != nil { return reconcile.Result{}, fmt.Errorf("failed to create cluster, err: %w", err) } } if o.Status.State != models.DeletedStatus { + patch := o.NewPatch() o.Annotations[models.ResourceStateAnnotation] = models.CreatedEvent controllerutil.AddFinalizer(o, models.DeletionFinalizer) - err := r.Update(ctx, o) + err := r.Patch(ctx, o, patch) if err != nil { r.EventRecorder.Eventf(o, models.Warning, models.CreationFailed, "Failed to update resource metadata. Reason: %v", err, diff --git a/doc/clusters/cassandra.md b/doc/clusters/cassandra.md index 7091d8abe..907e0f81d 100644 --- a/doc/clusters/cassandra.md +++ b/doc/clusters/cassandra.md @@ -2,23 +2,23 @@ ## Available spec fields -| Field | Type | Description | -|-----------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string
**required** | Cluster name. Should have length from 3 to 32 symbols. | -| version | string
**required** | Cassandra instance version.
**Available versions**: `3.11.15`, `3.11.16`, `4.0.10`, `4.0.11`, `4.1.3`. | -| pciCompliance | bool
**required** | Creates a PCI compliant cluster, see [PCI Compliance](https://www.instaclustr.com/support/documentation/useful-information/pci-compliance/) | -| description | string
| A description of the cluster | -| privateNetworkCluster | bool
**required** | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/). | -| slaTier | string
**required** | SLA Tier of the cluster. Non-production clusters may receive lower priority support and reduced SLAs. Production tier is not available when using Developer class nodes. See [SLA Tier](https://www.instaclustr.com/support/documentation/useful-information/sla-tier/) for more information.
**Enum**: `PRODUCTION`, `NON_PRODUCTION`. | -| twoFactorDelete | Array of objects ([TwoFactorDelete](#TwoFactorDeleteObject))
_mutable_ | Contacts that will be contacted when cluster request is sent. | -| schemaRegistry | Array of objects ([KafkaSchemaRegistryDetails](#KafkaSchemaRegistryDetailsObject))
_mutable_ | Adds the specified version of Kafka Schema Registry to this Kafka cluster. | -| luceneEnabled | bool
**required** | Adds Apache Lucene to the Cassandra cluster. | -| passwordAndUserAuth | bool
**required** | Enables Password Authentication and User Authorization. | -| bundledUseOnly | bool
**required** | Provision this cluster for Bundled Use only. | -| restoreFrom | Object ([CassandraRestoreFrom](#CassandraRestoreFromObject)) | Triggers a restore cluster operation. | -| dataCentres | Array of objects ([CassandraDataCentre](#CassandraDataCentreObject))
**required** | Object fields are described below as a bulleted list. | -| resizeSettings | Array of objects ([ResizeSettings](#ResizeSettingsObject))
_mutable_ | Settings to determine how resize requests will be performed for the cluster. | -| onPremisesSpec | Object ([OnPremisesSpec](#OnPremisesSpecObject)) | Specifies settings to provision on-premises cluster inside K8s cluster. | +| Field | Type | Description | +|---------------------|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string
**required** | Cluster name. Should have length from 3 to 32 symbols. | +| version | string
**required** | Cassandra instance version.
**Available versions**: `3.11.15`, `3.11.16`, `4.0.10`, `4.0.11`, `4.1.3`. | +| pciCompliance | bool
**required** | Creates a PCI compliant cluster, see [PCI Compliance](https://www.instaclustr.com/support/documentation/useful-information/pci-compliance/) | +| description | string
| A description of the cluster | +| privateNetwork | bool
**required** | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/). | +| slaTier | string
**required** | SLA Tier of the cluster. Non-production clusters may receive lower priority support and reduced SLAs. Production tier is not available when using Developer class nodes. See [SLA Tier](https://www.instaclustr.com/support/documentation/useful-information/sla-tier/) for more information.
**Enum**: `PRODUCTION`, `NON_PRODUCTION`. | +| twoFactorDelete | Array of objects ([TwoFactorDelete](#TwoFactorDeleteObject))
_mutable_ | Contacts that will be contacted when cluster request is sent. | +| schemaRegistry | Array of objects ([KafkaSchemaRegistryDetails](#KafkaSchemaRegistryDetailsObject))
_mutable_ | Adds the specified version of Kafka Schema Registry to this Kafka cluster. | +| luceneEnabled | bool
**required** | Adds Apache Lucene to the Cassandra cluster. | +| passwordAndUserAuth | bool
**required** | Enables Password Authentication and User Authorization. | +| bundledUseOnly | bool
**required** | Provision this cluster for Bundled Use only. | +| restoreFrom | Object ([CassandraRestoreFrom](#CassandraRestoreFromObject)) | Triggers a restore cluster operation. | +| dataCentres | Array of objects ([CassandraDataCentre](#CassandraDataCentreObject))
**required** | Object fields are described below as a bulleted list. | +| resizeSettings | Array of objects ([ResizeSettings](#ResizeSettingsObject))
_mutable_ | Settings to determine how resize requests will be performed for the cluster. | +| onPremisesSpec | Object ([OnPremisesSpec](#OnPremisesSpecObject)) | Specifies settings to provision on-premises cluster inside K8s cluster. | ### TwoFactorDeleteObject | Field | Type | Description | @@ -38,30 +38,48 @@ | concurrency | integer | Number of concurrent nodes to resize during a resize operation. | ### CassandraDataCentreObject -| Field | Type | Description | -|--------------------------------|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string
**required** | A logical name for the data centre within a cluster. These names must be unique in the cluster. | -| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | -| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ`. | -| accountName | string | For customers running in their own account. Your provider account can be found on the Create Cluster page on the Instaclustr Console, or the "Provider Account" property on any existing cluster. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | -| cloudProviderSettings | Array of objects ([CloudProviderSettings](#CloudProviderSettingsObject)) | Cloud provider specific settings for the Data Centre. | -| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | -| nodeSize | string
**required**
_mutable_ | Size of the nodes provisioned in the Data Centre. Available node sizes, see [Instaclustr API docs NodeSize](https://instaclustr.redoc.ly/Current/tag/Cassandra-Cluster-V2#paths/~1cluster-management~1v2~1resources~1applications~1cassandra~1clusters~1v2/post!path=dataCentres/nodeSize&t=request). | -| nodesNumber | int32
**required**
_mutable_ | Total number of nodes in the Data Centre.
Available values: [1…5]. | -| debezium | Array of objects([DebeziumObject](#DebeziumObject)) | Adds the specified version of Debezium Connector Cassandra to the Cassandra cluster | -| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value. | -| replicationFactor | int32
**required** | Default Replication factor to use for new topic. Also represents the number of racks to use when allocating nodes. | -| continuousBackup | bool
**required** | Enables commitlog backups and increases the frequency of the default snapshot backups. | -| privateIpBroadcastForDiscovery | bool
**required** | Enables broadcast of private IPs for auto-discovery. | -| clientToClusterEncryption | bool
**required** | Enables Client ⇄ Node Encryption. | - - -### CloudProviderSettingsObject -| Field | Type | Description | -|------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| customVirtualNetworkId | string | **AWS**: VPC ID into which the Data Centre will be provisioned. The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC.
**GCP**: Network name or a relative Network or Subnetwork URI e.g. projects/my-project/regions/us-central1/subnetworks/my-subnet. The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet.
Cannot be provided with `resourceGroup` | -| resourceGroup | string | The name of the Azure Resource Group into which the Data Centre will be provisioned.
Cannot be provided with `customVirtualNetworkId` and `diskEncryptionKey` | -| diskEncryptionKey | string | ID of a KMS encryption key to encrypt data on nodes. KMS encryption key must be set in Cluster Resources through the Instaclustr Console before provisioning an encrypted Data Centre.
Cannot be provided with `customVirtualNetworkId` | +| Field | Type | Description | +|--------------------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string
**required** | A logical name for the data centre within a cluster. These names must be unique in the cluster. | +| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | +| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ`. | +| accountName | string | For customers running in their own account. Your provider account can be found on the Create Cluster page on the Instaclustr Console, or the "Provider Account" property on any existing cluster. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | +| awsSettings | Array of objects ([AWSSettings](#AWSSettingsObject)) | | +| gcpSettings | Array of objects ([GCPSettings](#GCPSettingsObject)) | | +| azureSettings | Array of objects ([AzureSettings](#AzureSettingsObject)) | | +| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | +| nodeSize | string
**required**
_mutable_ | Size of the nodes provisioned in the Data Centre. Available node sizes, see [Instaclustr API docs NodeSize](https://instaclustr.redoc.ly/Current/tag/Cassandra-Cluster-V2#paths/~1cluster-management~1v2~1resources~1applications~1cassandra~1clusters~1v2/post!path=dataCentres/nodeSize&t=request). | +| nodesNumber | int32
**required**
_mutable_ | Total number of nodes in the Data Centre.
Available values: [1…5]. | +| debezium | Array of objects([DebeziumObject](#DebeziumObject)) | Adds the specified version of Debezium Connector Cassandra to the Cassandra cluster | +| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value. | +| replicationFactor | int32
**required** | Default Replication factor to use for new topic. Also represents the number of racks to use when allocating nodes. | +| continuousBackup | bool
**required** | Enables commitlog backups and increases the frequency of the default snapshot backups. | +| privateIpBroadcastForDiscovery | bool
**required** | Enables broadcast of private IPs for auto-discovery. | +| clientToClusterEncryption | bool
**required** | Enables Client ⇄ Node Encryption. | + + +### AWSSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VPC ID into which the Data Centre will be provisioned. The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC. | +| diskEncryptionKey | string | ID of a KMS encryption key to encrypt data on nodes. KMS encryption key must be set in Cluster Resources through the Instaclustr Console before provisioning an encrypted Data Centre.
Cannot be provided with `customVirtualNetworkId` | +| backupBucket | string | Specify the S3 bucket to use for storing backup data for the cluster data centre. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only | + +### GCPSettingsObject + +| Field | Type | Description | +|---------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | Network name or a relative Network or Subnetwork URI e.g. projects/my-project/regions/us-central1/subnetworks/my-subnet. The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet.
Cannot be provided with `resourceGroup` | +| disableSnapshotAutoExpiry | string | Specify whether the GCS backup bucket should automatically expire data after 7 days or not. Setting this to true will disable automatic expiry and will allow for creation of custom snapshot repositories with customisable retention using the Index Management Plugin. The storage will have to be manually cleared after the cluster is deleted. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only. | + +### AzureSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VNet ID into which the Data Centre will be provisioned. The VNet must have an available address space for the Data Centre's network allocation to be appended to the VNet. Currently supported for PostgreSQL clusters only. | +| resourceGroup | string | The name of the Azure Resource Group into which the Data Centre will be provisioned. | +| storageNetwork | string | The private network address block to be used for the storage network. This is only used for certain node sizes, currently limited to those which use Azure NetApp Files: for all other node sizes, this field should not be provided. The network must have a prefix length between /16 and /28, and must be part of a private address range. | ### CassandraRestoreFromObject diff --git a/doc/clusters/kafka.md b/doc/clusters/kafka.md index 584c6e022..6ad686432 100644 --- a/doc/clusters/kafka.md +++ b/doc/clusters/kafka.md @@ -7,7 +7,7 @@ | name | string
**required** | Cluster name. Should have length from 3 to 32 symbols. | | version | string
**required** | Kafka instance version.
**Available versions**: `3.1.2`, `3.3.1`, `3.4.1`, `3.5.1`. | | pciCompliance | bool
**required** | Creates a PCI compliant cluster, see [PCI Compliance](https://www.instaclustr.com/support/documentation/useful-information/pci-compliance/) | -| privateNetworkCluster | bool
**required** | Allows topics to be deleted via the kafka-topics tool | +| privateNetwork | bool
**required** | Allows topics to be deleted via the kafka-topics tool | | allowDeleteTopics | bool
**required** | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/). | | slaTier | string
**required** | SLA Tier of the cluster. Non-production clusters may receive lower priority support and reduced SLAs. Production tier is not available when using Developer class nodes. See [SLA Tier](https://www.instaclustr.com/support/documentation/useful-information/sla-tier/) for more information.
**Enum**: `PRODUCTION`, `NON_PRODUCTION`. | | twoFactorDelete | Array of objects ([TwoFactorDelete](#TwoFactorDeleteObject))
_mutable_ | Contacts that will be contacted when cluster request is sent. | @@ -57,18 +57,20 @@ | version | string
**required** | Adds the specified version of Kafka REST Proxy to the Kafka cluster. **Available versions:** `5.0.4`, `5.0.0`. | ### KafkaDataCentreObject -| Field | Type | Description | -|-------------------------|--------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string
**required** | A logical name for the data centre within a cluster. These names must be unique in the cluster. | -| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | -| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ`. | -| accountName | string | For customers running in their own account. Your provider account can be found on the Create Cluster page on the Instaclustr Console, or the "Provider Account" property on any existing cluster. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | -| cloudProviderSettings | Array of objects ([CloudProviderSettings](#CloudProviderSettingsObject)) | Cloud provider specific settings for the Data Centre. | -| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | -| nodeSize | string
**required**
_mutable_ | Size of the nodes provisioned in the Data Centre. Available node sizes, see [Instaclustr API docs NodeSize](https://instaclustr.redoc.ly/Current/tag/Kafka-Cluster-V2#paths/~1cluster-management~1v2~1resources~1applications~1kafka~1clusters~1v2/post!path=dataCentres/nodeSize&t=request). | -| nodesNumber | int32
**required**
_mutable_ | Total number of nodes in the Data Centre.
Available values: [1…5]. | -| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value. | -| privateLink | Array of objects ([PrivateLink](#PrivateLinkObject)) | Create a PrivateLink enabled cluster, see [PrivateLink](https://www.instaclustr.com/support/documentation/useful-information/privatelink/). | +| Field | Type | Description | +|---------------|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string
**required** | A logical name for the data centre within a cluster. These names must be unique in the cluster. | +| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | +| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ`. | +| accountName | string | For customers running in their own account. Your provider account can be found on the Create Cluster page on the Instaclustr Console, or the "Provider Account" property on any existing cluster. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | +| awsSettings | Array of objects ([AWSSettings](#AWSSettingsObject)) | | +| gcpSettings | Array of objects ([GCPSettings](#GCPSettingsObject)) | | +| azureSettings | Array of objects ([AzureSettings](#AzureSettingsObject)) | | +| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | +| nodeSize | string
**required**
_mutable_ | Size of the nodes provisioned in the Data Centre. Available node sizes, see [Instaclustr API docs NodeSize](https://instaclustr.redoc.ly/Current/tag/Kafka-Cluster-V2#paths/~1cluster-management~1v2~1resources~1applications~1kafka~1clusters~1v2/post!path=dataCentres/nodeSize&t=request). | +| nodesNumber | int32
**required**
_mutable_ | Total number of nodes in the Data Centre.
Available values: [1…5]. | +| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value. | +| privateLink | Array of objects ([PrivateLink](#PrivateLinkObject)) | Create a PrivateLink enabled cluster, see [PrivateLink](https://www.instaclustr.com/support/documentation/useful-information/privatelink/). | ### PrivateLinkObject | Field | Type | Description | @@ -76,12 +78,28 @@ | advertisedHostname | string
**required** | The hostname to be used to connect to the PrivateLink cluster. `>= 3 characters` | -### CloudProviderSettingsObject -| Field | Type | Description | -|------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| customVirtualNetworkId | string | **AWS**: VPC ID into which the Data Centre will be provisioned. The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC.
**GCP**: Network name or a relative Network or Subnetwork URI e.g. projects/my-project/regions/us-central1/subnetworks/my-subnet. The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet.
Cannot be provided with `resourceGroup` | -| resourceGroup | string | The name of the Azure Resource Group into which the Data Centre will be provisioned.
Cannot be provided with `customVirtualNetworkId` and `diskEncryptionKey` | -| diskEncryptionKey | string | ID of a KMS encryption key to encrypt data on nodes. KMS encryption key must be set in Cluster Resources through the Instaclustr Console before provisioning an encrypted Data Centre.
Cannot be provided with `customVirtualNetworkId` | +### AWSSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VPC ID into which the Data Centre will be provisioned. The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC. | +| diskEncryptionKey | string | ID of a KMS encryption key to encrypt data on nodes. KMS encryption key must be set in Cluster Resources through the Instaclustr Console before provisioning an encrypted Data Centre.
Cannot be provided with `customVirtualNetworkId` | +| backupBucket | string | Specify the S3 bucket to use for storing backup data for the cluster data centre. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only | + +### GCPSettingsObject + +| Field | Type | Description | +|---------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | Network name or a relative Network or Subnetwork URI e.g. projects/my-project/regions/us-central1/subnetworks/my-subnet. The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet.
Cannot be provided with `resourceGroup` | +| disableSnapshotAutoExpiry | string | Specify whether the GCS backup bucket should automatically expire data after 7 days or not. Setting this to true will disable automatic expiry and will allow for creation of custom snapshot repositories with customisable retention using the Index Management Plugin. The storage will have to be manually cleared after the cluster is deleted. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only. | + +### AzureSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VNet ID into which the Data Centre will be provisioned. The VNet must have an available address space for the Data Centre's network allocation to be appended to the VNet. Currently supported for PostgreSQL clusters only. | +| resourceGroup | string | The name of the Azure Resource Group into which the Data Centre will be provisioned. | +| storageNetwork | string | The private network address block to be used for the storage network. This is only used for certain node sizes, currently limited to those which use Azure NetApp Files: for all other node sizes, this field should not be provided. The network must have a prefix length between /16 and /28, and must be part of a private address range. | ### DedicatedZookeeperObject | Field | Type | Description | diff --git a/doc/clusters/opensearch.md b/doc/clusters/opensearch.md index fbccf4006..629fed638 100644 --- a/doc/clusters/opensearch.md +++ b/doc/clusters/opensearch.md @@ -2,32 +2,32 @@ ## Available spec fields -| Field | Type | Description | -|---------------------------|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string
**required** | Cluster name. Should have length from 3 to 32 symbols. | -| version | string
**required** | OpenSearch instance version. | -| privateNetworkCluster | bool
**required** | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/). | -| slaTier | string
**required** | SLA Tier of the cluster. Non-production clusters may receive lower priority support and reduced SLAs. Production tier is not available when using Developer class nodes. See [SLA Tier](https://www.instaclustr.com/support/documentation/useful-information/sla-tier/) for more information.
**Enum**: `PRODUCTION`, `NON_PRODUCTION`. | -| twoFactorDelete | Array of objects ([TwoFactorDelete](#TwoFactorDeleteObject)) | Contacts that will be contacted when cluster request is sent. | -| dataCentres | Array of objects ([OpenSearchDataCentre](#OpenSearchDataCentreObject))
**required** | List of data centre settings. | -| privateLink | bool | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/) | -| openSearchRestoreFrom | Object ([OpenSearchRestoreFrom](#OpenSearchRestoreFromObject)) | Triggers a restore cluster operation. | -| bundledUseOnly | bool | Provision this cluster for Bundled Use only. | -| pciCompliance | bool
**required** | Creates a PCI compliant cluster, see [PCI Compliance](https://www.instaclustr.com/support/documentation/useful-information/pci-compliance/) | -| clusterManagerNodes | Array of objects ([ClusterManagerNodes](#ClusterManagerNodes))
**required** | List of cluster managers node settings | -| indexManagementPlugin | bool | Enables Index Management Plugin. This helps automate recurring index management activities. | -| alertingPlugin | bool | Enables Alerting Plugin. | -| icuPlugin | bool | Enables ICU Plugin. | -| asynchronousSearchPlugin | bool | Enables asynchronousSearch plugin. | -| anomalyDetectionPlugin | bool | Enables anomalyDetection plugin. | -| sqlPlugin | bool | Enables sql plugin. | -| knnPlugin | bool | Enables knn plugin. | -| notificationsPlugin | bool | Enables notifications plugin. | -| reportingPlugin | bool | Enables reporting plugin. | -| loadBalancer | bool | Enables Load Balancer. | -| dataNodes | Array of objects ([DataNodes](#DataNodes)) | List of data node settings | -| dashboards | Array of objects ([Dashboards](#Dashboards)) | List of dashboards node settings | -| description | string
| A description of the cluster | +| Field | Type | Description | +|--------------------------|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string
**required** | Cluster name. Should have length from 3 to 32 symbols. | +| version | string
**required** | OpenSearch instance version. | +| privateNetwork | bool
**required** | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/). | +| slaTier | string
**required** | SLA Tier of the cluster. Non-production clusters may receive lower priority support and reduced SLAs. Production tier is not available when using Developer class nodes. See [SLA Tier](https://www.instaclustr.com/support/documentation/useful-information/sla-tier/) for more information.
**Enum**: `PRODUCTION`, `NON_PRODUCTION`. | +| twoFactorDelete | Array of objects ([TwoFactorDelete](#TwoFactorDeleteObject)) | Contacts that will be contacted when cluster request is sent. | +| dataCentres | Array of objects ([OpenSearchDataCentre](#OpenSearchDataCentreObject))
**required** | List of data centre settings. | +| privateLink | bool | Creates the cluster with private network only, see [Private Network Clusters](https://www.instaclustr.com/support/documentation/useful-information/private-network-clusters/) | +| openSearchRestoreFrom | Object ([OpenSearchRestoreFrom](#OpenSearchRestoreFromObject)) | Triggers a restore cluster operation. | +| bundledUseOnly | bool | Provision this cluster for Bundled Use only. | +| pciCompliance | bool
**required** | Creates a PCI compliant cluster, see [PCI Compliance](https://www.instaclustr.com/support/documentation/useful-information/pci-compliance/) | +| clusterManagerNodes | Array of objects ([ClusterManagerNodes](#ClusterManagerNodes))
**required** | List of cluster managers node settings | +| indexManagementPlugin | bool | Enables Index Management Plugin. This helps automate recurring index management activities. | +| alertingPlugin | bool | Enables Alerting Plugin. | +| icuPlugin | bool | Enables ICU Plugin. | +| asynchronousSearchPlugin | bool | Enables asynchronousSearch plugin. | +| anomalyDetectionPlugin | bool | Enables anomalyDetection plugin. | +| sqlPlugin | bool | Enables sql plugin. | +| knnPlugin | bool | Enables knn plugin. | +| notificationsPlugin | bool | Enables notifications plugin. | +| reportingPlugin | bool | Enables reporting plugin. | +| loadBalancer | bool | Enables Load Balancer. | +| dataNodes | Array of objects ([DataNodes](#DataNodes)) | List of data node settings | +| dashboards | Array of objects ([Dashboards](#Dashboards)) | List of dashboards node settings | +| description | string
| A description of the cluster | ### DataNodes @@ -63,17 +63,43 @@ ### OpenSearchDataCentreObject -| Field | Type | Description | -|-----------------------|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | A logical name for the data centre within a cluster. These names must be unique in the cluster. | -| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | -| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ` | -| accountName | string
**required** | For customers running in their own account. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | -| cloudProviderSettings | Array of objects ([CloudProviderSettings](#CloudProviderSettingsObject)) | Cloud provider specific settings for the Data Centre | -| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | -| replicationFactor | int32
**required** | Number of racks to use when allocating nodes.
**Available values**: [2…5] | -| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value | -| privateLink | bool | Create a PrivateLink enabled cluster, see [PrivateLink](https://www.instaclustr.com/support/documentation/useful-information/privatelink/) | +| Field | Type | Description | +|-------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | A logical name for the data centre within a cluster. These names must be unique in the cluster. | +| region | string
**required** | Region of the Data Centre. See the description for node size for a compatible Data Centre for a given node size. | +| cloudProvider | string
**required** | Name of the cloud provider service in which the Data Centre will be provisioned.
**Enum**: `AWS_VPC` `GCP` `AZURE` `AZURE_AZ` | +| accountName | string
**required** | For customers running in their own account. For customers provisioning on Instaclustr's cloud provider accounts, this property may be omitted. | +| awsSettings | Array of objects ([AWSSettings](#AWSSettingsObject)) | | +| gcpSettings | Array of objects ([GCPSettings](#GCPSettingsObject)) | | +| azureSettings | Array of objects ([AzureSettings](#AzureSettingsObject)) | | +| network | string
**required** | The private network address block for the Data Centre specified using CIDR address notation. The network must have a prefix length between /12 and /22 and must be part of a private address space. | +| replicationFactor | int32
**required** | Number of racks to use when allocating nodes.
**Available values**: [2…5] | +| tags | map[string]string | List of tags to apply to the Data Centre. Tags are metadata labels which allow you to identify, categorise and filter clusters. This can be useful for grouping together clusters into applications, environments, or any category that you require.
**Format**:
tags:
- key: value | +| privateLink | bool | Create a PrivateLink enabled cluster, see [PrivateLink](https://www.instaclustr.com/support/documentation/useful-information/privatelink/) | + +### AWSSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VPC ID into which the Data Centre will be provisioned. The Data Centre's network allocation must match the IPv4 CIDR block of the specified VPC. | +| diskEncryptionKey | string | ID of a KMS encryption key to encrypt data on nodes. KMS encryption key must be set in Cluster Resources through the Instaclustr Console before provisioning an encrypted Data Centre.
Cannot be provided with `customVirtualNetworkId` | +| backupBucket | string | Specify the S3 bucket to use for storing backup data for the cluster data centre. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only | + +### GCPSettingsObject + +| Field | Type | Description | +|---------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | Network name or a relative Network or Subnetwork URI e.g. projects/my-project/regions/us-central1/subnetworks/my-subnet. The Data Centre's network allocation must match the IPv4 CIDR block of the specified subnet.
Cannot be provided with `resourceGroup` | +| disableSnapshotAutoExpiry | string | Specify whether the GCS backup bucket should automatically expire data after 7 days or not. Setting this to true will disable automatic expiry and will allow for creation of custom snapshot repositories with customisable retention using the Index Management Plugin. The storage will have to be manually cleared after the cluster is deleted. Only available for customers running in their own cloud provider accounts. Currently supported for OpenSearch clusters only. | + +### AzureSettingsObject + +| Field | Type | Description | +|------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| customVirtualNetworkId | string | VNet ID into which the Data Centre will be provisioned. The VNet must have an available address space for the Data Centre's network allocation to be appended to the VNet. Currently supported for PostgreSQL clusters only. | +| resourceGroup | string | The name of the Azure Resource Group into which the Data Centre will be provisioned. | +| storageNetwork | string | The private network address block to be used for the storage network. This is only used for certain node sizes, currently limited to those which use Azure NetApp Files: for all other node sizes, this field should not be provided. The network must have a prefix length between /16 and /28, and must be part of a private address range. | + ### CloudProviderSettingsObject diff --git a/pkg/models/apiv2.go b/pkg/models/apiv2.go index 9473551cf..ac3d0e429 100644 --- a/pkg/models/apiv2.go +++ b/pkg/models/apiv2.go @@ -71,11 +71,13 @@ type AWSSetting struct { type GCPSetting struct { CustomVirtualNetworkID string `json:"customVirtualNetworkId,omitempty"` - DisableSnapshotAutoExpiry string `json:"disableSnapshotAutoExpiry,omitempty"` + DisableSnapshotAutoExpiry bool `json:"disableSnapshotAutoExpiry,omitempty"` } type AzureSetting struct { - ResourceGroup string `json:"resourceGroup,omitempty"` + ResourceGroup string `json:"resourceGroup,omitempty"` + CustomVirtualNetworkID string `json:"customVirtualNetworkId,omitempty"` + StorageNetwork string `json:"storageNetwork,omitempty"` } type Tag struct { diff --git a/pkg/models/apiv2_generic.go b/pkg/models/apiv2_generic.go index 79f316bb5..8d4386ff1 100644 --- a/pkg/models/apiv2_generic.go +++ b/pkg/models/apiv2_generic.go @@ -24,5 +24,5 @@ type GenericDataCentreFields struct { ProviderAccountName string `json:"providerAccountName,omitempty"` Tags []*Tag `json:"tags,omitempty"` - CloudProviderSettings `json:",inline"` + *CloudProviderSettings `json:",inline"` }