diff --git a/mockgcp/mockcompute/globalforwardingrulesv1.go b/mockgcp/mockcompute/globalforwardingrulesv1.go index 400e033f2d..92088440a6 100644 --- a/mockgcp/mockcompute/globalforwardingrulesv1.go +++ b/mockgcp/mockcompute/globalforwardingrulesv1.go @@ -122,6 +122,44 @@ func (s *GlobalForwardingRulesV1) Insert(ctx context.Context, req *pb.InsertGlob }) } +func (s *GlobalForwardingRulesV1) Patch(ctx context.Context, req *pb.PatchGlobalForwardingRuleRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/global" + "/forwardingRules/" + req.GetForwardingRule() + name, err := s.parseGlobalForwardingRuleName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.ForwardingRule{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if status.Code(err) == codes.NotFound { + return nil, status.Errorf(codes.NotFound, "The resource '%s' was not found", fqn) + } + return nil, err + } + + proto.Merge(obj, req.GetForwardingRuleResource()) + // checked GCP log, when AllowGlobalAccess is false, the field will be ignored + if *obj.AllowGlobalAccess == false { + obj.AllowGlobalAccess = nil + } + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, err + } + + op := &pb.Operation{ + TargetId: obj.Id, + TargetLink: obj.SelfLink, + OperationType: PtrTo("patch"), + User: PtrTo("user@example.com"), + } + return s.startGlobalLRO(ctx, name.Project.ID, op, func() (proto.Message, error) { + return obj, nil + }) +} + func (s *GlobalForwardingRulesV1) Delete(ctx context.Context, req *pb.DeleteGlobalForwardingRuleRequest) (*pb.Operation, error) { reqName := "projects/" + req.GetProject() + "/global" + "/forwardingRules/" + req.GetForwardingRule() name, err := s.parseGlobalForwardingRuleName(reqName) diff --git a/mockgcp/mockcompute/regionalforwardingrulev1.go b/mockgcp/mockcompute/regionalforwardingrulev1.go index 75e2f7b74d..219cbbff0d 100644 --- a/mockgcp/mockcompute/regionalforwardingrulev1.go +++ b/mockgcp/mockcompute/regionalforwardingrulev1.go @@ -123,6 +123,45 @@ func (s *RegionalForwardingRulesV1) Insert(ctx context.Context, req *pb.InsertFo }) } +func (s *RegionalForwardingRulesV1) Patch(ctx context.Context, req *pb.PatchForwardingRuleRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/forwardingRules/" + req.GetForwardingRule() + name, err := s.parseRegionalForwardingRuleName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.ForwardingRule{} + + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if status.Code(err) == codes.NotFound { + return nil, status.Errorf(codes.NotFound, "The resource '%s' was not found", fqn) + } + return nil, err + } + + proto.Merge(obj, req.GetForwardingRuleResource()) + // checked GCP log, when AllowGlobalAccess is false, the field will be ignored + if *obj.AllowGlobalAccess == false { + obj.AllowGlobalAccess = nil + } + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, err + } + + op := &pb.Operation{ + TargetId: obj.Id, + TargetLink: obj.SelfLink, + OperationType: PtrTo("patch"), + User: PtrTo("user@example.com"), + } + return s.startRegionalLRO(ctx, name.Project.ID, name.Region, op, func() (proto.Message, error) { + return obj, nil + }) +} + func (s *RegionalForwardingRulesV1) Delete(ctx context.Context, req *pb.DeleteForwardingRuleRequest) (*pb.Operation, error) { reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/forwardingRules/" + req.GetForwardingRule() name, err := s.parseRegionalForwardingRuleName(reqName) diff --git a/pkg/controller/direct/compute/forwardingrule_controller.go b/pkg/controller/direct/compute/forwardingrule_controller.go index 0e422d8c51..944f1eead6 100644 --- a/pkg/controller/direct/compute/forwardingrule_controller.go +++ b/pkg/controller/direct/compute/forwardingrule_controller.go @@ -379,11 +379,38 @@ func (a *forwardingRuleAdapter) Update(ctx context.Context, updateOp *directbase forwardingRule.Name = direct.LazyPtr(a.id.forwardingRule) forwardingRule.Labels = desired.Labels - // Patch only support update on networkTier field, which KCC does not support yet. - // Use setTarget and setLabels to update target and labels fields. var err error op := &gcp.Operation{} updated := &computepb.ForwardingRule{} + if !reflect.DeepEqual(forwardingRule.AllowGlobalAccess, a.actual.AllowGlobalAccess) { + // To match the request body in TF-controller log + // https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/compute/resource_compute_forwarding_rule.go#L1151 + reqBody := &computepb.ForwardingRule{AllowGlobalAccess: forwardingRule.AllowGlobalAccess} + if a.id.location == "global" { + // TF does not support allowGlobalAccess field for global forwarding rule + // Underlying API as well, error message: `Field allow-global-access is only supported for regional INTERNAL + // forwarding rules with backend service/target instance or regional INTERNAL_MANAGED forwarding rules.` + forwardingRule.AllowGlobalAccess = nil + } else { + patchReq := &computepb.PatchForwardingRuleRequest{ + ForwardingRule: a.id.forwardingRule, + ForwardingRuleResource: reqBody, + Project: a.id.project, + Region: a.id.location, + } + op, err = a.forwardingRulesClient.Patch(ctx, patchReq) + } + } + if err != nil { + return fmt.Errorf("updating ComputeForwardingRule %s: %w", a.fullyQualifiedName(), err) + } + err = op.Wait(ctx) + if err != nil { + return fmt.Errorf("waiting ComputeForwardingRule %s update failed: %w", a.fullyQualifiedName(), err) + } + log.V(2).Info("successfully updated ComputeForwardingRule", "name", a.fullyQualifiedName()) + + // Use setTarget and setLabels to update target and labels fields. if !reflect.DeepEqual(forwardingRule.Labels, a.actual.Labels) { op, err := a.setLabels(ctx, a.actual.LabelFingerprint, forwardingRule.Labels) if err != nil { diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_generated_object_regionalcomputeforwardingrulefull.golden.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_generated_object_regionalcomputeforwardingrulefull.golden.yaml index 944c69c590..ae16f67c04 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_generated_object_regionalcomputeforwardingrulefull.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_generated_object_regionalcomputeforwardingrulefull.golden.yaml @@ -7,15 +7,15 @@ metadata: finalizers: - cnrm.cloud.google.com/finalizer - cnrm.cloud.google.com/deletion-defender - generation: 1 + generation: 2 labels: cnrm-test: "true" - label-one: value-one + label-one: value-two name: computeregionalforwardingrule-${uniqueId} namespace: ${uniqueId} spec: allPorts: true - allowGlobalAccess: true + allowGlobalAccess: false backendServiceRef: name: computebackendservice-${uniqueId} description: A regional forwarding rule @@ -29,9 +29,6 @@ spec: networkRef: name: customnetwork networkTier: PREMIUM - serviceDirectoryRegistrations: - - namespace: sd-namespace - service: sd-service serviceLabel: label subnetworkRef: name: customsubnetwork @@ -45,5 +42,5 @@ status: creationTimestamp: "1970-01-01T00:00:00Z" externalRef: //compute.googleapis.com/projects/${projectId}/regions/us-central1/forwardingrules/computeregionalforwardingrule-${uniqueId} labelFingerprint: abcdef0123A= - observedGeneration: 1 + observedGeneration: 2 selfLink: https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_http.log b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_http.log index 63367e72c8..63606c3319 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/_http.log @@ -504,170 +504,6 @@ X-Xss-Protection: 0 --- -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace?alt=json -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/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, - "message": "Resource 'projects/${projectId}/locations/us-central1/namespaces/sd-namespace' was not found", - "status": "NOT_FOUND" - } -} - ---- - -POST https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces?alt=json&namespaceId=sd-namespace -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager - -{ - "labels": { - "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 - -{ - "labels": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace" -} - ---- - -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace?alt=json -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/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 - -{ - "labels": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace" -} - ---- - -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service?alt=json -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/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, - "message": "Resource 'projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service' was not found", - "status": "NOT_FOUND" - } -} - ---- - -POST https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services?alt=json&serviceId=sd-service -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager - -{ - "metadata": { - "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 - -{ - "metadata": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service" -} - ---- - -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service?alt=json -Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/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 - -{ - "metadata": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service" -} - ---- - GET https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID} Content-Type: application/json User-Agent: kcc/controller-manager @@ -723,12 +559,6 @@ x-goog-request-params: project=${projectId}®ion=us-central1 "name": "computeregionalforwardingrule-${uniqueId}", "network": "projects/${projectId}/global/networks/${networkID}", "networkTier": "PREMIUM", - "serviceDirectoryRegistrations": [ - { - "namespace": "sd-namespace", - "service": "sd-service" - } - ], "serviceLabel": "label", "subnetwork": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" } @@ -833,12 +663,6 @@ X-Xss-Protection: 0 "networkTier": "PREMIUM", "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", - "serviceDirectoryRegistrations": [ - { - "namespace": "sd-namespace", - "service": "sd-service" - } - ], "serviceLabel": "label", "serviceName": "label.computeregionalforwardingrule-${uniqueId}.il4.us-central1.lb.${projectId}.internal", "subnetwork": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" @@ -931,12 +755,6 @@ X-Xss-Protection: 0 "networkTier": "PREMIUM", "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", - "serviceDirectoryRegistrations": [ - { - "namespace": "sd-namespace", - "service": "sd-service" - } - ], "serviceLabel": "label", "serviceName": "label.computeregionalforwardingrule-${uniqueId}.il4.us-central1.lb.${projectId}.internal", "subnetwork": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" @@ -944,11 +762,15 @@ X-Xss-Protection: 0 --- -DELETE https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID} +PATCH https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID} Content-Type: application/json User-Agent: kcc/controller-manager x-goog-request-params: project=${projectId}®ion=us-central1&forwarding_rule=computeregionalforwardingrule-${uniqueId} +{ + "allowGlobalAccess": false +} + 200 OK Cache-Control: private Content-Type: application/json; charset=UTF-8 @@ -965,7 +787,7 @@ X-Xss-Protection: 0 "insertTime": "2024-04-01T12:34:56.123456Z", "kind": "compute#operation", "name": "${operationID}", - "operationType": "delete", + "operationType": "patch", "progress": 0, "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID}", @@ -1000,7 +822,7 @@ X-Xss-Protection: 0 "insertTime": "2024-04-01T12:34:56.123456Z", "kind": "compute#operation", "name": "${operationID}", - "operationType": "delete", + "operationType": "patch", "progress": 100, "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID}", @@ -1013,9 +835,19 @@ X-Xss-Protection: 0 --- -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service?alt=json +POST https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID}/setLabels Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager +User-Agent: kcc/controller-manager +x-goog-request-params: project=${projectId}®ion=us-central1&resource=computeregionalforwardingrule-${uniqueId} + +{ + "labelFingerprint": "abcdef0123A=", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + } +} 200 OK Cache-Control: private @@ -1029,18 +861,28 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { - "metadata": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service" + "endTime": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "setLabels", + "progress": 100, + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE", + "targetId": "${forwardingRulesId}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", + "user": "user@example.com" } --- -DELETE https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace/services/sd-service?alt=json +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID} Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager +User-Agent: kcc/controller-manager +x-goog-request-params: project=${projectId}®ion=us-central1&forwarding_rule=computeregionalforwardingrule-${uniqueId} 200 OK Cache-Control: private @@ -1053,13 +895,41 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -{} +{ + "IPAddress": "8.8.8.8", + "IPProtocol": "TCP", + "allPorts": true, + "backendService": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/backendServices/computebackendservice-${uniqueId}", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "A regional forwarding rule", + "fingerprint": "abcdef0123A=", + "id": "000000000000000000000", + "ipVersion": "IPV4", + "isMirroringCollector": true, + "kind": "compute#forwardingRule", + "labelFingerprint": "abcdef0123A=", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + }, + "loadBalancingScheme": "INTERNAL", + "name": "computeregionalforwardingrule-${uniqueId}", + "network": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}", + "networkTier": "PREMIUM", + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", + "serviceLabel": "label", + "serviceName": "label.computeregionalforwardingrule-${uniqueId}.il4.us-central1.lb.${projectId}.internal", + "subnetwork": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" +} --- -GET https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace?alt=json +DELETE https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/${forwardingRuleID} Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager +User-Agent: kcc/controller-manager +x-goog-request-params: project=${projectId}®ion=us-central1&forwarding_rule=computeregionalforwardingrule-${uniqueId} 200 OK Cache-Control: private @@ -1073,18 +943,27 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { - "labels": { - "cnrm-test": "true", - "managed-by-cnrm": "true" - }, - "name": "projects/${projectId}/locations/us-central1/namespaces/sd-namespace" + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "delete", + "progress": 0, + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${forwardingRulesId}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", + "user": "user@example.com" } --- -DELETE https://servicedirectory.googleapis.com/v1beta1/projects/${projectId}/locations/us-central1/namespaces/sd-namespace?alt=json +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID} Content-Type: application/json -User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager +User-Agent: kcc/controller-manager +x-goog-request-params: project=${projectId}®ion=us-central1&operation=${operationID} 200 OK Cache-Control: private @@ -1097,7 +976,22 @@ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 -{} +{ + "endTime": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "delete", + "progress": 100, + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE", + "targetId": "${forwardingRulesId}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}", + "user": "user@example.com" +} --- diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/create.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/create.yaml index e9d05324e0..16c5adffbc 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/create.yaml @@ -36,7 +36,8 @@ spec: name: computebackendservice-${uniqueId} ipAddress: ip: "10.128.8.8" - serviceDirectoryRegistrations: - - namespace: "sd-namespace" - service: "sd-service" +# Patch operation is not allowed on Forwarding Rule that integrates with Service Directory Registrations +# serviceDirectoryRegistrations: +# - namespace: "sd-namespace" +# service: "sd-service" serviceLabel: "label" diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/dependencies.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/dependencies.yaml index 032a65f1d2..f471ef8672 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/dependencies.yaml +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/dependencies.yaml @@ -49,18 +49,18 @@ metadata: name: computebackendservice-2-${uniqueId} spec: location: "us-central1" ---- -apiVersion: servicedirectory.cnrm.cloud.google.com/v1beta1 -kind: ServiceDirectoryNamespace -metadata: - name: sd-namespace -spec: - location: us-central1 ---- -apiVersion: servicedirectory.cnrm.cloud.google.com/v1beta1 -kind: ServiceDirectoryService -metadata: - name: sd-service -spec: - namespaceRef: - name: sd-namespace +#--- +#apiVersion: servicedirectory.cnrm.cloud.google.com/v1beta1 +#kind: ServiceDirectoryNamespace +#metadata: +# name: sd-namespace +#spec: +# location: us-central1 +#--- +#apiVersion: servicedirectory.cnrm.cloud.google.com/v1beta1 +#kind: ServiceDirectoryService +#metadata: +# name: sd-service +#spec: +# namespaceRef: +# name: sd-namespace diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/update.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/update.yaml index e9d05324e0..4a97b9e1f1 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeforwardingrule/regionalcomputeforwardingrulefull/update.yaml @@ -16,11 +16,11 @@ apiVersion: compute.cnrm.cloud.google.com/v1beta1 kind: ComputeForwardingRule metadata: labels: - label-one: "value-one" + label-one: "value-two" name: computeregionalforwardingrule-${uniqueId} spec: description: "A regional forwarding rule" - allowGlobalAccess: true + allowGlobalAccess: false loadBalancingScheme: INTERNAL isMirroringCollector: true allPorts: true @@ -36,7 +36,8 @@ spec: name: computebackendservice-${uniqueId} ipAddress: ip: "10.128.8.8" - serviceDirectoryRegistrations: - - namespace: "sd-namespace" - service: "sd-service" +# Patch operation is not allowed on Forwarding Rule that integrates with Service Directory Registrations +# serviceDirectoryRegistrations: +# - namespace: "sd-namespace" +# service: "sd-service" serviceLabel: "label"