diff --git a/apis/cloudbuild/v1beta1/conversion.go b/apis/cloudbuild/v1beta1/conversion.go index a8371dacab3..760233a2235 100644 --- a/apis/cloudbuild/v1beta1/conversion.go +++ b/apis/cloudbuild/v1beta1/conversion.go @@ -52,11 +52,11 @@ func Convert_NetworkConfig_API_v1_To_KRM(in *cloudbuildpb.PrivatePoolV1Config_Ne } switch in.EgressOption { - case 0: + case cloudbuildpb.PrivatePoolV1Config_NetworkConfig_EGRESS_OPTION_UNSPECIFIED: out.EgressOption = "EGRESS_OPTION_UNSPECIFIED" - case 1: + case cloudbuildpb.PrivatePoolV1Config_NetworkConfig_NO_PUBLIC_EGRESS: out.EgressOption = "NO_PUBLIC_EGRESS" - case 2: + case cloudbuildpb.PrivatePoolV1Config_NetworkConfig_PUBLIC_EGRESS: out.EgressOption = "PUBLIC_EGRESS" default: return fmt.Errorf("unknown egressoption %s", out.EgressOption) @@ -71,7 +71,7 @@ func Convert_WorkerConfig_API_v1_To_KRM(in *cloudbuildpb.PrivatePoolV1Config_Wor if in == nil { return nil } - out.DiskSizeGb = int(in.DiskSizeGb) + out.DiskSizeGb = in.DiskSizeGb out.MachineType = in.MachineType return nil } @@ -144,7 +144,7 @@ func Convert_PrivatePoolV1Config_WorkerConfig_KRM_To_API_v1(in *WorkerConfig, ou return nil } obj := in.DeepCopy() - out.DiskSizeGb = int64(obj.DiskSizeGb) + out.DiskSizeGb = obj.DiskSizeGb out.MachineType = obj.MachineType return nil } diff --git a/apis/cloudbuild/v1beta1/workerpool_types.go b/apis/cloudbuild/v1beta1/workerpool_types.go index 947f4152731..aa0e4e780ef 100644 --- a/apis/cloudbuild/v1beta1/workerpool_types.go +++ b/apis/cloudbuild/v1beta1/workerpool_types.go @@ -49,7 +49,7 @@ type WorkerConfig struct { // +optional MachineType string `json:"machineType,omitempty"` // +optional - DiskSizeGb int `json:"diskSizeGb,omitempty"` + DiskSizeGb int64 `json:"diskSizeGb,omitempty"` } type NetworkConfig struct { diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_cloudbuildworkerpools.cloudbuild.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_cloudbuildworkerpools.cloudbuild.cnrm.cloud.google.com.yaml index d9e0c38554c..9f7d17dddc1 100644 --- a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_cloudbuildworkerpools.cloudbuild.cnrm.cloud.google.com.yaml +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_cloudbuildworkerpools.cloudbuild.cnrm.cloud.google.com.yaml @@ -104,7 +104,8 @@ spec: - external properties: external: - description: The , when not managed by KCC. + description: The compute network selflink of form "projects//global/networks/", + when not managed by KCC. type: string name: description: The `name` field of a `ComputeNetwork` resource. @@ -120,6 +121,7 @@ spec: workerConfig: properties: diskSizeGb: + format: int64 type: integer machineType: type: string @@ -191,6 +193,7 @@ spec: workerConfig: properties: diskSizeGb: + format: int64 type: integer machineType: type: string diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index 5190ac8f5fc..6ee54c19792 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -652,10 +652,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured case schema.GroupKind{Group: "servicenetworking.cnrm.cloud.google.com", Kind: "ServiceNetworkingConnection"}: case schema.GroupKind{Group: "serviceusage.cnrm.cloud.google.com", Kind: "Service"}: - if os.Getenv("GOLDEN_REQUEST_CHECKS") != "" { - // no golden log for this resource yet - t.Skipf("gk %v/%v does not support golden request check; skipping", gvk.GroupKind(), name) - } + case schema.GroupKind{Group: "serviceusage.cnrm.cloud.google.com", Kind: "ServiceIdentity"}: case schema.GroupKind{Group: "sql.cnrm.cloud.google.com", Kind: "SQLInstance"}: diff --git a/mockgcp/mockcloudbuild/workerpool.go b/mockgcp/mockcloudbuild/workerpool.go index b44ab6ecd98..46bd0bc8505 100644 --- a/mockgcp/mockcloudbuild/workerpool.go +++ b/mockgcp/mockcloudbuild/workerpool.go @@ -70,11 +70,13 @@ func (s *CloudBuildV1) CreateWorkerPool(ctx context.Context, req *pb.CreateWorke } obj.State = pb.WorkerPool_RUNNING metadata := &pb.CreateWorkerPoolOperationMetadata{ - WorkerPool: fqn, - CreateTime: now, - CompleteTime: now, + WorkerPool: fqn, } - return s.operations.DoneLRO(ctx, name.String(), metadata, obj) + return s.operations.StartLRO(ctx, req.GetParent(), metadata, func() (proto.Message, error) { + metadata.CreateTime = now + metadata.CompleteTime = now + return obj, nil + }) } func (s *CloudBuildV1) UpdateWorkerPool(ctx context.Context, req *pb.UpdateWorkerPoolRequest) (*longrunningpb.Operation, error) { @@ -109,11 +111,13 @@ func (s *CloudBuildV1) UpdateWorkerPool(ctx context.Context, req *pb.UpdateWorke return nil, err } metadata := &pb.UpdateWorkerPoolOperationMetadata{ - WorkerPool: fqn, - CreateTime: now, - CompleteTime: now, + WorkerPool: fqn, } - return s.operations.DoneLRO(ctx, name.String(), metadata, obj) + + return s.operations.StartLRO(ctx, name.GetParent(), metadata, func() (proto.Message, error) { + metadata.CompleteTime = now + return obj, nil + }) } func (s *CloudBuildV1) DeleteWorkerPool(ctx context.Context, req *pb.DeleteWorkerPoolRequest) (*longrunningpb.Operation, error) { @@ -153,6 +157,10 @@ func (n *workerPoolName) String() string { return "projects/" + n.Project.ID + "/locations/" + n.Location + "/workerPools/" + n.WorkerPoolName } +func (n *workerPoolName) GetParent() string { + return "projects/" + n.Project.ID + "/locations/" + n.Location +} + func (s *MockService) parseWorkerPoolName(name string) (*workerPoolName, error) { tokens := strings.Split(name, "/")