Skip to content

Commit cc8d454

Browse files
committed
feat: Add ServiceLoadBalancerStatus API client and informers
- Created CustomResourceDefinition for ServiceLoadBalancerStatus. - Implemented the ServiceLoadBalancerStatus client with CRUD operations. - Added fake client for testing purposes. - Generated informers and listers for ServiceLoadBalancerStatus resources. - Ensured all generated code adheres to the Kubernetes API conventions.
1 parent 5e82945 commit cc8d454

37 files changed

+2324
-22
lines changed

apis/fqdnnetworkpolicy/v1alpha1/zz_generated.openapi.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/gcpfirewall/v1/zz_generated.openapi.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/network/v1/zz_generated.openapi.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/nodetopology/v1/zz_generated.openapi.go

Lines changed: 100 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "serviceloadbalancerstatus",
5+
srcs = [
6+
"doc.go",
7+
"types.go",
8+
"zz_generated.deepcopy.go",
9+
"zz_generated.register.go",
10+
],
11+
importpath = "github.com/GoogleCloudPlatform/gke-networking-api/apis/serviceloadbalancerstatus/v1",
12+
visibility = ["//visibility:public"],
13+
deps = [
14+
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:meta",
15+
"//vendor/k8s.io/apimachinery/pkg/runtime",
16+
"//vendor/k8s.io/apimachinery/pkg/runtime/schema",
17+
],
18+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1 is the v1 version of the API.
18+
// +kubebuilder:object:generate=true
19+
// +groupName=networking.gke.io
20+
// +k8s:openapi-gen=true
21+
package v1
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// +genclient
24+
// +kubebuilder:object:root=true
25+
// +kubebuilder:subresource:status
26+
// +kubebuilder:resource:scope=Namespaced,shortName=slbs
27+
// +kubebuilder:storageversion
28+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
29+
30+
// ServiceLoadBalancerStatus holds the mapping between a GKE Service and the GCE resources it configures.
31+
type ServiceLoadBalancerStatus struct {
32+
metav1.TypeMeta `json:",inline"`
33+
metav1.ObjectMeta `json:"metadata,omitempty"`
34+
35+
// Spec defines the desired state of ServiceLoadBalancerStatus.
36+
// This field is currently unused.
37+
// +optional
38+
Spec ServiceLoadBalancerStatusSpec `json:"spec,omitempty"`
39+
40+
// Status defines the observed state of ServiceLoadBalancerStatus.
41+
// This field is populated by the controller with the list of GCE resources.
42+
// +optional
43+
Status ServiceLoadBalancerStatusStatus `json:"status,omitempty"`
44+
}
45+
46+
// ServiceLoadBalancerStatusSpec is the spec for a ServiceLoadBalancerStatus resource
47+
type ServiceLoadBalancerStatusSpec struct{}
48+
49+
// ServiceLoadBalancerStatusStatus defines the observed state of ServiceLoadBalancerStatus.
50+
type ServiceLoadBalancerStatusStatus struct {
51+
// GceResources is a list of URLs for GCE resources provisioned and managed
52+
// by the GKE controller for the referenced Service. This field is managed
53+
// exclusively by the controller.
54+
// +optional
55+
// +listType=set
56+
GceResources []string `json:"gceResources,omitempty"`
57+
}
58+
59+
// +kubebuilder:object:root=true
60+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
61+
// ServiceLoadBalancerStatusList contains a list of ServiceLoadBalancerStatus.
62+
type ServiceLoadBalancerStatusList struct {
63+
metav1.TypeMeta `json:",inline"`
64+
// +optional
65+
metav1.ListMeta `json:"metadata,omitempty"`
66+
67+
// Items is the list of ServiceLoadBalancerStatus.
68+
Items []ServiceLoadBalancerStatus `json:"items"`
69+
}

0 commit comments

Comments
 (0)