refactor: using interfaces for accessing tenant namespaces

This commit is contained in:
Dario Tranchitella
2022-12-26 14:27:26 +01:00
parent 4835b94839
commit 360a8d2b56
3 changed files with 28 additions and 0 deletions
+10
View File
@@ -72,3 +72,13 @@ type TenantList struct {
func init() {
SchemeBuilder.Register(&Tenant{}, &TenantList{})
}
func (in *Tenant) GetNamespaces() (res []string) {
res = make([]string, 0, len(in.Status.Namespaces))
for _, ns := range in.Status.Namespaces {
res = append(res, ns)
}
return
}
+10
View File
@@ -62,6 +62,16 @@ type Tenant struct {
Status TenantStatus `json:"status,omitempty"`
}
func (in *Tenant) GetNamespaces() (res []string) {
res = make([]string, 0, len(in.Status.Namespaces))
for _, ns := range in.Status.Namespaces {
res = append(res, ns)
}
return
}
//+kubebuilder:object:root=true
// TenantList contains a list of Tenant.