diff --git a/mockgcp/mocksql/sqlinstance.go b/mockgcp/mocksql/sqlinstance.go index 0da0075910..a882e45103 100644 --- a/mockgcp/mocksql/sqlinstance.go +++ b/mockgcp/mocksql/sqlinstance.go @@ -95,13 +95,9 @@ func (s *sqlInstancesService) Insert(ctx context.Context, req *pb.SqlInstancesIn fqn := name.String() now := time.Now() - region := "us-central1" - zone := "us-central1-a" - obj := proto.Clone(req.GetBody()).(*pb.DatabaseInstance) obj.Name = name.InstanceName obj.Project = name.Project.ID - obj.Region = region obj.SelfLink = fmt.Sprintf("https://sqladmin.googleapis.com/sql/v1beta4/projects/%s/instances/%s", name.Project.ID, name.InstanceName) @@ -112,8 +108,6 @@ func (s *sqlInstancesService) Insert(ctx context.Context, req *pb.SqlInstancesIn return nil, err } - obj.GceZone = zone - // By default, allocate a public IP for the instance. shouldAllocatePublicIP := true // By default, do not allocate a private IP for the instance. @@ -172,7 +166,9 @@ func (s *sqlInstancesService) Insert(ctx context.Context, req *pb.SqlInstancesIn obj.ServiceAccountEmailAddress = fmt.Sprintf("p%d-abcdef@gcp-sa-cloud-sql.iam.gserviceaccount.com", name.Project.Number) - populateDefaults(obj, zone) + populateDefaults(obj) + + obj.GceZone = obj.Settings.LocationPreference.Zone obj.Settings.SettingsVersion = wrapperspb.Int64(1) @@ -510,7 +506,7 @@ func setDatabaseVersionDefaults(obj *pb.DatabaseInstance) error { return nil } -func populateDefaults(obj *pb.DatabaseInstance, zone string) { +func populateDefaults(obj *pb.DatabaseInstance) { if obj.InstanceType == pb.SqlInstanceType_SQL_INSTANCE_TYPE_UNSPECIFIED { obj.InstanceType = pb.SqlInstanceType_CLOUD_SQL_INSTANCE } @@ -575,13 +571,12 @@ func populateDefaults(obj *pb.DatabaseInstance, zone string) { } } - locationPreference := settings.LocationPreference - if locationPreference == nil { - locationPreference = &pb.LocationPreference{} - settings.LocationPreference = locationPreference + if settings.LocationPreference == nil { + settings.LocationPreference = &pb.LocationPreference{ + Kind: "sql#locationPreference", + Zone: obj.Region + "-a", + } } - locationPreference.Kind = "sql#locationPreference" - locationPreference.Zone = zone backupConfiguration := settings.BackupConfiguration if backupConfiguration == nil { @@ -739,7 +734,7 @@ func (s *sqlInstancesService) Update(ctx context.Context, req *pb.SqlInstancesUp obj.State = existing.State obj.UpgradableDatabaseVersions = existing.UpgradableDatabaseVersions - populateDefaults(obj, existing.GetSettings().GetLocationPreference().GetZone()) + populateDefaults(obj) obj.Settings.SettingsVersion = wrapperspb.Int64(existing.GetSettings().GetSettingsVersion().GetValue() + 1) diff --git a/pkg/controller/direct/sql/mapping.go b/pkg/controller/direct/sql/mapping.go index a570cdd5b6..d6c9a11b09 100644 --- a/pkg/controller/direct/sql/mapping.go +++ b/pkg/controller/direct/sql/mapping.go @@ -309,20 +309,7 @@ func SQLInstanceKRMToGCP(in *krm.SQLInstance, refs *SQLInstanceInternalRefs) (*a } out.Settings.IpConfiguration = InstanceIpConfigurationKRMToGCP(in.Spec.Settings.IpConfiguration, refs) - - if in.Spec.Settings.LocationPreference != nil { - out.Settings.LocationPreference = &api.LocationPreference{} - if in.Spec.Settings.LocationPreference.FollowGaeApplication != nil { - // todo: deprecated - out.Settings.LocationPreference.FollowGaeApplication = *in.Spec.Settings.LocationPreference.FollowGaeApplication - } - if in.Spec.Settings.LocationPreference.SecondaryZone != nil { - out.Settings.LocationPreference.SecondaryZone = *in.Spec.Settings.LocationPreference.SecondaryZone - } - if in.Spec.Settings.LocationPreference.Zone != nil { - out.Settings.LocationPreference.Zone = *in.Spec.Settings.LocationPreference.Zone - } - } + out.Settings.LocationPreference = InstanceLocationPreferenceKRMToGCP(in.Spec.Settings.LocationPreference) if in.Spec.Settings.MaintenanceWindow != nil { out.Settings.MaintenanceWindow = &api.MaintenanceWindow{} @@ -479,6 +466,21 @@ func InstancePscConfigKRMToGCP(in []krm.InstancePscConfig) *api.PscConfig { return out } +func InstanceLocationPreferenceKRMToGCP(in *krm.InstanceLocationPreference) *api.LocationPreference { + if in == nil { + return nil + } + + out := &api.LocationPreference{ + Kind: "sql#locationPreference", + FollowGaeApplication: direct.ValueOf(in.FollowGaeApplication), + SecondaryZone: direct.ValueOf(in.SecondaryZone), + Zone: direct.ValueOf(in.Zone), + } + + return out +} + func SQLInstanceGCPToKRM(in *api.DatabaseInstance) (*krm.SQLInstance, error) { out := &krm.SQLInstance{} @@ -644,60 +646,8 @@ func SQLInstanceGCPToKRM(in *api.DatabaseInstance) (*krm.SQLInstance, error) { } } - if in.Settings.IpConfiguration != nil { - ic := &krm.InstanceIpConfiguration{} - - if in.Settings.IpConfiguration.AllocatedIpRange != "" { - ic.AllocatedIpRange = &in.Settings.IpConfiguration.AllocatedIpRange - } - - if in.Settings.IpConfiguration.AuthorizedNetworks != nil { - ans := []krm.InstanceAuthorizedNetworks{} - for _, an := range in.Settings.IpConfiguration.AuthorizedNetworks { - ans = append(ans, krm.InstanceAuthorizedNetworks{ - ExpirationTime: &an.ExpirationTime, - Name: &an.Name, - Value: an.Value, - }) - } - ic.AuthorizedNetworks = ans - } - - ic.EnablePrivatePathForGoogleCloudServices = &in.Settings.IpConfiguration.EnablePrivatePathForGoogleCloudServices - - ic.Ipv4Enabled = &in.Settings.IpConfiguration.Ipv4Enabled - - if in.Settings.IpConfiguration.PrivateNetwork != "" { - ic.PrivateNetworkRef = &refs.ComputeNetworkRef{ - External: in.Settings.IpConfiguration.PrivateNetwork, - } - } - - if in.Settings.IpConfiguration.PscConfig != nil { - out.Spec.Settings.IpConfiguration.PscConfig = []krm.InstancePscConfig{ - { - AllowedConsumerProjects: in.Settings.IpConfiguration.PscConfig.AllowedConsumerProjects, - PscEnabled: &in.Settings.IpConfiguration.PscConfig.PscEnabled, - }, - } - } - - ic.RequireSsl = &in.Settings.IpConfiguration.RequireSsl - - if in.Settings.IpConfiguration.SslMode != "" { - ic.SslMode = &in.Settings.IpConfiguration.SslMode - } - - out.Spec.Settings.IpConfiguration = ic - } - - if in.Settings.LocationPreference != nil { - out.Spec.Settings.LocationPreference = &krm.InstanceLocationPreference{ - FollowGaeApplication: &in.Settings.LocationPreference.FollowGaeApplication, - SecondaryZone: &in.Settings.LocationPreference.SecondaryZone, - Zone: &in.Settings.LocationPreference.Zone, - } - } + out.Spec.Settings.IpConfiguration = InstanceIpConfigurationGCPToKRM(in.Settings.IpConfiguration) + out.Spec.Settings.LocationPreference = InstanceLocationPreferenceGCPToKRM(in.Settings.LocationPreference) if in.Settings.MaintenanceWindow != nil { out.Spec.Settings.MaintenanceWindow = &krm.InstanceMaintenanceWindow{ @@ -749,6 +699,71 @@ func SQLInstanceGCPToKRM(in *api.DatabaseInstance) (*krm.SQLInstance, error) { return out, nil } +func InstanceIpConfigurationGCPToKRM(in *api.IpConfiguration) *krm.InstanceIpConfiguration { + if in == nil { + return nil + } + + out := &krm.InstanceIpConfiguration{ + AllocatedIpRange: direct.LazyPtr(in.AllocatedIpRange), + AuthorizedNetworks: InstanceAuthorizedNetworksGCPToKRM(in.AuthorizedNetworks), + EnablePrivatePathForGoogleCloudServices: direct.LazyPtr(in.EnablePrivatePathForGoogleCloudServices), + Ipv4Enabled: direct.LazyPtr(in.Ipv4Enabled), + PscConfig: InstancePscConfigGCPToKRM(in.PscConfig), + RequireSsl: direct.LazyPtr(in.RequireSsl), + SslMode: direct.LazyPtr(in.SslMode), + } + + if in.PrivateNetwork != "" { + out.PrivateNetworkRef = &refs.ComputeNetworkRef{ + External: in.PrivateNetwork, + } + } + + return out +} + +func InstanceAuthorizedNetworksGCPToKRM(in []*api.AclEntry) []krm.InstanceAuthorizedNetworks { + out := []krm.InstanceAuthorizedNetworks{} + for _, net := range in { + out = append(out, krm.InstanceAuthorizedNetworks{ + ExpirationTime: direct.LazyPtr(net.ExpirationTime), + Name: direct.LazyPtr(net.Name), + Value: net.Value, + }) + } + return out +} + +func InstancePscConfigGCPToKRM(in *api.PscConfig) []krm.InstancePscConfig { + if in == nil { + return nil + } + + out := []krm.InstancePscConfig{ + { + AllowedConsumerProjects: in.AllowedConsumerProjects, + PscEnabled: direct.LazyPtr(in.PscEnabled), + }, + } + + return out +} + +func InstanceLocationPreferenceGCPToKRM(in *api.LocationPreference) *krm.InstanceLocationPreference { + if in == nil { + return nil + } + + out := &krm.InstanceLocationPreference{ + FollowGaeApplication: direct.LazyPtr(in.FollowGaeApplication), + SecondaryZone: direct.LazyPtr(in.SecondaryZone), + Zone: direct.LazyPtr(in.Zone), + } + + return out +} + func Convert_SQLInstance_API_v1_To_KRM_status(in *api.DatabaseInstance, out *krm.SQLInstanceStatus) error { if in == nil { return fmt.Errorf("cannot convert nil DatabaseInstance") diff --git a/pkg/controller/direct/sql/merge.go b/pkg/controller/direct/sql/merge.go index b31da911b8..f4fd7a767a 100644 --- a/pkg/controller/direct/sql/merge.go +++ b/pkg/controller/direct/sql/merge.go @@ -709,24 +709,9 @@ func MergeDesiredSQLInstanceWithActual(desired *krm.SQLInstance, refs *SQLInstan updateRequired = true } - if desired.Spec.Settings.LocationPreference != nil { - if actual.Settings.LocationPreference == nil { - // Add location preference - updateRequired = true - } else if (direct.ValueOf(desired.Spec.Settings.LocationPreference.FollowGaeApplication) != actual.Settings.LocationPreference.FollowGaeApplication) || - (direct.ValueOf(desired.Spec.Settings.LocationPreference.SecondaryZone) != actual.Settings.LocationPreference.SecondaryZone) || - (direct.ValueOf(desired.Spec.Settings.LocationPreference.Zone) != actual.Settings.LocationPreference.Zone) { - // Change location preference - updateRequired = true - } - merged.Settings.LocationPreference = &api.LocationPreference{ - FollowGaeApplication: direct.ValueOf(desired.Spec.Settings.LocationPreference.FollowGaeApplication), - SecondaryZone: direct.ValueOf(desired.Spec.Settings.LocationPreference.SecondaryZone), - Zone: direct.ValueOf(desired.Spec.Settings.LocationPreference.Zone), - } - } else if actual.Settings.LocationPreference != nil { - // Keep location preference - merged.Settings.LocationPreference = actual.Settings.LocationPreference + merged.Settings.LocationPreference = InstanceLocationPreferenceKRMToGCP(desired.Spec.Settings.LocationPreference) + if !LocationPreferencesMatch(merged.Settings.LocationPreference, actual.Settings.LocationPreference) { + updateRequired = true } if desired.Spec.Settings.MaintenanceWindow != nil { @@ -861,52 +846,39 @@ func MergeDesiredSQLInstanceWithActual(desired *krm.SQLInstance, refs *SQLInstan } func IpConfigurationsMatch(desired *api.IpConfiguration, actual *api.IpConfiguration) bool { - if !PointersMatch(desired, actual) { - return false - } - if desired == nil && actual == nil { return true } - + if !PointersMatch(desired, actual) { + return false + } if desired.AllocatedIpRange != actual.AllocatedIpRange { return false } - if !AclEntryListsMatch(desired.AuthorizedNetworks, actual.AuthorizedNetworks) { return false } - if desired.EnablePrivatePathForGoogleCloudServices != actual.EnablePrivatePathForGoogleCloudServices { return false } - if desired.Ipv4Enabled != actual.Ipv4Enabled { return false } - if desired.PrivateNetwork != actual.PrivateNetwork { return false } - if !PscConfigsMatch(desired.PscConfig, actual.PscConfig) { return false } - if desired.RequireSsl != actual.RequireSsl { return false } - // Ignore ServerCaMode. It is not supported in KRM API. - if desired.SslMode != actual.SslMode { return false } - // Ignore ForceSendFields. Assume it is set correctly in desired. - // Ignore NullFields. Assume it is set correctly in desired. - return true } @@ -914,67 +886,75 @@ func AclEntryListsMatch(desired []*api.AclEntry, actual []*api.AclEntry) bool { if len(desired) != len(actual) { return false } - for i := 0; i < len(desired); i++ { if !AclEntriesMatch(desired[i], actual[i]) { return false } } - return true } func AclEntriesMatch(desired *api.AclEntry, actual *api.AclEntry) bool { - if !PointersMatch(desired, actual) { - return false - } - if desired == nil && actual == nil { return true } - + if !PointersMatch(desired, actual) { + return false + } if desired.ExpirationTime != actual.ExpirationTime { return false } - // Ignore Kind. It is sometimes not set in API responses. - if desired.Name != actual.Name { return false } - if desired.Value != actual.Value { return false } - // Ignore ForceSendFields. Assume it is set correctly in desired. - // Ignore NullFields. Assume it is set correctly in desired. - return true } func PscConfigsMatch(desired *api.PscConfig, actual *api.PscConfig) bool { + if desired == nil && actual == nil { + return true + } if !PointersMatch(desired, actual) { return false } + if !reflect.DeepEqual(desired.AllowedConsumerProjects, actual.AllowedConsumerProjects) { + return false + } + if desired.PscEnabled != actual.PscEnabled { + return false + } + // Ignore ForceSendFields. Assume it is set correctly in desired. + // Ignore NullFields. Assume it is set correctly in desired. + return true +} +func LocationPreferencesMatch(desired *api.LocationPreference, actual *api.LocationPreference) bool { if desired == nil && actual == nil { return true } - - if !reflect.DeepEqual(desired.AllowedConsumerProjects, actual.AllowedConsumerProjects) { + if !PointersMatch(desired, actual) { return false } - - if desired.PscEnabled != actual.PscEnabled { + if desired.FollowGaeApplication != actual.FollowGaeApplication { + return false + } + if desired.Kind != actual.Kind { + return false + } + if desired.SecondaryZone != actual.SecondaryZone { + return false + } + if desired.Zone != actual.Zone { return false } - // Ignore ForceSendFields. Assume it is set correctly in desired. - // Ignore NullFields. Assume it is set correctly in desired. - return true } diff --git a/pkg/test/resourcefixture/contexts/sql_context.go b/pkg/test/resourcefixture/contexts/sql_context.go index 042f9f72fb..5b5d06fd45 100644 --- a/pkg/test/resourcefixture/contexts/sql_context.go +++ b/pkg/test/resourcefixture/contexts/sql_context.go @@ -38,6 +38,13 @@ func init() { ResourceKind: "SQLInstance", } + resourceContextMap["sqlinstance-locationpreference"] = ResourceContext{ + // SQL instances appear to need a bit of additional time before attempting to recreate + // with the exact same name. Otherwise, the GCP API returns "unknown error". + RecreateDelay: time.Second * 60, + ResourceKind: "SQLInstance", + } + resourceContextMap["sqlinstance-mysql"] = ResourceContext{ // SQL instances appear to need a bit of additional time before attempting to recreate // with the exact same name. Otherwise, the GCP API returns "unknown error". diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-authorizednetworks/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-authorizednetworks/_http.log index 2727f4e732..ffabbec094 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-authorizednetworks/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-authorizednetworks/_http.log @@ -52,6 +52,7 @@ User-Agent: kcc/controller-manager ] }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -407,6 +408,7 @@ User-Agent: kcc/controller-manager ] }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-clone-minimal/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-clone-minimal/_http.log index 51bb26f692..e741ba719a 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-clone-minimal/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-clone-minimal/_http.log @@ -46,6 +46,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-encryptionkey/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-encryptionkey/_http.log index 5c4be0aeb0..5a9ac8326e 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-encryptionkey/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-encryptionkey/_http.log @@ -1030,6 +1030,7 @@ User-Agent: kcc/controller-manager "requireSsl": true }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-b" }, "maintenanceWindow": { @@ -1206,7 +1207,7 @@ X-Xss-Protection: 0 "kind": "sql#settings", "locationPreference": { "kind": "sql#locationPreference", - "zone": "us-central1-a" + "zone": "us-central1-b" }, "maintenanceWindow": { "day": 6, @@ -1370,7 +1371,7 @@ X-Xss-Protection: 0 "kind": "sql#settings", "locationPreference": { "kind": "sql#locationPreference", - "zone": "us-central1-a" + "zone": "us-central1-b" }, "maintenanceWindow": { "day": 6, @@ -1453,6 +1454,7 @@ User-Agent: kcc/controller-manager "requireSsl": true }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-b" }, "maintenanceWindow": { @@ -1631,7 +1633,7 @@ X-Xss-Protection: 0 "kind": "sql#settings", "locationPreference": { "kind": "sql#locationPreference", - "zone": "us-central1-a" + "zone": "us-central1-b" }, "maintenanceWindow": { "day": 6, diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_generated_object_sqlinstance-locationpreference.golden.yaml b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_generated_object_sqlinstance-locationpreference.golden.yaml new file mode 100644 index 0000000000..24fbd2c0a6 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_generated_object_sqlinstance-locationpreference.golden.yaml @@ -0,0 +1,46 @@ +apiVersion: sql.cnrm.cloud.google.com/v1beta1 +kind: SQLInstance +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: sqlinstance-locationpreference-${uniqueId} + namespace: ${uniqueId} +spec: + databaseVersion: POSTGRES_16 + region: us-central1 + settings: + locationPreference: + secondaryZone: us-central1-f + zone: us-central1-c + tier: db-custom-1-3840 +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + connectionName: ${projectId}:us-central1:sqlinstance-locationpreference-${uniqueId} + firstIpAddress: 10.1.2.3 + instanceType: CLOUD_SQL_INSTANCE + ipAddress: 10.1.2.3 + observedGeneration: 2 + publicIpAddress: 10.1.2.3 + selfLink: https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId} + serverCaCert: + cert: | + -----BEGIN CERTIFICATE----- + -----END CERTIFICATE----- + commonName: common-name + createTime: "1970-01-01T00:00:00Z" + expirationTime: "1970-01-01T00:00:00Z" + sha1Fingerprint: "12345678" + serviceAccountEmailAddress: p${projectNumber}-abcdef@gcp-sa-cloud-sql.iam.gserviceaccount.com diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_http.log new file mode 100644 index 0000000000..9faaf339e9 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/_http.log @@ -0,0 +1,593 @@ +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "The Cloud SQL instance does not exist.", + "reason": "instanceDoesNotExist" + } + ], + "message": "The Cloud SQL instance does not exist." + } +} + +--- + +POST https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: kcc/controller-manager + +{ + "databaseVersion": "POSTGRES_16", + "name": "sqlinstance-locationpreference-${uniqueId}", + "region": "us-central1", + "settings": { + "activationPolicy": "ALWAYS", + "availabilityType": "ZONAL", + "dataDiskType": "PD_SSD", + "edition": "ENTERPRISE", + "locationPreference": { + "kind": "sql#locationPreference", + "secondaryZone": "us-central1-b", + "zone": "us-central1-a" + }, + "pricingPlan": "PER_USE", + "storageAutoResize": true, + "tier": "db-custom-1-3840", + "userLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "CREATE", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "PENDING", + "targetId": "sqlinstance-locationpreference-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "endTime": "2024-04-01T12:34:56.123456Z", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "CREATE", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "DONE", + "targetId": "sqlinstance-locationpreference-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "backendType": "SECOND_GEN", + "connectionName": "${projectId}:us-central1:sqlinstance-locationpreference-${uniqueId}", + "createTime": "2024-04-01T12:34:56.123456Z", + "databaseInstalledVersion": "POSTGRES_16_3", + "databaseVersion": "POSTGRES_16", + "etag": "abcdef0123A=", + "gceZone": "us-central1-a", + "geminiConfig": { + "activeQueryEnabled": false, + "entitled": false, + "googleVacuumMgmtEnabled": false, + "indexAdvisorEnabled": false, + "oomSessionCancelEnabled": false + }, + "instanceType": "CLOUD_SQL_INSTANCE", + "ipAddresses": [ + { + "ipAddress": "10.1.2.3", + "type": "PRIMARY" + }, + { + "ipAddress": "10.1.2.3", + "type": "OUTGOING" + } + ], + "kind": "sql#instance", + "maintenanceVersion": "POSTGRES_16_3.R20240527.01_10", + "name": "sqlinstance-locationpreference-${uniqueId}", + "project": "${projectId}", + "region": "us-central1", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "serverCaCert": { + "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n", + "certSerialNumber": "0", + "commonName": "common-name", + "createTime": "2024-04-01T12:34:56.123456Z", + "expirationTime": "2024-04-01T12:34:56.123456Z", + "instance": "sqlinstance-locationpreference-${uniqueId}", + "kind": "sql#sslCert", + "sha1Fingerprint": "12345678" + }, + "serviceAccountEmailAddress": "p${projectNumber}-abcdef@gcp-sa-cloud-sql.iam.gserviceaccount.com", + "settings": { + "activationPolicy": "ALWAYS", + "authorizedGaeApplications": [], + "availabilityType": "ZONAL", + "backupConfiguration": { + "backupRetentionSettings": { + "retainedBackups": 7, + "retentionUnit": "COUNT" + }, + "enabled": false, + "kind": "sql#backupConfiguration", + "startTime": "12:00", + "transactionLogRetentionDays": 7, + "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" + }, + "connectorEnforcement": "NOT_REQUIRED", + "dataDiskSizeGb": "10", + "dataDiskType": "PD_SSD", + "deletionProtectionEnabled": false, + "edition": "ENTERPRISE", + "ipConfiguration": { + "authorizedNetworks": [], + "ipv4Enabled": true, + "requireSsl": false, + "sslMode": "ALLOW_UNENCRYPTED_AND_ENCRYPTED" + }, + "kind": "sql#settings", + "locationPreference": { + "kind": "sql#locationPreference", + "secondaryZone": "us-central1-b", + "zone": "us-central1-a" + }, + "pricingPlan": "PER_USE", + "replicationType": "SYNCHRONOUS", + "settingsVersion": "123", + "storageAutoResize": true, + "storageAutoResizeLimit": "0", + "tier": "db-custom-1-3840", + "userLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } + }, + "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", + "state": "RUNNABLE" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}/users?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "items": [ + { + "etag": "abcdef0123A=", + "host": "", + "instance": "sqlinstance-locationpreference-${uniqueId}", + "kind": "sql#user", + "name": "postgres", + "project": "${projectId}" + } + ], + "kind": "sql#usersList" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "backendType": "SECOND_GEN", + "connectionName": "${projectId}:us-central1:sqlinstance-locationpreference-${uniqueId}", + "createTime": "2024-04-01T12:34:56.123456Z", + "databaseInstalledVersion": "POSTGRES_16_3", + "databaseVersion": "POSTGRES_16", + "etag": "abcdef0123A=", + "gceZone": "us-central1-a", + "geminiConfig": { + "activeQueryEnabled": false, + "entitled": false, + "googleVacuumMgmtEnabled": false, + "indexAdvisorEnabled": false, + "oomSessionCancelEnabled": false + }, + "instanceType": "CLOUD_SQL_INSTANCE", + "ipAddresses": [ + { + "ipAddress": "10.1.2.3", + "type": "PRIMARY" + }, + { + "ipAddress": "10.1.2.3", + "type": "OUTGOING" + } + ], + "kind": "sql#instance", + "maintenanceVersion": "POSTGRES_16_3.R20240527.01_10", + "name": "sqlinstance-locationpreference-${uniqueId}", + "project": "${projectId}", + "region": "us-central1", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "serverCaCert": { + "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n", + "certSerialNumber": "0", + "commonName": "common-name", + "createTime": "2024-04-01T12:34:56.123456Z", + "expirationTime": "2024-04-01T12:34:56.123456Z", + "instance": "sqlinstance-locationpreference-${uniqueId}", + "kind": "sql#sslCert", + "sha1Fingerprint": "12345678" + }, + "serviceAccountEmailAddress": "p${projectNumber}-abcdef@gcp-sa-cloud-sql.iam.gserviceaccount.com", + "settings": { + "activationPolicy": "ALWAYS", + "authorizedGaeApplications": [], + "availabilityType": "ZONAL", + "backupConfiguration": { + "backupRetentionSettings": { + "retainedBackups": 7, + "retentionUnit": "COUNT" + }, + "enabled": false, + "kind": "sql#backupConfiguration", + "startTime": "12:00", + "transactionLogRetentionDays": 7, + "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" + }, + "connectorEnforcement": "NOT_REQUIRED", + "dataDiskSizeGb": "10", + "dataDiskType": "PD_SSD", + "deletionProtectionEnabled": false, + "edition": "ENTERPRISE", + "ipConfiguration": { + "authorizedNetworks": [], + "ipv4Enabled": true, + "requireSsl": false, + "sslMode": "ALLOW_UNENCRYPTED_AND_ENCRYPTED" + }, + "kind": "sql#settings", + "locationPreference": { + "kind": "sql#locationPreference", + "secondaryZone": "us-central1-b", + "zone": "us-central1-a" + }, + "pricingPlan": "PER_USE", + "replicationType": "SYNCHRONOUS", + "settingsVersion": "123", + "storageAutoResize": true, + "storageAutoResizeLimit": "0", + "tier": "db-custom-1-3840", + "userLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } + }, + "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", + "state": "RUNNABLE" +} + +--- + +PUT https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: kcc/controller-manager + +{ + "databaseVersion": "POSTGRES_16", + "instanceType": "CLOUD_SQL_INSTANCE", + "maintenanceVersion": "POSTGRES_16_3.R20240527.01_10", + "name": "sqlinstance-locationpreference-${uniqueId}", + "region": "us-central1", + "settings": { + "activationPolicy": "ALWAYS", + "availabilityType": "ZONAL", + "backupConfiguration": { + "backupRetentionSettings": { + "retainedBackups": 7, + "retentionUnit": "COUNT" + }, + "binaryLogEnabled": false, + "enabled": false, + "kind": "sql#backupConfiguration", + "pointInTimeRecoveryEnabled": false, + "startTime": "12:00", + "transactionLogRetentionDays": 7, + "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" + }, + "connectorEnforcement": "NOT_REQUIRED", + "dataDiskSizeGb": "10", + "dataDiskType": "PD_SSD", + "edition": "ENTERPRISE", + "locationPreference": { + "kind": "sql#locationPreference", + "secondaryZone": "us-central1-f", + "zone": "us-central1-c" + }, + "pricingPlan": "PER_USE", + "replicationType": "SYNCHRONOUS", + "settingsVersion": "123", + "storageAutoResize": true, + "tier": "db-custom-1-3840", + "userLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "UPDATE", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "PENDING", + "targetId": "sqlinstance-locationpreference-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "endTime": "2024-04-01T12:34:56.123456Z", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "UPDATE", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "DONE", + "targetId": "sqlinstance-locationpreference-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" +} + +--- + +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "backendType": "SECOND_GEN", + "connectionName": "${projectId}:us-central1:sqlinstance-locationpreference-${uniqueId}", + "createTime": "2024-04-01T12:34:56.123456Z", + "databaseInstalledVersion": "POSTGRES_16_3", + "databaseVersion": "POSTGRES_16", + "etag": "abcdef0123A=", + "gceZone": "us-central1-a", + "geminiConfig": { + "activeQueryEnabled": false, + "entitled": false, + "googleVacuumMgmtEnabled": false, + "indexAdvisorEnabled": false, + "oomSessionCancelEnabled": false + }, + "instanceType": "CLOUD_SQL_INSTANCE", + "ipAddresses": [ + { + "ipAddress": "10.1.2.3", + "type": "PRIMARY" + }, + { + "ipAddress": "10.1.2.3", + "type": "OUTGOING" + } + ], + "kind": "sql#instance", + "maintenanceVersion": "POSTGRES_16_3.R20240527.01_10", + "name": "sqlinstance-locationpreference-${uniqueId}", + "project": "${projectId}", + "region": "us-central1", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "serverCaCert": { + "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n", + "certSerialNumber": "0", + "commonName": "common-name", + "createTime": "2024-04-01T12:34:56.123456Z", + "expirationTime": "2024-04-01T12:34:56.123456Z", + "instance": "sqlinstance-locationpreference-${uniqueId}", + "kind": "sql#sslCert", + "sha1Fingerprint": "12345678" + }, + "serviceAccountEmailAddress": "p${projectNumber}-abcdef@gcp-sa-cloud-sql.iam.gserviceaccount.com", + "settings": { + "activationPolicy": "ALWAYS", + "authorizedGaeApplications": [], + "availabilityType": "ZONAL", + "backupConfiguration": { + "backupRetentionSettings": { + "retainedBackups": 7, + "retentionUnit": "COUNT" + }, + "enabled": false, + "kind": "sql#backupConfiguration", + "pointInTimeRecoveryEnabled": false, + "replicationLogArchivingEnabled": false, + "startTime": "12:00", + "transactionLogRetentionDays": 7, + "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" + }, + "connectorEnforcement": "NOT_REQUIRED", + "dataDiskSizeGb": "10", + "dataDiskType": "PD_SSD", + "deletionProtectionEnabled": false, + "edition": "ENTERPRISE", + "ipConfiguration": { + "authorizedNetworks": [], + "ipv4Enabled": true, + "requireSsl": false, + "sslMode": "ALLOW_UNENCRYPTED_AND_ENCRYPTED" + }, + "kind": "sql#settings", + "locationPreference": { + "kind": "sql#locationPreference", + "secondaryZone": "us-central1-f", + "zone": "us-central1-c" + }, + "pricingPlan": "PER_USE", + "replicationType": "SYNCHRONOUS", + "settingsVersion": "123", + "storageAutoResize": true, + "storageAutoResizeLimit": "0", + "tier": "db-custom-1-3840", + "userLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } + }, + "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", + "state": "RUNNABLE" +} + +--- + +DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}?alt=json&prettyPrint=false +User-Agent: kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "DELETE", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "PENDING", + "targetId": "sqlinstance-locationpreference-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-locationpreference-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" +} \ No newline at end of file diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/create.yaml b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/create.yaml new file mode 100644 index 0000000000..a06b891e13 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/create.yaml @@ -0,0 +1,28 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: sql.cnrm.cloud.google.com/v1beta1 +kind: SQLInstance +metadata: + name: sqlinstance-locationpreference-${uniqueId} + annotations: + cnrm.cloud.google.com/state-into-spec: absent +spec: + databaseVersion: POSTGRES_16 + region: us-central1 + settings: + locationPreference: + zone: us-central1-a + secondaryZone: us-central1-b + tier: db-custom-1-3840 diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/update.yaml b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/update.yaml new file mode 100644 index 0000000000..f844bcb7fb --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-locationpreference/update.yaml @@ -0,0 +1,28 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: sql.cnrm.cloud.google.com/v1beta1 +kind: SQLInstance +metadata: + name: sqlinstance-locationpreference-${uniqueId} + annotations: + cnrm.cloud.google.com/state-into-spec: absent +spec: + databaseVersion: POSTGRES_16 + region: us-central1 + settings: + locationPreference: + zone: us-central1-c + secondaryZone: us-central1-f + tier: db-custom-1-3840 diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql-minimal/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql-minimal/_http.log index 19b38b0e41..36bdf3124d 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql-minimal/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql-minimal/_http.log @@ -42,6 +42,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -797,6 +798,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql/_http.log index 423ecf765f..82902a4fb7 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-mysql/_http.log @@ -573,10 +573,6 @@ User-Agent: kcc/controller-manager "dataDiskSizeGb": "20", "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", - "locationPreference": { - "kind": "sql#locationPreference", - "zone": "us-central1-a" - }, "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", "settingsVersion": "123", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres-minimal/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres-minimal/_http.log index d8221201ea..bdb8993ee6 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres-minimal/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres-minimal/_http.log @@ -42,6 +42,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -564,6 +565,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres/_http.log index 59340d6c87..df0d29be62 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-postgres/_http.log @@ -954,10 +954,6 @@ User-Agent: kcc/controller-manager "requireSsl": false, "sslMode": "ENCRYPTED_ONLY" }, - "locationPreference": { - "kind": "sql#locationPreference", - "zone": "us-central1-a" - }, "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", "settingsVersion": "123", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-privatenetwork/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-privatenetwork/_http.log index 90dbf493d7..67d86c3e11 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-privatenetwork/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-privatenetwork/_http.log @@ -1312,6 +1312,7 @@ User-Agent: kcc/controller-manager "privateNetwork": "projects/${projectId}/global/networks/computenetwork-${uniqueId}" }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -1655,6 +1656,7 @@ User-Agent: kcc/controller-manager "privateNetwork": "projects/${projectId}/global/networks/computenetwork2-${uniqueId}" }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver-minimal/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver-minimal/_http.log index 12bba441e7..f7296e9628 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver-minimal/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver-minimal/_http.log @@ -43,6 +43,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -637,6 +638,7 @@ User-Agent: kcc/controller-manager "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver/_http.log index 6922aa843f..33e57cde45 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-sqlserver/_http.log @@ -539,10 +539,6 @@ User-Agent: kcc/controller-manager "dataDiskSizeGb": "20", "dataDiskType": "PD_SSD", "edition": "ENTERPRISE", - "locationPreference": { - "kind": "sql#locationPreference", - "zone": "us-central1-a" - }, "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", "settingsVersion": "123", diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-ssl/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-ssl/_http.log index c7ba89bb9c..347a86ff87 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-ssl/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-ssl/_http.log @@ -45,6 +45,7 @@ User-Agent: kcc/controller-manager "requireSsl": true }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE", @@ -388,6 +389,7 @@ User-Agent: kcc/controller-manager "sslMode": "ENCRYPTED_ONLY" }, "locationPreference": { + "kind": "sql#locationPreference", "zone": "us-central1-a" }, "pricingPlan": "PER_USE",