Skip to content

Commit e9b62b2

Browse files
committed
Scaffolding for the lbpool controller
$ go run ./cmd/scaffold-controller -interactive=false \ -kind=LBPool \ -gophercloud-client=NewLoadBalancerV2 \ -gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/pools \ -gophercloud-type=Pool \ -openstack-json-object=pool \ -available-polling-period=15 \ -deleting-polling-period=15 \ -optional-create-dependency=LoadBalancer \ -optional-create-dependency=Listener \ -optional-create-dependency=Project \ -import-dependency=LoadBalancer \ -import-dependency=Listener \ -import-dependency=Project
1 parent ac6d54d commit e9b62b2

65 files changed

Lines changed: 2439 additions & 0 deletions

Some content is hidden

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

api/v1alpha1/lbpool_types.go

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
Copyright 2025 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+
// LBPoolResourceSpec contains the desired state of the resource.
20+
type LBPoolResourceSpec 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+
// loadBalancerRef is a reference to the ORC LoadBalancer which this resource is associated with.
33+
// +optional
34+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="loadBalancerRef is immutable"
35+
LoadBalancerRef *KubernetesNameRef `json:"loadBalancerRef,omitempty"`
36+
37+
// listenerRef is a reference to the ORC Listener which this resource is associated with.
38+
// +optional
39+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="listenerRef is immutable"
40+
ListenerRef *KubernetesNameRef `json:"listenerRef,omitempty"`
41+
42+
// projectRef is a reference to the ORC Project which this resource is associated with.
43+
// +optional
44+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
45+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
46+
47+
// TODO(scaffolding): Add more types.
48+
// To see what is supported, you can take inspiration from the CreateOpts structure from
49+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/pools
50+
//
51+
// Until you have implemented mutability for the field, you must add a CEL validation
52+
// preventing the field being modified:
53+
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
54+
}
55+
56+
// LBPoolFilter defines an existing resource by its properties
57+
// +kubebuilder:validation:MinProperties:=1
58+
type LBPoolFilter struct {
59+
// name of the existing resource
60+
// +optional
61+
Name *OpenStackName `json:"name,omitempty"`
62+
63+
// description of the existing resource
64+
// +kubebuilder:validation:MinLength:=1
65+
// +kubebuilder:validation:MaxLength:=255
66+
// +optional
67+
Description *string `json:"description,omitempty"`
68+
69+
// loadBalancerRef is a reference to the ORC LoadBalancer which this resource is associated with.
70+
// +optional
71+
LoadBalancerRef *KubernetesNameRef `json:"loadBalancerRef,omitempty"`
72+
73+
// listenerRef is a reference to the ORC Listener which this resource is associated with.
74+
// +optional
75+
ListenerRef *KubernetesNameRef `json:"listenerRef,omitempty"`
76+
77+
// projectRef is a reference to the ORC Project which this resource is associated with.
78+
// +optional
79+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
80+
81+
// TODO(scaffolding): Add more types.
82+
// To see what is supported, you can take inspiration from the ListOpts structure from
83+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/pools
84+
}
85+
86+
// LBPoolResourceStatus represents the observed state of the resource.
87+
type LBPoolResourceStatus struct {
88+
// name is a Human-readable name for the resource. Might not be unique.
89+
// +kubebuilder:validation:MaxLength=1024
90+
// +optional
91+
Name string `json:"name,omitempty"`
92+
93+
// description is a human-readable description for the resource.
94+
// +kubebuilder:validation:MaxLength=1024
95+
// +optional
96+
Description string `json:"description,omitempty"`
97+
98+
// loadBalancerID is the ID of the LoadBalancer to which the resource is associated.
99+
// +kubebuilder:validation:MaxLength=1024
100+
// +optional
101+
LoadBalancerID string `json:"loadBalancerID,omitempty"`
102+
103+
// listenerID is the ID of the Listener to which the resource is associated.
104+
// +kubebuilder:validation:MaxLength=1024
105+
// +optional
106+
ListenerID string `json:"listenerID,omitempty"`
107+
108+
// projectID is the ID of the Project to which the resource is associated.
109+
// +kubebuilder:validation:MaxLength=1024
110+
// +optional
111+
ProjectID string `json:"projectID,omitempty"`
112+
113+
// TODO(scaffolding): Add more types.
114+
// To see what is supported, you can take inspiration from the Pool structure from
115+
// github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/pools
116+
}

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/models-schema/zz_generated.openapi.go

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

config/rbac/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ rules:
2323
- groups
2424
- images
2525
- keypairs
26+
- lbpools
2627
- listeners
2728
- loadbalancers
2829
- networks
@@ -55,6 +56,7 @@ rules:
5556
- groups/status
5657
- images/status
5758
- keypairs/status
59+
- lbpools/status
5860
- listeners/status
5961
- loadbalancers/status
6062
- networks/status

0 commit comments

Comments
 (0)