mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 18:09:58 +00:00
feat: refactor resources controller
Co-authored-by: Maksim Fedotov <m_fedotov@wargaming.net>
This commit is contained in:
committed by
Dario Tranchitella
parent
6403b60590
commit
b1ec9fed50
@@ -5,6 +5,7 @@ package v1beta2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
)
|
||||
|
||||
// GlobalTenantResourceSpec defines the desired state of GlobalTenantResource.
|
||||
@@ -19,7 +20,18 @@ type GlobalTenantResourceStatus struct {
|
||||
// List of Tenants addressed by the GlobalTenantResource.
|
||||
SelectedTenants []string `json:"selectedTenants"`
|
||||
// List of the replicated resources for the given TenantResource.
|
||||
ProcessedItems []ObjectReferenceStatus `json:"processedItems"`
|
||||
ProcessedItems ProcessedItems `json:"processedItems"`
|
||||
}
|
||||
|
||||
type ProcessedItems []ObjectReferenceStatus
|
||||
|
||||
func (p *ProcessedItems) AsSet() sets.String {
|
||||
set := sets.NewString()
|
||||
for _, i := range *p {
|
||||
set.Insert(i.String())
|
||||
}
|
||||
|
||||
return set
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
@@ -46,7 +46,7 @@ type RawExtension struct {
|
||||
// TenantResourceStatus defines the observed state of TenantResource.
|
||||
type TenantResourceStatus struct {
|
||||
// List of the replicated resources for the given TenantResource.
|
||||
ProcessedItems []ObjectReferenceStatus `json:"processedItems"`
|
||||
ProcessedItems ProcessedItems `json:"processedItems"`
|
||||
}
|
||||
|
||||
//+kubebuilder:object:root=true
|
||||
|
||||
@@ -241,7 +241,7 @@ func (in *GlobalTenantResourceStatus) DeepCopyInto(out *GlobalTenantResourceStat
|
||||
}
|
||||
if in.ProcessedItems != nil {
|
||||
in, out := &in.ProcessedItems, &out.ProcessedItems
|
||||
*out = make([]ObjectReferenceStatus, len(*in))
|
||||
*out = make(ProcessedItems, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
@@ -436,6 +436,25 @@ func (in *OwnerSpec) DeepCopy() *OwnerSpec {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in ProcessedItems) DeepCopyInto(out *ProcessedItems) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(ProcessedItems, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProcessedItems.
|
||||
func (in ProcessedItems) DeepCopy() ProcessedItems {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ProcessedItems)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ProxySettings) DeepCopyInto(out *ProxySettings) {
|
||||
*out = *in
|
||||
@@ -662,7 +681,7 @@ func (in *TenantResourceStatus) DeepCopyInto(out *TenantResourceStatus) {
|
||||
*out = *in
|
||||
if in.ProcessedItems != nil {
|
||||
in, out := &in.ProcessedItems, &out.ProcessedItems
|
||||
*out = make([]ObjectReferenceStatus, len(*in))
|
||||
*out = make(ProcessedItems, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user