Skip to content

Commit d80cf95

Browse files
committed
Initial Commit Used Scaffolding tool to create skeleton RoleAssignment Controller
Signed-off-by: Daniel Lawton <dlawton@redhat.com>
1 parent 3050d71 commit d80cf95

62 files changed

Lines changed: 2875 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.
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
Copyright 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+
// RoleAssignmentResourceSpec contains the desired state of the resource.
20+
type RoleAssignmentResourceSpec 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+
// roleRef is a reference to the ORC Role which this resource is associated with.
33+
// +required
34+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="roleRef is immutable"
35+
RoleRef KubernetesNameRef `json:"roleRef,omitempty"`
36+
37+
// userRef is a reference to the ORC User which this resource is associated with.
38+
// +optional
39+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="userRef is immutable"
40+
UserRef *KubernetesNameRef `json:"userRef,omitempty"`
41+
42+
// groupRef is a reference to the ORC Group which this resource is associated with.
43+
// +optional
44+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="groupRef is immutable"
45+
GroupRef *KubernetesNameRef `json:"groupRef,omitempty"`
46+
47+
// projectRef is a reference to the ORC Project which this resource is associated with.
48+
// +optional
49+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
50+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
51+
52+
// domainRef is a reference to the ORC Domain which this resource is associated with.
53+
// +optional
54+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="domainRef is immutable"
55+
DomainRef *KubernetesNameRef `json:"domainRef,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/identity/v3/roles
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+
// RoleAssignmentFilter defines an existing resource by its properties
67+
// +kubebuilder:validation:MinProperties:=1
68+
type RoleAssignmentFilter 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+
// roleRef is a reference to the ORC Role which this resource is associated with.
80+
// +optional
81+
RoleRef *KubernetesNameRef `json:"roleRef,omitempty"`
82+
83+
// userRef is a reference to the ORC User which this resource is associated with.
84+
// +optional
85+
UserRef *KubernetesNameRef `json:"userRef,omitempty"`
86+
87+
// groupRef is a reference to the ORC Group which this resource is associated with.
88+
// +optional
89+
GroupRef *KubernetesNameRef `json:"groupRef,omitempty"`
90+
91+
// projectRef is a reference to the ORC Project which this resource is associated with.
92+
// +optional
93+
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
94+
95+
// domainRef is a reference to the ORC Domain which this resource is associated with.
96+
// +optional
97+
DomainRef *KubernetesNameRef `json:"domainRef,omitempty"`
98+
99+
// TODO(scaffolding): Add more types.
100+
// To see what is supported, you can take inspiration from the ListOpts structure from
101+
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/roles
102+
}
103+
104+
// RoleAssignmentResourceStatus represents the observed state of the resource.
105+
type RoleAssignmentResourceStatus struct {
106+
// name is a Human-readable name for the resource. Might not be unique.
107+
// +kubebuilder:validation:MaxLength=1024
108+
// +optional
109+
Name string `json:"name,omitempty"`
110+
111+
// description is a human-readable description for the resource.
112+
// +kubebuilder:validation:MaxLength=1024
113+
// +optional
114+
Description string `json:"description,omitempty"`
115+
116+
// roleID is the ID of the Role to which the resource is associated.
117+
// +kubebuilder:validation:MaxLength=1024
118+
// +optional
119+
RoleID string `json:"roleID,omitempty"`
120+
121+
// userID is the ID of the User to which the resource is associated.
122+
// +kubebuilder:validation:MaxLength=1024
123+
// +optional
124+
UserID string `json:"userID,omitempty"`
125+
126+
// groupID is the ID of the Group to which the resource is associated.
127+
// +kubebuilder:validation:MaxLength=1024
128+
// +optional
129+
GroupID string `json:"groupID,omitempty"`
130+
131+
// projectID is the ID of the Project to which the resource is associated.
132+
// +kubebuilder:validation:MaxLength=1024
133+
// +optional
134+
ProjectID string `json:"projectID,omitempty"`
135+
136+
// domainID is the ID of the Domain to which the resource is associated.
137+
// +kubebuilder:validation:MaxLength=1024
138+
// +optional
139+
DomainID string `json:"domainID,omitempty"`
140+
141+
// TODO(scaffolding): Add more types.
142+
// To see what is supported, you can take inspiration from the RoleAssignment structure from
143+
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/roles
144+
}
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: RoleAssignment
4+
metadata:
5+
name: roleassignment-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 RoleAssignment
14+
# TODO(scaffolding): Add all fields the resource supports

0 commit comments

Comments
 (0)