diff --git a/internal/controllers/provisioning/provisioning_types.go b/internal/controllers/provisioning/provisioning_types.go index 35b96cf..80bac1a 100644 --- a/internal/controllers/provisioning/provisioning_types.go +++ b/internal/controllers/provisioning/provisioning_types.go @@ -16,6 +16,7 @@ type ProvisioningResource interface { GetSpec() any GetName() string GetNamespace() string + Clone() any } func getPlatformAndDomain[R ProvisioningResource](res R) (platform, domain string, ok bool) { @@ -32,7 +33,8 @@ func selectItemsInPlatformAndDomain[R ProvisioningResource](platform, domain str result := []R{} for _, res := range source { if res.GetProvisioningMeta().PlatformRef == platform && res.GetProvisioningMeta().DomainRef == domain { - result = append(result, res) + + result = append(result, res.Clone().(R)) } } return result diff --git a/pkg/apis/provisioning/v1alpha1/azureDatabaseTypes.go b/pkg/apis/provisioning/v1alpha1/azureDatabaseTypes.go index efbb674..abf95b6 100644 --- a/pkg/apis/provisioning/v1alpha1/azureDatabaseTypes.go +++ b/pkg/apis/provisioning/v1alpha1/azureDatabaseTypes.go @@ -74,3 +74,7 @@ func (db *AzureDatabase) GetProvisioningMeta() *ProvisioningMeta { func (db *AzureDatabase) GetSpec() any { return &db.Spec } + +func (db *AzureDatabase) Clone() any { + return db.DeepCopy() +} diff --git a/pkg/apis/provisioning/v1alpha1/azureManagedDatabaseTypes.go b/pkg/apis/provisioning/v1alpha1/azureManagedDatabaseTypes.go index 8986550..fd9dce1 100644 --- a/pkg/apis/provisioning/v1alpha1/azureManagedDatabaseTypes.go +++ b/pkg/apis/provisioning/v1alpha1/azureManagedDatabaseTypes.go @@ -78,3 +78,7 @@ func (db *AzureManagedDatabase) GetProvisioningMeta() *ProvisioningMeta { func (db *AzureManagedDatabase) GetSpec() any { return &db.Spec } + +func (db *AzureManagedDatabase) Clone() any { + return db.DeepCopy() +} diff --git a/pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go b/pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go index 8b835ec..f5346d6 100644 --- a/pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go +++ b/pkg/apis/provisioning/v1alpha1/azureVirtualDesktopTypes.go @@ -112,3 +112,7 @@ func (db *AzureVirtualDesktop) GetProvisioningMeta() *ProvisioningMeta { func (db *AzureVirtualDesktop) GetSpec() any { return &db.Spec } + +func (db *AzureVirtualDesktop) Clone() any { + return db.DeepCopy() +} diff --git a/pkg/apis/provisioning/v1alpha1/azureVirtualMachineTypes.go b/pkg/apis/provisioning/v1alpha1/azureVirtualMachineTypes.go index be3a928..0f1a73b 100644 --- a/pkg/apis/provisioning/v1alpha1/azureVirtualMachineTypes.go +++ b/pkg/apis/provisioning/v1alpha1/azureVirtualMachineTypes.go @@ -77,3 +77,7 @@ func (db *AzureVirtualMachine) GetProvisioningMeta() *ProvisioningMeta { func (db *AzureVirtualMachine) GetSpec() any { return &db.Spec } + +func (db *AzureVirtualMachine) Clone() any { + return db.DeepCopy() +} diff --git a/pkg/apis/provisioning/v1alpha1/helmReleaseTypes.go b/pkg/apis/provisioning/v1alpha1/helmReleaseTypes.go index ecc9dcd..cc6c15e 100644 --- a/pkg/apis/provisioning/v1alpha1/helmReleaseTypes.go +++ b/pkg/apis/provisioning/v1alpha1/helmReleaseTypes.go @@ -46,3 +46,7 @@ func (db *HelmRelease) GetProvisioningMeta() *ProvisioningMeta { func (db *HelmRelease) GetSpec() any { return &db.Spec } + +func (db *HelmRelease) Clone() any { + return db.DeepCopy() +}