-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more resources for member cluster
Signed-off-by: Heylosky <[email protected]>
- Loading branch information
Showing
9 changed files
with
402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package configmap | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/configmap" | ||
) | ||
|
||
func handleGetConfigMap(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
nsQuery := common.ParseNamespacePathParameter(c) | ||
result, err := configmap.GetConfigMapList(memberClient, nsQuery, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetConfigMapDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("name") | ||
result, err := configmap.GetConfigMapDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/configmap", handleGetConfigMap) | ||
r.GET("/configmap/:namespace", handleGetConfigMap) | ||
r.GET("/configmap/:namespace/:name", handleGetConfigMapDetail) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package cronjob | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/cronjob" | ||
"github.com/karmada-io/dashboard/pkg/resource/event" | ||
) | ||
|
||
func handleGetCronJob(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := common.ParseNamespacePathParameter(c) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := cronjob.GetCronJobList(memberClient, namespace, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetCronJobDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("cronjob") | ||
result, err := cronjob.GetCronJobDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetCronJobEvents(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("cronjob") | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := event.GetResourceEvents(memberClient, dataSelect, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/cronjob", handleGetCronJob) | ||
r.GET("/cronjob/:namespace", handleGetCronJob) | ||
r.GET("/cronjob/:namespace/:cronjob", handleGetCronJobDetail) | ||
r.GET("/cronjob/:namespace/:cronjob/event", handleGetCronJobEvents) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package daemonset | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/daemonset" | ||
"github.com/karmada-io/dashboard/pkg/resource/event" | ||
) | ||
|
||
func handleGetDaemonset(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := common.ParseNamespacePathParameter(c) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := daemonset.GetDaemonSetList(memberClient, namespace, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetDaemonsetDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("daemonset") | ||
result, err := daemonset.GetDaemonSetDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetDaemonsetEvents(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("daemonset") | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := event.GetResourceEvents(memberClient, dataSelect, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/daemonset", handleGetDaemonset) | ||
r.GET("/daemonset/:namespace", handleGetDaemonset) | ||
r.GET("/daemonset/:namespace/:daemonset", handleGetDaemonsetDetail) | ||
r.GET("/daemonset/:namespace/:daemonset/event", handleGetDaemonsetEvents) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ingress | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/ingress" | ||
) | ||
|
||
func handleGetIngress(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
nsQuery := common.ParseNamespacePathParameter(c) | ||
result, err := ingress.GetIngressList(memberClient, nsQuery, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetIngressDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("ingress") | ||
result, err := ingress.GetIngressDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/ingress", handleGetIngress) | ||
r.GET("/ingress/:namespace", handleGetIngress) | ||
r.GET("/ingress/:namespace/:ingress", handleGetIngressDetail) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package job | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/event" | ||
"github.com/karmada-io/dashboard/pkg/resource/job" | ||
) | ||
|
||
func handleGetJob(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := common.ParseNamespacePathParameter(c) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := job.GetJobList(memberClient, namespace, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetJobDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("job") | ||
result, err := job.GetJobDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetJobEvents(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("job") | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := event.GetResourceEvents(memberClient, dataSelect, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/job", handleGetJob) | ||
r.GET("/job/:namespace", handleGetJob) | ||
r.GET("/job/:namespace/:job", handleGetJobDetail) | ||
r.GET("/job/:namespace/:job/event", handleGetJobEvents) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package secret | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/secret" | ||
) | ||
|
||
func handleGetSecrets(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
nsQuery := common.ParseNamespacePathParameter(c) | ||
result, err := secret.GetSecretList(memberClient, nsQuery, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetSecretDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("secret") | ||
result, err := secret.GetSecretDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/secret", handleGetSecrets) | ||
r.GET("/secret/:namespace", handleGetSecrets) | ||
r.GET("/secret/:namespace/:secret", handleGetSecretDetail) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package service | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/karmada-io/dashboard/cmd/api/app/router" | ||
"github.com/karmada-io/dashboard/cmd/api/app/types/common" | ||
"github.com/karmada-io/dashboard/pkg/client" | ||
"github.com/karmada-io/dashboard/pkg/resource/service" | ||
) | ||
|
||
func handleGetServices(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
nsQuery := common.ParseNamespacePathParameter(c) | ||
result, err := service.GetServiceList(memberClient, nsQuery, dataSelect) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetServiceDetail(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("service") | ||
result, err := service.GetServiceDetail(memberClient, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func handleGetServiceEvents(c *gin.Context) { | ||
memberClient := client.InClusterClientForMemberCluster(c.Param("clustername")) | ||
namespace := c.Param("namespace") | ||
name := c.Param("service") | ||
dataSelect := common.ParseDataSelectPathParameter(c) | ||
result, err := service.GetServiceEvents(memberClient, dataSelect, namespace, name) | ||
if err != nil { | ||
common.Fail(c, err) | ||
return | ||
} | ||
common.Success(c, result) | ||
} | ||
|
||
func init() { | ||
r := router.MemberV1() | ||
r.GET("/service", handleGetServices) | ||
r.GET("/service/:namespace", handleGetServices) | ||
r.GET("/service/:namespace/:service", handleGetServiceDetail) | ||
r.GET("/service/:namespace/:service/event", handleGetServiceEvents) | ||
} |
Oops, something went wrong.