Skip to content

Commit

Permalink
feat: add direct controller for BigQueryDataset
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweim committed Oct 2, 2024
1 parent 4aa0a1d commit 4d3534e
Show file tree
Hide file tree
Showing 26 changed files with 7,147 additions and 247 deletions.
8 changes: 8 additions & 0 deletions apis/refs/v1beta1/projectref.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,13 @@ func ResolveProjectID(ctx context.Context, reader client.Reader, obj *unstructur
return projectID, nil
}

if selfLink, _, _ := unstructured.NestedString(obj.Object, "status", "selfLink"); selfLink != "" {
params := strings.Split(selfLink, "/")
if len(params) > 0 {
if projectID := params[1]; projectID != "" {
return projectID, nil
}
}
}
return "", fmt.Errorf("cannot find project id for %v %v/%v", obj.GetKind(), obj.GetNamespace(), obj.GetName())
}
2 changes: 2 additions & 0 deletions dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func (v *MapperGenerator) visitMessage(msg protoreflect.MessageDescriptor) {
switch protoGoPackage {
case "cloud.google.com/go/networkconnectivity/apiv1/networkconnectivitypb":
protoGoPackage = "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/networkconnectivity/v1"
case "cloud.google.com/go/bigquery/apiv2/bigquerypb":
protoGoPackage = "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/bigquery/v2"
}

for _, goType := range goTypes {
Expand Down
9 changes: 0 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apache/arrow/go/v15 v15.0.2 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand Down Expand Up @@ -130,13 +129,11 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gobuffalo/flect v0.2.3 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand Down Expand Up @@ -173,8 +170,6 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
Expand All @@ -198,7 +193,6 @@ require (
github.com/oklog/run v1.0.0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
Expand All @@ -213,7 +207,6 @@ require (
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
Expand All @@ -224,14 +217,12 @@ require (
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
27 changes: 0 additions & 27 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4d3534e

Please sign in to comment.