Skip to content

Commit 4e2b80a

Browse files
committed
scaffolding for loadbalancer controller
$ go run ./cmd/scaffold-controller -interactive=false -kind=LoadBalancer -gophercloud-client=NewLoadBalancerV2 -gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/loadbalancers -optional-create-dependency Subnet -optional-create-dependency Network -optional-create-dependency Port -optional-create-dependency Flavor -optional-create-dependency Project
1 parent 33af83f commit 4e2b80a

File tree

65 files changed

+2827
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2827
-0
lines changed

api/v1alpha1/loadbalancer_types.go

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
Copyright 2026 The ORC 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 v1alpha1
18+
19+
// LoadBalancerResourceSpec contains the desired state of the resource.
20+
type LoadBalancerResourceSpec struct {
21+
// name will be the name of the created resource. If not specified, the
22+
// name of the ORC object will be used.
23+
// +optional
24+
Name *OpenStackName `json:"name,omitempty"`
25+
26+
// description is a human-readable description for the resource.
27+
// +kubebuilder:validation:MinLength:=1
28+
// +kubebuilder:validation:MaxLength:=255
29+
// +optional
30+
Description *string `json:"description,omitempty"`
31+
32+
// subnetRef is a reference to the ORC Subnet which this resource is associated with.
33+
// +optional
34+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="subnetRef is immutable"
35+
SubnetRef *KubernetesNameRef `json:"subnetRef,omitempty"`
36+
37+
// networkRef is a reference to the ORC Network which this resource is associated with.
38+
// +optional
39+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="networkRef is immutable"
40+
NetworkRef *KubernetesNameRef `json:"networkRef,omitempty"`
41+
42+
// portRef is a reference to the ORC Port which this resource is associated with.
43+
// +optional
44+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="portRef is immutable"
45+
PortRef *KubernetesNameRef `json:"portRef,omitempty"`
46+
47+
// flavorRef is a reference to the ORC Flavor which this resource is associated with.
48+
// +optional
49+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="flavorRef is immutable"
50+
FlavorRef *KubernetesNameRef `json:"flavorRef,omitempty"`
51+
52+
// projectRef is a reference to the ORC Project which this resource is associated with.
53+
// +optional
54+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
55+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
56+
57+
// TODO(scaffolding): Add more types.
58+
// To see what is supported, you can take inspiration from the CreateOpts structure from
59+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/loadbalancers
60+
//
61+
// Until you have implemented mutability for the field, you must add a CEL validation
62+
// preventing the field being modified:
63+
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
64+
}
65+
66+
// LoadBalancerFilter defines an existing resource by its properties
67+
// +kubebuilder:validation:MinProperties:=1
68+
type LoadBalancerFilter struct {
69+
// name of the existing resource
70+
// +optional
71+
Name *OpenStackName `json:"name,omitempty"`
72+
73+
// description of the existing resource
74+
// +kubebuilder:validation:MinLength:=1
75+
// +kubebuilder:validation:MaxLength:=255
76+
// +optional
77+
Description *string `json:"description,omitempty"`
78+
79+
// vipNetworkRef is a reference to the ORC VipNetwork which this resource is associated with.
80+
// +optional
81+
VipNetworkRef *KubernetesNameRef `json:"vipNetworkRef,omitempty"`
82+
83+
// projectRef is a reference to the ORC Project which this resource is associated with.
84+
// +optional
85+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
86+
87+
// vipSubnetRef is a reference to the ORC VipSubnet which this resource is associated with.
88+
// +optional
89+
VipSubnetRef *KubernetesNameRef `json:"vipSubnetRef,omitempty"`
90+
91+
// vipPortRef is a reference to the ORC VipPort which this resource is associated with.
92+
// +optional
93+
VipPortRef *KubernetesNameRef `json:"vipPortRef,omitempty"`
94+
95+
// TODO(scaffolding): Add more types.
96+
// To see what is supported, you can take inspiration from the ListOpts structure from
97+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/loadbalancers
98+
}
99+
100+
// LoadBalancerResourceStatus represents the observed state of the resource.
101+
type LoadBalancerResourceStatus struct {
102+
// name is a Human-readable name for the resource. Might not be unique.
103+
// +kubebuilder:validation:MaxLength=1024
104+
// +optional
105+
Name string `json:"name,omitempty"`
106+
107+
// description is a human-readable description for the resource.
108+
// +kubebuilder:validation:MaxLength=1024
109+
// +optional
110+
Description string `json:"description,omitempty"`
111+
112+
// subnetID is the ID of the Subnet to which the resource is associated.
113+
// +kubebuilder:validation:MaxLength=1024
114+
// +optional
115+
SubnetID string `json:"subnetID,omitempty"`
116+
117+
// networkID is the ID of the Network to which the resource is associated.
118+
// +kubebuilder:validation:MaxLength=1024
119+
// +optional
120+
NetworkID string `json:"networkID,omitempty"`
121+
122+
// portID is the ID of the Port to which the resource is associated.
123+
// +kubebuilder:validation:MaxLength=1024
124+
// +optional
125+
PortID string `json:"portID,omitempty"`
126+
127+
// flavorID is the ID of the Flavor to which the resource is associated.
128+
// +kubebuilder:validation:MaxLength=1024
129+
// +optional
130+
FlavorID string `json:"flavorID,omitempty"`
131+
132+
// projectID is the ID of the Project to which the resource is associated.
133+
// +kubebuilder:validation:MaxLength=1024
134+
// +optional
135+
ProjectID string `json:"projectID,omitempty"`
136+
137+
// TODO(scaffolding): Add more types.
138+
// To see what is supported, you can take inspiration from the LoadBalancer structure from
139+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/loadbalancers
140+
}

api/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)