Skip to content

Commit 5d80ab4

Browse files
committed
VolumeType: Scaffold controller
Scaffold the volumetype controller using the new controller generator: ❯ go run ./cmd/scaffold-controller -interactive=false \ -kind VolumeType \ -gophercloud-client NewBlockStorageV3 \ -gophercloud-module github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/volumetypes
1 parent b0cb9fc commit 5d80ab4

File tree

79 files changed

+3687
-8
lines changed

Some content is hidden

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

79 files changed

+3687
-8
lines changed

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,12 @@ resources:
104104
kind: Subnet
105105
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
106106
version: v1alpha1
107+
- api:
108+
crdVersion: v1
109+
namespaced: true
110+
domain: k-orc.cloud
111+
group: openstack
112+
kind: VolumeType
113+
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
114+
version: v1alpha1
107115
version: "3"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ kubectl delete -f $ORC_RELEASE
7979
| server | |||
8080
| server group | |||
8181
| subnet | |||
82+
| volume type | |||
8283

8384
✔: mostly implemented
8485

api/v1alpha1/volumetype_types.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
// VolumeTypeResourceSpec contains the desired state of the resource.
20+
type VolumeTypeResourceSpec 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+
// TODO(scaffolding): Add more types.
33+
// To see what is supported, you can take inspiration from the CreateOpts stucture from
34+
// github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/volumetypes
35+
//
36+
// Until you have implemented mutability for the field, you must add a CEL validation
37+
// preventing the field being modified:
38+
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
39+
}
40+
41+
// VolumeTypeFilter defines an existing resource by its properties
42+
// +kubebuilder:validation:MinProperties:=1
43+
type VolumeTypeFilter struct {
44+
// name of the existing resource
45+
// +optional
46+
Name *OpenStackName `json:"name,omitempty"`
47+
48+
// description of the existing resource
49+
// +kubebuilder:validation:MinLength:=1
50+
// +kubebuilder:validation:MaxLength:=255
51+
// +optional
52+
Description *string `json:"description,omitempty"`
53+
54+
// TODO(scaffolding): Add more types.
55+
// To see what is supported, you can take inspiration from the ListOpts stucture from
56+
// github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/volumetypes
57+
}
58+
59+
// VolumeTypeResourceStatus represents the observed state of the resource.
60+
type VolumeTypeResourceStatus struct {
61+
// name is a Human-readable name for the resource. Might not be unique.
62+
// +kubebuilder:validation:MaxLength=1024
63+
// +optional
64+
Name string `json:"name,omitempty"`
65+
66+
// description is a human-readable description for the resource.
67+
// +kubebuilder:validation:MaxLength=1024
68+
// +optional
69+
Description string `json:"description,omitempty"`
70+
71+
// TODO(scaffolding): Add more types.
72+
// To see what is supported, you can take inspiration from the VolumeType stucture from
73+
// github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/volumetypes
74+
}

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.

0 commit comments

Comments
 (0)