Skip to content

Commit 65de72b

Browse files
committed
add resource status to clusterpermission status
Signed-off-by: Zhiwei Yin <zyin@redhat.com>
1 parent fdadfdb commit 65de72b

10 files changed

Lines changed: 2540 additions & 579 deletions

api/v1alpha1/clusterpermission_types.go

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
ConditionTypeValidation string = "Validation"
2727
ConditionTypeValidateRolesExist string = "ValidateRolesExist"
2828
ConditionTypeValidateClusterRolesExist string = "ValidateClusterRolesExist"
29+
ConditionTypeApplied = "Applied"
2930
)
3031

3132
// ClusterPermissionSpec defines the desired state of ClusterPermission
@@ -158,12 +159,87 @@ type ClusterPermissionStatus struct {
158159
// Conditions is the condition list.
159160
// +optional
160161
Conditions []metav1.Condition `json:"conditions,omitempty"`
162+
163+
// ResourceStatus contains the status of each RBAC resource
164+
// +optional
165+
ResourceStatus *ResourceStatus `json:"resourceStatus,omitempty"`
166+
}
167+
168+
// ResourceStatus contains the status of each RBAC resource type
169+
type ResourceStatus struct {
170+
// ClusterRoles contains the status of ClusterRoles
171+
// +optional
172+
ClusterRoles []ClusterRoleStatus `json:"clusterRoles,omitempty"`
173+
174+
// ClusterRoleBindings contains the status of ClusterRoleBindings
175+
// +optional
176+
ClusterRoleBindings []ClusterRoleBindingStatus `json:"clusterRoleBindings,omitempty"`
177+
178+
// Roles contains the status of Roles
179+
// +optional
180+
Roles []RoleStatus `json:"roles,omitempty"`
181+
182+
// RoleBindings contains the status of RoleBindings
183+
// +optional
184+
RoleBindings []RoleBindingStatus `json:"roleBindings,omitempty"`
185+
}
186+
187+
// ClusterRoleStatus contains the status of a ClusterRole
188+
type ClusterRoleStatus struct {
189+
// Name is the name of the ClusterRole
190+
// +required
191+
Name string `json:"name"`
192+
193+
// Conditions contain the condition list for this ClusterRole
194+
// +optional
195+
Conditions []metav1.Condition `json:"condition,omitempty"`
196+
}
197+
198+
// ClusterRoleBindingStatus contains the status of a ClusterRoleBinding
199+
type ClusterRoleBindingStatus struct {
200+
// Name is the name of the ClusterRoleBinding
201+
// +required
202+
Name string `json:"name"`
203+
204+
// Conditions contain the condition list for this ClusterRoleBinding
205+
// +optional
206+
Conditions []metav1.Condition `json:"condition,omitempty"`
207+
}
208+
209+
// RoleStatus contains the status of a Role
210+
type RoleStatus struct {
211+
// Name is the name of the Role
212+
// +required
213+
Name string `json:"name"`
214+
215+
// Namespace is the namespace of the Role
216+
// +required
217+
Namespace string `json:"namespace"`
218+
219+
// Conditions contain the condition list for this Role
220+
// +optional
221+
Conditions []metav1.Condition `json:"condition,omitempty"`
222+
}
223+
224+
// RoleBindingStatus contains the status of a RoleBinding
225+
type RoleBindingStatus struct {
226+
// Name is the name of the RoleBinding
227+
// +required
228+
Name string `json:"name"`
229+
230+
// Namespace is the namespace of the RoleBinding
231+
// +required
232+
Namespace string `json:"namespace"`
233+
234+
// Conditions contain the condition list for this RoleBinding
235+
// +optional
236+
Conditions []metav1.Condition `json:"condition,omitempty"`
161237
}
162238

163-
//+genclient
164-
//+kubebuilder:object:root=true
165-
//+kubebuilder:subresource:status
166-
//+kubebuilder:resource:scope=Namespaced
239+
// +genclient
240+
// +kubebuilder:object:root=true
241+
// +kubebuilder:subresource:status
242+
// +kubebuilder:resource:scope=Namespaced
167243

168244
// ClusterPermission is the Schema for the clusterpermissions API
169245
type ClusterPermission struct {
@@ -174,7 +250,7 @@ type ClusterPermission struct {
174250
Status ClusterPermissionStatus `json:"status,omitempty"`
175251
}
176252

177-
//+kubebuilder:object:root=true
253+
// +kubebuilder:object:root=true
178254

179255
// ClusterPermissionList contains a list of ClusterPermission
180256
type ClusterPermissionList struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 136 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)