From 7d4f95dfe344aa8024f9bf75f934546b8fdf3214 Mon Sep 17 00:00:00 2001 From: Hanshal Mehta <122217807+hanshal101@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:56:01 +0530 Subject: [PATCH] feat: deploy modules to different namespaces Signed-off-by: hanshal101 <82961842+hanshal101@users.noreply.github.com> Signed-off-by: hanshal101 <122217807+hanshal101@users.noreply.github.com> --- cyclops-ctrl/internal/cluster/k8sclient/modules.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cyclops-ctrl/internal/cluster/k8sclient/modules.go b/cyclops-ctrl/internal/cluster/k8sclient/modules.go index a01701b09..74b80a08c 100644 --- a/cyclops-ctrl/internal/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/internal/cluster/k8sclient/modules.go @@ -42,7 +42,7 @@ func (k *KubernetesClient) UpdateModule(module *cyclopsv1alpha1.Module) error { } func (k *KubernetesClient) UpdateModuleStatus(module *cyclopsv1alpha1.Module) (*cyclopsv1alpha1.Module, error) { - return k.moduleset.Modules(module.Namespace).UpdateSubresource(module, "status") + return k.moduleset.Modules(module.Namespace).PatchStatus(module) } func (k *KubernetesClient) DeleteModule(name, namespace string) error { @@ -61,7 +61,7 @@ func (k *KubernetesClient) GetResourcesForModule(name, namespace string) ([]dto. return nil, err } - managedGVRs, err := k.getManagedGVRs(module.Name, module.Namespace) + managedGVRs, err := k.getManagedGVRs(module.Name, namespace) if err != nil { return nil, err } @@ -108,8 +108,8 @@ func (k *KubernetesClient) GetResourcesForModule(name, namespace string) ([]dto. return out, nil } -func (k *KubernetesClient) getManagedGVRs(moduleName, moduleNamespace string) ([]schema.GroupVersionResource, error) { - module, _ := k.GetModule(moduleName, moduleNamespace) +func (k *KubernetesClient) getManagedGVRs(moduleName, namespace string) ([]schema.GroupVersionResource, error) { + module, _ := k.GetModule(moduleName, namespace) if module != nil && len(module.Status.ManagedGVRs) != 0 { existing := make([]schema.GroupVersionResource, 0, len(module.Status.ManagedGVRs))