Skip to content

Commit 2783f0e

Browse files
committed
keystone: endpoint controller implementation
Signed-off-by: Winicius Silva <winiciusab12@gmail.com>
1 parent e367bc0 commit 2783f0e

Some content is hidden

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

52 files changed

+1181
-250
lines changed

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ resources:
1616
kind: Domain
1717
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
1818
version: v1alpha1
19+
- api:
20+
crdVersion: v1
21+
namespaced: true
22+
domain: k-orc.cloud
23+
group: openstack
24+
kind: Endpoint
25+
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
26+
version: v1alpha1
1927
- api:
2028
crdVersion: v1
2129
namespaced: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ kubectl delete -f $ORC_RELEASE
6868
| **controller** | **1.x** | **2.x** | **main** |
6969
|:---------------------------:|:-------:|:-------:|:--------:|
7070
| domain | |||
71+
| endpoint | |||
7172
| flavor | |||
7273
| floating ip | |||
7374
| group | |||
@@ -87,7 +88,6 @@ kubectl delete -f $ORC_RELEASE
8788
| volume type | |||
8889

8990

90-
9191
✔: mostly implemented
9292

9393
◐: partially implemented

api/v1alpha1/endpoint_types.go

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,43 @@ type EndpointResourceSpec struct {
2323
// +optional
2424
Name *OpenStackName `json:"name,omitempty"`
2525

26-
// description is a human-readable description for the resource.
27-
// +kubebuilder:validation:MinLength:=1
28-
// +kubebuilder:validation:MaxLength:=255
26+
// enabled indicates whether the endpoint is enabled or not.
27+
// +kubebuilder:default:=true
2928
// +optional
30-
Description *string `json:"description,omitempty"`
29+
Enabled *bool `json:"enabled,omitempty"`
30+
31+
// interface indicates the visibility of the endpoint.
32+
// +kubebuilder:validation:Enum:=admin;internal;public
33+
// +required
34+
Interface string `json:"interface,omitempty"`
35+
36+
// url is the endpoint URL.
37+
// +kubebuilder:validation:MaxLength=1024
38+
// +required
39+
URL string `json:"url"`
3140

3241
// serviceRef is a reference to the ORC Service which this resource is associated with.
3342
// +required
3443
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serviceRef is immutable"
3544
ServiceRef KubernetesNameRef `json:"serviceRef,omitempty"`
36-
37-
// TODO(scaffolding): Add more types.
38-
// To see what is supported, you can take inspiration from the CreateOpts structure from
39-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/endpoints
40-
//
41-
// Until you have implemented mutability for the field, you must add a CEL validation
42-
// preventing the field being modified:
43-
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
4445
}
4546

4647
// EndpointFilter defines an existing resource by its properties
4748
// +kubebuilder:validation:MinProperties:=1
4849
type EndpointFilter struct {
49-
// name of the existing resource
50-
// +optional
51-
Name *OpenStackName `json:"name,omitempty"`
52-
53-
// description of the existing resource
54-
// +kubebuilder:validation:MinLength:=1
55-
// +kubebuilder:validation:MaxLength:=255
50+
// interface of the existing endpoint.
51+
// +kubebuilder:validation:Enum:=admin;internal;public
5652
// +optional
57-
Description *string `json:"description,omitempty"`
53+
Interface string `json:"interface,omitempty"`
5854

5955
// serviceRef is a reference to the ORC Service which this resource is associated with.
6056
// +optional
6157
ServiceRef *KubernetesNameRef `json:"serviceRef,omitempty"`
6258

63-
// TODO(scaffolding): Add more types.
64-
// To see what is supported, you can take inspiration from the ListOpts structure from
65-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/endpoints
59+
// url is the URL of the existing endpoint.
60+
// +kubebuilder:validation:MaxLength=1024
61+
// +optional
62+
URL string `json:"url,omitempty"`
6663
}
6764

6865
// EndpointResourceStatus represents the observed state of the resource.
@@ -72,17 +69,22 @@ type EndpointResourceStatus struct {
7269
// +optional
7370
Name string `json:"name,omitempty"`
7471

75-
// description is a human-readable description for the resource.
72+
// enabled indicates whether the endpoint is enabled or not.
73+
// +optional
74+
Enabled *bool `json:"enabled,omitempty"`
75+
76+
// interface indicates the visibility of the endpoint.
77+
// +kubebuilder:validation:Enum:=admin;internal;public
78+
// +optional
79+
Interface string `json:"interface,omitempty"`
80+
81+
// url is the endpoint URL.
7682
// +kubebuilder:validation:MaxLength=1024
7783
// +optional
78-
Description string `json:"description,omitempty"`
84+
URL string `json:"url,omitempty"`
7985

8086
// serviceID is the ID of the Service to which the resource is associated.
8187
// +kubebuilder:validation:MaxLength=1024
8288
// +optional
8389
ServiceID string `json:"serviceID,omitempty"`
84-
85-
// TODO(scaffolding): Add more types.
86-
// To see what is supported, you can take inspiration from the Endpoint structure from
87-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/endpoints
8890
}

api/v1alpha1/zz_generated.deepcopy.go

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

cmd/manager/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"sigs.k8s.io/controller-runtime/pkg/log/zap"
2929

3030
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/domain"
31+
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/endpoint"
3132
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/flavor"
3233
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/floatingip"
3334
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/interfaces"
@@ -107,6 +108,7 @@ func main() {
107108
scopeFactory := scope.NewFactory(orcOpts.ScopeCacheMaxSize, caCerts)
108109

109110
controllers := []interfaces.Controller{
111+
endpoint.New(scopeFactory),
110112
image.New(scopeFactory),
111113
network.New(scopeFactory),
112114
subnet.New(scopeFactory),

0 commit comments

Comments
 (0)