Skip to content

Commit

Permalink
feat: deploy modules to different namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: hanshal101 <[email protected]>
Signed-off-by: hanshal101 <[email protected]>
  • Loading branch information
hanshal101 committed Jul 30, 2024
1 parent c31e5fa commit 7d4f95d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cyclops-ctrl/internal/cluster/k8sclient/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 7d4f95d

Please sign in to comment.