Skip to content

Commit e671e3e

Browse files
committed
Scaffolding for the listener controller
$ go run ./cmd/scaffold-controller -interactive=false -kind=Listener -gophercloud-client=NewLoadBalancerV2 -gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/loadbalancer/v2/listeners -gophercloud-type=Listener -openstack-json-object=listener -available-polling-period=15 -deleting-polling-period=15 -required-create-dependency=LoadBalancer -optional-create-dependency=Pool -import-dependency=LoadBalancer
1 parent 4a22540 commit e671e3e

65 files changed

Lines changed: 2197 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/listener_types.go

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

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 75 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: 120 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+
- listeners
2627
- loadbalancers
2728
- networks
2829
- ports
@@ -54,6 +55,7 @@ rules:
5455
- groups/status
5556
- images/status
5657
- keypairs/status
58+
- listeners/status
5759
- loadbalancers/status
5860
- networks/status
5961
- ports/status
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: openstack.k-orc.cloud/v1alpha1
3+
kind: Listener
4+
metadata:
5+
name: listener-sample
6+
spec:
7+
cloudCredentialsRef:
8+
# TODO(scaffolding): Use openstack-admin if the resource needs admin credentials to be created
9+
cloudName: openstack
10+
secretName: openstack-clouds
11+
managementPolicy: managed
12+
resource:
13+
description: Sample Listener
14+
# TODO(scaffolding): Add all fields the resource supports

0 commit comments

Comments
 (0)