Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make changes to run cli from the appscode/grafana-dashboards CI #766

Merged
merged 9 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add gvk for connectcluster
Signed-off-by: sayedppqq <[email protected]>
  • Loading branch information
sayedppqq committed Jul 16, 2024
commit 4ca04ed065b64ecbd5288feab30c4fd0caca0872
2 changes: 1 addition & 1 deletion pkg/cmds/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func DashboardCMD(f cmdutil.Factory) *cobra.Command {
cmd.Flags().StringVarP(&file, "file", "f", "", "absolute or relative path of the file containing dashboard")
cmd.Flags().StringVarP(&url, "url", "u", "", "url of the raw file containing dashboard. "+
"For example: https://raw.githubusercontent.com/appscode/grafana-dashboards/master/mongodb/mongodb-summary-dashboard.json")
cmd.Flags().BoolVarP(&isDB, "isdb", "o", true, "for non db object's. just provide the url")
cmd.Flags().BoolVarP(&isDB, "isdb", "d", true, "for non db object's. just provide the url")
return cmd
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/monitor/dashboard/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"fmt"
"io"
kapi "kubedb.dev/apimachinery/apis/kafka/v1alpha1"
"log"
"net/http"
"os"
Expand All @@ -45,6 +46,12 @@ func getDB(f cmdutil.Factory, resource, ns, name string) (*unstructured.Unstruct
return nil, err
}

if resource == kapi.ResourcePluralConnectCluster {
kGvk := kapi.SchemeGroupVersion
kRes := schema.GroupVersionResource{Group: kGvk.Group, Version: kGvk.Version, Resource: resource}
return dc.Resource(kRes).Namespace(ns).Get(context.TODO(), name, metav1.GetOptions{})
}

gvk := api.SchemeGroupVersion
dbRes := schema.GroupVersionResource{Group: gvk.Group, Version: gvk.Version, Resource: resource}
return dc.Resource(dbRes).Namespace(ns).Get(context.TODO(), name, metav1.GetOptions{})
Expand Down