Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#2393 from jasonvigil/cloudsql
Browse files Browse the repository at this point in the history
Add CloudSQL direct controller
  • Loading branch information
google-oss-prow[bot] authored Aug 8, 2024
2 parents 14f0742 + 91aac51 commit ceccc2c
Show file tree
Hide file tree
Showing 46 changed files with 5,451 additions and 945 deletions.
5 changes: 3 additions & 2 deletions apis/refs/v1beta1/computerefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"strings"

"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/k8s"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -27,7 +28,7 @@ import (
)

type ComputeNetworkRef struct {
/* The compute network selflink of form "projects/<project>/global/networks/<network>", when not managed by KCC. */
/* The compute network selflink of form "projects/<project>/global/networks/<network>", when not managed by Config Connector. */
External string `json:"external,omitempty"`
/* The `name` field of a `ComputeNetwork` resource. */
Name string `json:"name,omitempty"`
Expand Down Expand Up @@ -83,7 +84,7 @@ func ResolveComputeNetwork(ctx context.Context, reader client.Reader, src client
})
if err := reader.Get(ctx, key, computenetwork); err != nil {
if apierrors.IsNotFound(err) {
return nil, fmt.Errorf("referenced ComputeNetwork %v not found", key)
return nil, k8s.NewReferenceNotFoundError(computenetwork.GroupVersionKind(), key)
}
return nil, fmt.Errorf("error reading referenced ComputeNetwork %v: %w", key, err)
}
Expand Down
24 changes: 24 additions & 0 deletions apis/refs/v1beta1/sqlinstanceref.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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.

package v1beta1

type SQLInstanceRef struct {
/* The SQLInstance selfLink, when not managed by Config Connector. */
External string `json:"external,omitempty"`
/* The `name` field of a `SQLInstance` resource. */
Name string `json:"name,omitempty"`
/* The `namespace` field of a `SQLInstance` resource. */
Namespace string `json:"namespace,omitempty"`
}
24 changes: 24 additions & 0 deletions apis/refs/v1beta1/storagebucketref.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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.

package v1beta1

type StorageBucketRef struct {
/* The StorageBucket selfLink, when not managed by Config Connector. */
External string `json:"external,omitempty"`
/* The `name` field of a `StorageBucket` resource. */
Name string `json:"name,omitempty"`
/* The `namespace` field of a `StorageBucket` resource. */
Namespace string `json:"namespace,omitempty"`
}
21 changes: 21 additions & 0 deletions apis/sql/v1beta1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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.

// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package,register
// +groupName=sql.cnrm.cloud.google.com

// +kcc:proto=google.cloud.sql.v1

package v1beta1
22 changes: 22 additions & 0 deletions apis/sql/v1beta1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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.

package v1beta1

import "k8s.io/apimachinery/pkg/runtime/schema"

var (
// SchemeGroupVersion is the group version used to register these objects.
SchemeGroupVersion = schema.GroupVersion{Group: "sql.cnrm.cloud.google.com", Version: "v1beta1"}
)
Loading

0 comments on commit ceccc2c

Please sign in to comment.