Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/cyclops-ui/cyclops
Browse files Browse the repository at this point in the history
  • Loading branch information
Petar Cvitanović committed Aug 1, 2023
2 parents 097e7c8 + 2b9dbf4 commit 6c9444f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
Welcome to Cyclops, a powerful user interface for managing and interacting with Kubernetes clusters. Cyclops is designed
to simplify the management of containerized applications on Kubernetes, providing an intuitive and user-friendly
experience for developers, system administrators, and DevOps professionals. Divide the responsibility between your
infrastructure and your developer teams so that everyone can play to their strengths. Automate your processes and shrink
infrastructure and your developer teams so everyone can play to their strengths. Automate your processes and shrink
the window for deployment mistakes. [Find out more!](https://cyclops-ui.com)

![Screenshot 2022-04-06 at 20 26 17](https://user-images.githubusercontent.com/72022639/162033638-845b5f2c-f1df-4e17-b2fc-ba4ab318f887.png)

Find out how to [install](https://cyclops-ui.com/docs/installation/prerequisites) it to your cluster on our landing page
and give it a go! (~10 minute tutrial)
and give it a go! (~10 minute tutorial)

# Future work

Expand Down
14 changes: 11 additions & 3 deletions cyclops-ctrl/internal/cluster/k8sclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ func (k *KubernetesClient) UpdateScale(namespace, name string, sc v1.Scale) erro
}

func (k *KubernetesClient) Deploy(deploymentSpec *v12.Deployment) error {
deploymentClient := k.clientset.AppsV1().Deployments(apiv1.NamespaceDefault)
namespace := deploymentSpec.Namespace
if len(namespace) == 0 {
namespace = apiv1.NamespaceDefault
}
deploymentClient := k.clientset.AppsV1().Deployments(namespace)

_, err := deploymentClient.Get(context.TODO(), deploymentSpec.Name, metav1.GetOptions{})
if err != nil {
Expand All @@ -143,7 +147,11 @@ func (k *KubernetesClient) Deploy(deploymentSpec *v12.Deployment) error {
}

func (k *KubernetesClient) DeployService(service *apiv1.Service) error {
serviceClient := k.clientset.CoreV1().Services(apiv1.NamespaceDefault)
namespace := service.Namespace
if len(namespace) == 0 {
namespace = apiv1.NamespaceDefault
}
serviceClient := k.clientset.CoreV1().Services(namespace)

_, err := serviceClient.Get(context.TODO(), service.Name, metav1.GetOptions{})
if err != nil {
Expand Down Expand Up @@ -246,7 +254,7 @@ func (k *KubernetesClient) Delete(resource dto.Resource) error {
Resource: strings.ToLower(resource.GetKind()) + "s",
}

return k.Dynamic.Resource(gvr).Namespace("default").Delete(
return k.Dynamic.Resource(gvr).Namespace(resource.GetNamespace()).Delete(
context.Background(),
resource.GetName(),
metav1.DeleteOptions{},
Expand Down
4 changes: 2 additions & 2 deletions cyclops-ctrl/internal/cluster/k8sclient/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (k *KubernetesClient) GetModule(name string) (*cyclopsv1alpha1.Module, erro
func (k *KubernetesClient) GetResourcesForModule(name string) ([]dto.Resource, error) {
out := make([]dto.Resource, 0, 0)

deployments, err := k.clientset.AppsV1().Deployments("default").List(context.Background(), metav1.ListOptions{
deployments, err := k.clientset.AppsV1().Deployments("").List(context.Background(), metav1.ListOptions{
LabelSelector: "cyclops.module=" + name,
})
if err != nil {
Expand Down Expand Up @@ -93,7 +93,7 @@ func (k *KubernetesClient) GetResourcesForModule(name string) ([]dto.Resource, e
})
}

services, err := k.clientset.CoreV1().Services("default").List(context.Background(), metav1.ListOptions{
services, err := k.clientset.CoreV1().Services("").List(context.Background(), metav1.ListOptions{
LabelSelector: "cyclops.module=" + name,
})
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (r *ModuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr

r.logger.Info("upsert module", "namespaced name", req.NamespacedName)
if err := r.moduleToResources(req.Name); err != nil {
r.logger.Error(err, "error on delete module", "namespaced name", req.NamespacedName)
r.logger.Error(err, "error on upsert module", "namespaced name", req.NamespacedName)
return ctrl.Result{}, err
}

Expand Down

0 comments on commit 6c9444f

Please sign in to comment.