mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 09:59:57 +00:00
feat(tenant): add available classes as status fields (#1751)
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
This commit is contained in:
@@ -8,5 +8,5 @@ import (
|
||||
)
|
||||
|
||||
type GatewayOptions struct {
|
||||
AllowedClasses *api.SelectionListWithDefaultSpec `json:"allowedClasses,omitempty"`
|
||||
AllowedClasses *api.DefaultAllowedListSpec `json:"allowedClasses,omitempty"`
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ const (
|
||||
|
||||
// Returns the observed state of the Tenant.
|
||||
type TenantStatus struct {
|
||||
// Allowed Cluster Objects within Tenant
|
||||
TenantAvailableStatus `json:",inline"`
|
||||
|
||||
// +kubebuilder:default=Active
|
||||
// The operational state of the Tenant. Possible values are "Active", "Cordoned".
|
||||
State tenantState `json:"state"`
|
||||
@@ -50,6 +53,22 @@ type TenantStatusNamespaceMetadata struct {
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
type TenantAvailableStatus struct {
|
||||
// Available Class Types within Tenant
|
||||
Classes TenantAvailableClassesStatus `json:"classes,omitempty"`
|
||||
}
|
||||
|
||||
type TenantAvailableClassesStatus struct {
|
||||
// Available Storageclasses (Only collected if any matching condition is specified)
|
||||
StorageClasses []string `json:"storage,omitempty"`
|
||||
// Available PriorityClasses
|
||||
PriorityClasses []string `json:"priority,omitempty"`
|
||||
// Available StorageClasses
|
||||
RuntimeClasses []string `json:"runtime,omitempty"`
|
||||
// Available GatewayClasses
|
||||
GatewayClasses []string `json:"gateway,omitempty"`
|
||||
}
|
||||
|
||||
func (ms *TenantStatus) GetInstance(stat *TenantStatusNamespaceItem) *TenantStatusNamespaceItem {
|
||||
for _, source := range ms.Spaces {
|
||||
if ms.instancequal(source, stat) {
|
||||
|
||||
@@ -155,7 +155,7 @@ func (in *GatewayOptions) DeepCopyInto(out *GatewayOptions) {
|
||||
*out = *in
|
||||
if in.AllowedClasses != nil {
|
||||
in, out := &in.AllowedClasses, &out.AllowedClasses
|
||||
*out = new(api.SelectionListWithDefaultSpec)
|
||||
*out = new(api.DefaultAllowedListSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
@@ -899,6 +899,57 @@ func (in *Tenant) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TenantAvailableClassesStatus) DeepCopyInto(out *TenantAvailableClassesStatus) {
|
||||
*out = *in
|
||||
if in.StorageClasses != nil {
|
||||
in, out := &in.StorageClasses, &out.StorageClasses
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.PriorityClasses != nil {
|
||||
in, out := &in.PriorityClasses, &out.PriorityClasses
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.RuntimeClasses != nil {
|
||||
in, out := &in.RuntimeClasses, &out.RuntimeClasses
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.GatewayClasses != nil {
|
||||
in, out := &in.GatewayClasses, &out.GatewayClasses
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TenantAvailableClassesStatus.
|
||||
func (in *TenantAvailableClassesStatus) DeepCopy() *TenantAvailableClassesStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TenantAvailableClassesStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TenantAvailableStatus) DeepCopyInto(out *TenantAvailableStatus) {
|
||||
*out = *in
|
||||
in.Classes.DeepCopyInto(&out.Classes)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TenantAvailableStatus.
|
||||
func (in *TenantAvailableStatus) DeepCopy() *TenantAvailableStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TenantAvailableStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TenantList) DeepCopyInto(out *TenantList) {
|
||||
*out = *in
|
||||
@@ -1127,6 +1178,7 @@ func (in *TenantSpec) DeepCopy() *TenantSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TenantStatus) DeepCopyInto(out *TenantStatus) {
|
||||
*out = *in
|
||||
in.TenantAvailableStatus.DeepCopyInto(&out.TenantAvailableStatus)
|
||||
if in.Namespaces != nil {
|
||||
in, out := &in.Namespaces, &out.Namespaces
|
||||
*out = make([]string, len(*in))
|
||||
|
||||
Reference in New Issue
Block a user