diff --git a/mockgcp/mocksql/operations_store.go b/mockgcp/mocksql/operations_store.go index 99599b85433..12f6ec4da3e 100644 --- a/mockgcp/mocksql/operations_store.go +++ b/mockgcp/mocksql/operations_store.go @@ -40,8 +40,13 @@ func (s *operations) startLRO(ctx context.Context, op *pb.Operation, obj proto.M switch obj := obj.(type) { case *pb.DatabaseInstance: - op.TargetId = obj.Name - op.TargetLink = fmt.Sprintf("https://sqladmin.googleapis.com/sql/v1beta4/projects/%s/instances/%s", op.TargetProject, op.TargetId) + if op.OperationType == pb.Operation_CREATE_REPLICA { + op.TargetId = obj.MasterInstanceName + op.TargetLink = fmt.Sprintf("https://sqladmin.googleapis.com/sql/v1beta4/projects/%s/instances/%s", op.TargetProject, op.TargetId) + } else { + op.TargetId = obj.Name + op.TargetLink = fmt.Sprintf("https://sqladmin.googleapis.com/sql/v1beta4/projects/%s/instances/%s", op.TargetProject, op.TargetId) + } case *pb.User: op.TargetId = obj.Instance op.TargetLink = fmt.Sprintf("https://sqladmin.googleapis.com/sql/v1beta4/projects/%s/instances/%s", obj.Project, obj.Instance) diff --git a/mockgcp/mocksql/sqlinstance.go b/mockgcp/mocksql/sqlinstance.go index a882e451032..9c640314345 100644 --- a/mockgcp/mocksql/sqlinstance.go +++ b/mockgcp/mocksql/sqlinstance.go @@ -23,6 +23,7 @@ import ( "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/fields" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/sql/v1beta4" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" @@ -249,6 +250,9 @@ func (s *sqlInstancesService) Insert(ctx context.Context, req *pb.SqlInstancesIn TargetProject: name.Project.ID, OperationType: pb.Operation_CREATE, } + if obj.InstanceType == pb.SqlInstanceType_READ_REPLICA_INSTANCE { + op.OperationType = pb.Operation_CREATE_REPLICA + } return s.operations.startLRO(ctx, op, obj, func() (proto.Message, error) { return obj, nil @@ -581,13 +585,19 @@ func populateDefaults(obj *pb.DatabaseInstance) { backupConfiguration := settings.BackupConfiguration if backupConfiguration == nil { backupConfiguration = &pb.BackupConfiguration{} - settings.BackupConfiguration = backupConfiguration } else { if isPostgres(obj) { setDefaultBool(&backupConfiguration.ReplicationLogArchivingEnabled, false) } + + if backupConfiguration.BinaryLogEnabled != nil && backupConfiguration.BinaryLogEnabled.Value { + if isPostgres(obj) || isMysql(obj) { + backupConfiguration.TransactionalLogStorageState = direct.PtrTo(pb.BackupConfiguration_CLOUD_STORAGE) + } + } } backupConfiguration.Kind = "sql#backupConfiguration" + settings.BackupConfiguration = backupConfiguration backupRetentionSettings := backupConfiguration.BackupRetentionSettings if backupRetentionSettings == nil { diff --git a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-replica/_http.log b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-replica/_http.log index 11e45fe5f43..32030fdcad3 100644 --- a/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-replica/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/sql/v1beta1/sqlinstance/sqlinstance-replica/_http.log @@ -105,7 +105,6 @@ X-Xss-Protection: 0 "name": "${operationID}", "operationType": "CREATE", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", - "startTime": "2024-04-01T12:34:56.123456Z", "status": "DONE", "targetId": "sqlinstance-master-${uniqueId}", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", @@ -138,7 +137,6 @@ X-Xss-Protection: 0 "etag": "abcdef0123A=", "gceZone": "us-central1-a", "geminiConfig": { - "activeQueryEnabled": false, "entitled": false, "flagRecommenderEnabled": false, "indexAdvisorEnabled": false @@ -151,11 +149,10 @@ X-Xss-Protection: 0 } ], "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", + "maintenanceVersion": "MYSQL_5_7_44.R20231105.01_03", "name": "sqlinstance-master-${uniqueId}", "project": "${projectId}", "region": "us-central1", - "satisfiesPzi": true, "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", "serverCaCert": { "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n", @@ -311,9 +308,6 @@ X-Xss-Protection: 0 "instance": "sqlinstance-master-${uniqueId}", "kind": "sql#user", "name": "root", - "passwordPolicy": { - "status": {} - }, "project": "${projectId}" } ], @@ -336,6 +330,35 @@ 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_USER", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "PENDING", + "targetId": "sqlinstance-master-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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", @@ -343,7 +366,6 @@ X-Xss-Protection: 0 "name": "${operationID}", "operationType": "DELETE_USER", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", - "startTime": "2024-04-01T12:34:56.123456Z", "status": "DONE", "targetId": "sqlinstance-master-${uniqueId}", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", @@ -462,7 +484,6 @@ X-Xss-Protection: 0 "name": "${operationID}", "operationType": "CREATE_REPLICA", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", - "startTime": "2024-04-01T12:34:56.123456Z", "status": "DONE", "targetId": "sqlinstance-master-${uniqueId}", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", @@ -495,7 +516,6 @@ X-Xss-Protection: 0 "etag": "abcdef0123A=", "gceZone": "us-central1-a", "geminiConfig": { - "activeQueryEnabled": false, "entitled": false, "flagRecommenderEnabled": false, "indexAdvisorEnabled": false @@ -508,8 +528,8 @@ X-Xss-Protection: 0 } ], "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "masterInstanceName": "${projectId}:sqlinstance-master-${uniqueId}", + "maintenanceVersion": "MYSQL_5_7_44.R20231105.01_03", + "masterInstanceName": "sqlinstance-master-${uniqueId}", "name": "sqlinstance-replica-${uniqueId}", "project": "${projectId}", "region": "us-central1", @@ -517,7 +537,6 @@ X-Xss-Protection: 0 "failoverTarget": true, "kind": "sql#replicaConfiguration" }, - "satisfiesPzi": false, "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}", "serverCaCert": { "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n", @@ -546,10 +565,8 @@ X-Xss-Protection: 0 "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" }, "connectorEnforcement": "NOT_REQUIRED", - "crashSafeReplicationEnabled": true, "dataDiskSizeGb": "10", "dataDiskType": "PD_SSD", - "databaseReplicationEnabled": true, "deletionProtectionEnabled": false, "edition": "ENTERPRISE", "ipConfiguration": { @@ -561,7 +578,7 @@ X-Xss-Protection: 0 "kind": "sql#settings", "locationPreference": { "kind": "sql#locationPreference", - "zone": "us-central1-b" + "zone": "us-central1-a" }, "pricingPlan": "PER_USE", "replicationType": "SYNCHRONOUS", @@ -575,7 +592,79 @@ X-Xss-Protection: 0 } }, "sqlNetworkArchitecture": "NEW_NETWORK_ARCHITECTURE", - "state": "RUNNABLE" + "state": "RUNNABLE", + "upgradableDatabaseVersions": [ + { + "displayName": "MySQL 8.0", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0" + }, + { + "displayName": "MySQL 8.0.18", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_18" + }, + { + "displayName": "MySQL 8.0.26", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_26" + }, + { + "displayName": "MySQL 8.0.27", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_27" + }, + { + "displayName": "MySQL 8.0.28", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_28" + }, + { + "displayName": "MySQL 8.0.29", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_29" + }, + { + "displayName": "MySQL 8.0.30", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_30" + }, + { + "displayName": "MySQL 8.0.31", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_31" + }, + { + "displayName": "MySQL 8.0.32", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_32" + }, + { + "displayName": "MySQL 8.0.33", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_33" + }, + { + "displayName": "MySQL 8.0.34", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_34" + }, + { + "displayName": "MySQL 8.0.35", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_35" + }, + { + "displayName": "MySQL 8.0.36", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_36" + }, + { + "displayName": "MySQL 8.0.37", + "majorVersion": "MYSQL_8_0", + "name": "MYSQL_8_0_37" + } + ] } --- @@ -595,12 +684,22 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { + "items": [ + { + "etag": "abcdef0123A=", + "host": "", + "instance": "sqlinstance-replica-${uniqueId}", + "kind": "sql#user", + "name": "root", + "project": "${projectId}" + } + ], "kind": "sql#usersList" } --- -GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}?alt=json&prettyPrint=false +DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}/users?alt=json&host=%25&name=root&prettyPrint=false User-Agent: kcc/controller-manager 200 OK @@ -615,100 +714,21 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { - "backendType": "SECOND_GEN", - "connectionName": "${projectId}:us-central1:sqlinstance-replica-${uniqueId}", - "createTime": "2024-04-01T12:34:56.123456Z", - "databaseInstalledVersion": "MYSQL_5_7_44", - "databaseVersion": "MYSQL_5_7", - "etag": "abcdef0123A=", - "gceZone": "us-central1-a", - "geminiConfig": { - "activeQueryEnabled": false, - "entitled": false, - "flagRecommenderEnabled": false, - "indexAdvisorEnabled": false - }, - "instanceType": "READ_REPLICA_INSTANCE", - "ipAddresses": [ - { - "ipAddress": "10.1.2.3", - "type": "PRIMARY" - } - ], - "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "masterInstanceName": "${projectId}:sqlinstance-master-${uniqueId}", - "name": "sqlinstance-replica-${uniqueId}", - "project": "${projectId}", - "region": "us-central1", - "replicaConfiguration": { - "failoverTarget": true, - "kind": "sql#replicaConfiguration" - }, - "satisfiesPzi": false, - "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${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-replica-${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", - "crashSafeReplicationEnabled": true, - "dataDiskSizeGb": "10", - "dataDiskType": "PD_SSD", - "databaseReplicationEnabled": true, - "deletionProtectionEnabled": false, - "edition": "ENTERPRISE", - "ipConfiguration": { - "authorizedNetworks": [], - "ipv4Enabled": true, - "requireSsl": false, - "sslMode": "ALLOW_UNENCRYPTED_AND_ENCRYPTED" - }, - "kind": "sql#settings", - "locationPreference": { - "kind": "sql#locationPreference", - "zone": "us-central1-b" - }, - "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" + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "sql#operation", + "name": "${operationID}", + "operationType": "DELETE_USER", + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", + "status": "PENDING", + "targetId": "sqlinstance-replica-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" } --- -DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}?alt=json&prettyPrint=false +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}?alt=json&prettyPrint=false User-Agent: kcc/controller-manager 200 OK @@ -723,12 +743,13 @@ 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": "DELETE", + "operationType": "DELETE_USER", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/operations/${operationID}", - "status": "PENDING", + "status": "DONE", "targetId": "sqlinstance-replica-${uniqueId}", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}", "targetProject": "${projectId}", @@ -737,7 +758,7 @@ X-Xss-Protection: 0 --- -GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}?alt=json&prettyPrint=false +GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}?alt=json&prettyPrint=false User-Agent: kcc/controller-manager 200 OK @@ -753,19 +774,18 @@ X-Xss-Protection: 0 { "backendType": "SECOND_GEN", - "connectionName": "${projectId}:us-central1:sqlinstance-master-${uniqueId}", + "connectionName": "${projectId}:us-central1:sqlinstance-replica-${uniqueId}", "createTime": "2024-04-01T12:34:56.123456Z", "databaseInstalledVersion": "MYSQL_5_7_44", "databaseVersion": "MYSQL_5_7", "etag": "abcdef0123A=", "gceZone": "us-central1-a", "geminiConfig": { - "activeQueryEnabled": false, "entitled": false, "flagRecommenderEnabled": false, "indexAdvisorEnabled": false }, - "instanceType": "CLOUD_SQL_INSTANCE", + "instanceType": "READ_REPLICA_INSTANCE", "ipAddresses": [ { "ipAddress": "10.1.2.3", @@ -773,19 +793,23 @@ X-Xss-Protection: 0 } ], "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "name": "sqlinstance-master-${uniqueId}", + "maintenanceVersion": "MYSQL_5_7_44.R20231105.01_03", + "masterInstanceName": "sqlinstance-master-${uniqueId}", + "name": "sqlinstance-replica-${uniqueId}", "project": "${projectId}", "region": "us-central1", - "satisfiesPzi": true, - "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", + "replicaConfiguration": { + "failoverTarget": true, + "kind": "sql#replicaConfiguration" + }, + "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${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-master-${uniqueId}", + "instance": "sqlinstance-replica-${uniqueId}", "kind": "sql#sslCert", "sha1Fingerprint": "12345678" }, @@ -799,12 +823,11 @@ X-Xss-Protection: 0 "retainedBackups": 7, "retentionUnit": "COUNT" }, - "binaryLogEnabled": true, - "enabled": true, + "enabled": false, "kind": "sql#backupConfiguration", "startTime": "12:00", "transactionLogRetentionDays": 7, - "transactionalLogStorageState": "CLOUD_STORAGE" + "transactionalLogStorageState": "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED" }, "connectorEnforcement": "NOT_REQUIRED", "dataDiskSizeGb": "10", @@ -911,10 +934,10 @@ X-Xss-Protection: 0 --- -DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}?alt=json&prettyPrint=false +DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}?alt=json&prettyPrint=false User-Agent: kcc/controller-manager -409 Conflict +200 OK Cache-Control: private Content-Type: application/json; charset=UTF-8 Server: ESF @@ -926,629 +949,16 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { - "error": { - "code": 409, - "errors": [ - { - "domain": "global", - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete.", - "reason": "operationInProgress" - } - ], - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete." - } -} - ---- - -GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${uniqueId}", - "createTime": "2024-04-01T12:34:56.123456Z", - "databaseInstalledVersion": "MYSQL_5_7_44", - "databaseVersion": "MYSQL_5_7", - "etag": "abcdef0123A=", - "gceZone": "us-central1-a", - "geminiConfig": { - "activeQueryEnabled": false, - "entitled": false, - "flagRecommenderEnabled": false, - "indexAdvisorEnabled": false - }, - "instanceType": "CLOUD_SQL_INSTANCE", - "ipAddresses": [ - { - "ipAddress": "10.1.2.3", - "type": "PRIMARY" - } - ], - "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "name": "sqlinstance-master-${uniqueId}", - "project": "${projectId}", - "region": "us-central1", - "satisfiesPzi": true, - "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${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" - }, - "binaryLogEnabled": true, - "enabled": true, - "kind": "sql#backupConfiguration", - "startTime": "12:00", - "transactionLogRetentionDays": 7, - "transactionalLogStorageState": "CLOUD_STORAGE" - }, - "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", - "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", - "upgradableDatabaseVersions": [ - { - "displayName": "MySQL 8.0", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0" - }, - { - "displayName": "MySQL 8.0.18", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_18" - }, - { - "displayName": "MySQL 8.0.26", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_26" - }, - { - "displayName": "MySQL 8.0.27", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_27" - }, - { - "displayName": "MySQL 8.0.28", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_28" - }, - { - "displayName": "MySQL 8.0.29", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_29" - }, - { - "displayName": "MySQL 8.0.30", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_30" - }, - { - "displayName": "MySQL 8.0.31", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_31" - }, - { - "displayName": "MySQL 8.0.32", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_32" - }, - { - "displayName": "MySQL 8.0.33", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_33" - }, - { - "displayName": "MySQL 8.0.34", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_34" - }, - { - "displayName": "MySQL 8.0.35", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_35" - }, - { - "displayName": "MySQL 8.0.36", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_36" - }, - { - "displayName": "MySQL 8.0.37", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_37" - } - ] -} - ---- - -DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}?alt=json&prettyPrint=false -User-Agent: kcc/controller-manager - -409 Conflict -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": 409, - "errors": [ - { - "domain": "global", - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete.", - "reason": "operationInProgress" - } - ], - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete." - } -} - ---- - -GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${uniqueId}", - "createTime": "2024-04-01T12:34:56.123456Z", - "databaseInstalledVersion": "MYSQL_5_7_44", - "databaseVersion": "MYSQL_5_7", - "etag": "abcdef0123A=", - "gceZone": "us-central1-a", - "geminiConfig": { - "activeQueryEnabled": false, - "entitled": false, - "flagRecommenderEnabled": false, - "indexAdvisorEnabled": false - }, - "instanceType": "CLOUD_SQL_INSTANCE", - "ipAddresses": [ - { - "ipAddress": "10.1.2.3", - "type": "PRIMARY" - } - ], - "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "name": "sqlinstance-master-${uniqueId}", - "project": "${projectId}", - "region": "us-central1", - "satisfiesPzi": true, - "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${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" - }, - "binaryLogEnabled": true, - "enabled": true, - "kind": "sql#backupConfiguration", - "startTime": "12:00", - "transactionLogRetentionDays": 7, - "transactionalLogStorageState": "CLOUD_STORAGE" - }, - "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", - "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", - "upgradableDatabaseVersions": [ - { - "displayName": "MySQL 8.0", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0" - }, - { - "displayName": "MySQL 8.0.18", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_18" - }, - { - "displayName": "MySQL 8.0.26", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_26" - }, - { - "displayName": "MySQL 8.0.27", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_27" - }, - { - "displayName": "MySQL 8.0.28", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_28" - }, - { - "displayName": "MySQL 8.0.29", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_29" - }, - { - "displayName": "MySQL 8.0.30", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_30" - }, - { - "displayName": "MySQL 8.0.31", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_31" - }, - { - "displayName": "MySQL 8.0.32", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_32" - }, - { - "displayName": "MySQL 8.0.33", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_33" - }, - { - "displayName": "MySQL 8.0.34", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_34" - }, - { - "displayName": "MySQL 8.0.35", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_35" - }, - { - "displayName": "MySQL 8.0.36", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_36" - }, - { - "displayName": "MySQL 8.0.37", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_37" - } - ] -} - ---- - -DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}?alt=json&prettyPrint=false -User-Agent: kcc/controller-manager - -409 Conflict -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": 409, - "errors": [ - { - "domain": "global", - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete.", - "reason": "operationInProgress" - } - ], - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete." - } -} - ---- - -GET https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${uniqueId}", - "createTime": "2024-04-01T12:34:56.123456Z", - "databaseInstalledVersion": "MYSQL_5_7_44", - "databaseVersion": "MYSQL_5_7", - "etag": "abcdef0123A=", - "gceZone": "us-central1-a", - "geminiConfig": { - "activeQueryEnabled": false, - "entitled": false, - "flagRecommenderEnabled": false, - "indexAdvisorEnabled": false - }, - "instanceType": "CLOUD_SQL_INSTANCE", - "ipAddresses": [ - { - "ipAddress": "10.1.2.3", - "type": "PRIMARY" - } - ], - "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", - "name": "sqlinstance-master-${uniqueId}", - "project": "${projectId}", - "region": "us-central1", - "satisfiesPzi": true, - "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${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-master-${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" - }, - "binaryLogEnabled": true, - "enabled": true, - "kind": "sql#backupConfiguration", - "startTime": "12:00", - "transactionLogRetentionDays": 7, - "transactionalLogStorageState": "CLOUD_STORAGE" - }, - "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", - "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", - "upgradableDatabaseVersions": [ - { - "displayName": "MySQL 8.0", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0" - }, - { - "displayName": "MySQL 8.0.18", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_18" - }, - { - "displayName": "MySQL 8.0.26", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_26" - }, - { - "displayName": "MySQL 8.0.27", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_27" - }, - { - "displayName": "MySQL 8.0.28", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_28" - }, - { - "displayName": "MySQL 8.0.29", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_29" - }, - { - "displayName": "MySQL 8.0.30", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_30" - }, - { - "displayName": "MySQL 8.0.31", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_31" - }, - { - "displayName": "MySQL 8.0.32", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_32" - }, - { - "displayName": "MySQL 8.0.33", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_33" - }, - { - "displayName": "MySQL 8.0.34", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_34" - }, - { - "displayName": "MySQL 8.0.35", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_35" - }, - { - "displayName": "MySQL 8.0.36", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_36" - }, - { - "displayName": "MySQL 8.0.37", - "majorVersion": "MYSQL_8_0", - "name": "MYSQL_8_0_37" - } - ] -} - ---- - -DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}?alt=json&prettyPrint=false -User-Agent: kcc/controller-manager - -409 Conflict -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": 409, - "errors": [ - { - "domain": "global", - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete.", - "reason": "operationInProgress" - } - ], - "message": "Operation failed because another operation was already in progress. Try your request after the current operation is complete." - } + "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-replica-${uniqueId}", + "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-replica-${uniqueId}", + "targetProject": "${projectId}", + "user": "user@example.com" } --- @@ -1576,7 +986,6 @@ X-Xss-Protection: 0 "etag": "abcdef0123A=", "gceZone": "us-central1-a", "geminiConfig": { - "activeQueryEnabled": false, "entitled": false, "flagRecommenderEnabled": false, "indexAdvisorEnabled": false @@ -1589,11 +998,10 @@ X-Xss-Protection: 0 } ], "kind": "sql#instance", - "maintenanceVersion": "MYSQL_5_7_44.R20240527.01_12", + "maintenanceVersion": "MYSQL_5_7_44.R20231105.01_03", "name": "sqlinstance-master-${uniqueId}", "project": "${projectId}", "region": "us-central1", - "satisfiesPzi": true, "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/${projectId}/instances/sqlinstance-master-${uniqueId}", "serverCaCert": { "cert": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----\n",