add more features
This commit is contained in:
2588
handler/handler.go
2588
handler/handler.go
File diff suppressed because it is too large
Load Diff
47
main.go
47
main.go
@@ -129,10 +129,17 @@ func main() {
|
|||||||
router.HandleFunc("/deletecluster", handler.Deletecluster)
|
router.HandleFunc("/deletecluster", handler.Deletecluster)
|
||||||
router.HandleFunc("/clusters", handler.ListUserClusters)
|
router.HandleFunc("/clusters", handler.ListUserClusters)
|
||||||
router.HandleFunc("/cluster_stats", handler.ClusterStats)
|
router.HandleFunc("/cluster_stats", handler.ClusterStats)
|
||||||
|
router.HandleFunc("/cluster_resource_usage", handler.Cluster_resource_usage)
|
||||||
|
router.HandleFunc("/cluster_health", handler.Cluster_health)
|
||||||
|
router.HandleFunc("/cluster_uptime", handler.Cluster_uptime)
|
||||||
|
router.HandleFunc("/cluster_performance", handler.Cluster_performance)
|
||||||
|
router.HandleFunc("/cluster_events", handler.Cluster_events)
|
||||||
router.HandleFunc("/connect", handler.Connect)
|
router.HandleFunc("/connect", handler.Connect)
|
||||||
// router.HandleFunc("/cluster_nodes", handler.Cluster_nodes)
|
// router.HandleFunc("/cluster_nodes", handler.Cluster_nodes)
|
||||||
router.HandleFunc("/cluster_namespaces", handler.Cluster_namespaces)
|
router.HandleFunc("/cluster_namespaces", handler.Cluster_namespaces)
|
||||||
router.HandleFunc("/cluster_services", handler.Cluster_services)
|
router.HandleFunc("/cluster_services", handler.Cluster_services)
|
||||||
|
router.HandleFunc("/cluster_configmap", handler.Cluster_configmap)
|
||||||
|
router.HandleFunc("/cluster_secret", handler.Cluster_secret)
|
||||||
router.HandleFunc("/cluster_deployments", handler.Cluster_deployments)
|
router.HandleFunc("/cluster_deployments", handler.Cluster_deployments)
|
||||||
router.HandleFunc("/cluster_pods", handler.Cluster_pods)
|
router.HandleFunc("/cluster_pods", handler.Cluster_pods)
|
||||||
router.HandleFunc("/cluster_statefulset", handler.Cluster_statefulset)
|
router.HandleFunc("/cluster_statefulset", handler.Cluster_statefulset)
|
||||||
@@ -140,19 +147,55 @@ func main() {
|
|||||||
|
|
||||||
router.HandleFunc("/cluster_jobs", handler.Cluster_jobs)
|
router.HandleFunc("/cluster_jobs", handler.Cluster_jobs)
|
||||||
router.HandleFunc("/cluster_replicasets", handler.Cluster_replicasets)
|
router.HandleFunc("/cluster_replicasets", handler.Cluster_replicasets)
|
||||||
|
router.HandleFunc("/replicaset_delete", handler.Replicaset_delete)
|
||||||
router.HandleFunc("/cluster_replicationcontrollers", handler.Cluster_replicationcontrollers)
|
router.HandleFunc("/cluster_replicationcontrollers", handler.Cluster_replicationcontrollers)
|
||||||
|
|
||||||
|
router.HandleFunc("/deployment_manifest", handler.Deployment_manifest)
|
||||||
|
router.HandleFunc("/daemonsets_manifest", handler.DaemonSet_manifest)
|
||||||
|
router.HandleFunc("/statefulset_manifest", handler.StatefulSet_manifest)
|
||||||
|
router.HandleFunc("/replicationcontroller_manifest", handler.Replicationcontroller_manifest)
|
||||||
|
router.HandleFunc("/deployment_rollout", handler.Deployment_rollout)
|
||||||
|
router.HandleFunc("/daemonsets_rollout", handler.DaemonSet_rollout)
|
||||||
|
router.HandleFunc("/deployment_scale", handler.Deployment_scale)
|
||||||
|
router.HandleFunc("/replicaset_scale", handler.ReplicaSet_scale)
|
||||||
|
router.HandleFunc("/statefulset_scale", handler.StatefulSet_scale)
|
||||||
|
router.HandleFunc("/replicationcontroller_scale", handler.Replicationcontroller_scale)
|
||||||
|
router.HandleFunc("/statefulset_rollout", handler.StatefulSet_rollout)
|
||||||
router.HandleFunc("/pod_logs", handler.Pod_logs)
|
router.HandleFunc("/pod_logs", handler.Pod_logs)
|
||||||
|
router.HandleFunc("/pod_manifest", handler.Pod_manifest)
|
||||||
|
router.HandleFunc("/replicaset_manifest", handler.Replicaset_manifest)
|
||||||
|
router.HandleFunc("/jobs_manifest", handler.Jobs_manifest)
|
||||||
|
router.HandleFunc("/cronjobs_manifest", handler.CronJobs_manifest)
|
||||||
|
router.HandleFunc("/configmap_manifest", handler.ConfigMap_manifest)
|
||||||
|
router.HandleFunc("/secret_manifest", handler.Secret_manifest)
|
||||||
|
router.HandleFunc("/service_manifest", handler.Service_manifest)
|
||||||
|
router.HandleFunc("/cronjobs_trigger", handler.Cronjobs_trigger)
|
||||||
|
router.HandleFunc("/cronjobs_suspend", handler.Cronjobs_suspend)
|
||||||
|
router.HandleFunc("/jobs_logs", handler.Jobs_logs)
|
||||||
|
router.HandleFunc("/pod_create", handler.Pod_fromYaml)
|
||||||
|
router.HandleFunc("/deployment_create", handler.Deployment_fromYaml)
|
||||||
|
router.HandleFunc("/daemonsets_create", handler.DaemonSet_fromYaml)
|
||||||
|
router.HandleFunc("/jobs_create", handler.Job_fromYaml)
|
||||||
|
router.HandleFunc("/statefulset_create", handler.StatefulSet_fromYaml)
|
||||||
|
router.HandleFunc("/configmap_create", handler.ConfigMap_fromYaml)
|
||||||
|
router.HandleFunc("/secret_create", handler.Secret_fromYaml)
|
||||||
|
router.HandleFunc("/service_create", handler.Service_fromYaml)
|
||||||
router.HandleFunc("/pod_exec", handler.Pod_exec)
|
router.HandleFunc("/pod_exec", handler.Pod_exec)
|
||||||
router.HandleFunc("/pod_delete", handler.Pod_delete)
|
router.HandleFunc("/pod_delete", handler.Pod_delete)
|
||||||
router.HandleFunc("/service_delete", handler.Service_delete)
|
router.HandleFunc("/service_delete", handler.Service_delete)
|
||||||
|
router.HandleFunc("/configmap_delete", handler.Configmap_delete)
|
||||||
|
router.HandleFunc("/secret_delete", handler.Secret_delete)
|
||||||
router.HandleFunc("/deployment_delete", handler.Deployment_delete)
|
router.HandleFunc("/deployment_delete", handler.Deployment_delete)
|
||||||
router.HandleFunc("/statefulSet_delete", handler.StatefulSet_delete)
|
router.HandleFunc("/statefulSet_delete", handler.StatefulSet_delete)
|
||||||
router.HandleFunc("/daemonsets_delete", handler.Daemonsets_delete)
|
router.HandleFunc("/daemonsets_delete", handler.Daemonsets_delete)
|
||||||
router.HandleFunc("/jobsName_delete", handler.JobsName_delete)
|
router.HandleFunc("/jobsName_delete", handler.JobsName_delete)
|
||||||
router.HandleFunc("/replicaset_delete", handler.Replicaset_delete)
|
|
||||||
router.HandleFunc("/replicationcontroller_delete", handler.Replicationcontroller_delete)
|
router.HandleFunc("/replicationcontroller_delete", handler.Replicationcontroller_delete)
|
||||||
router.HandleFunc("/cronjob_delete", handler.Cronjob_delete)
|
router.HandleFunc("/cronjobs_delete", handler.Cronjob_delete)
|
||||||
|
router.HandleFunc("/cronjobs_create", handler.CronJob_fromYaml)
|
||||||
|
router.HandleFunc("/cluster_cronjobs", handler.Cluster_cronjobs)
|
||||||
|
router.HandleFunc("/replicationcontroller_create", handler.ReplicationController_fromYaml)
|
||||||
|
router.HandleFunc("/replicationcontroller_migrate", handler.Replicationcontroller_migrate)
|
||||||
|
router.HandleFunc("/helm_install", handler.Helm_install)
|
||||||
router.HandleFunc("/worker_nodes_plan", handler.Worker_nodes_plan)
|
router.HandleFunc("/worker_nodes_plan", handler.Worker_nodes_plan)
|
||||||
//handler.RegsiterClusterRoute(router)
|
//handler.RegsiterClusterRoute(router)
|
||||||
// Enable CORS
|
// Enable CORS
|
||||||
|
|||||||
@@ -29,12 +29,32 @@ type Header struct {
|
|||||||
Authorization string `bson:"token"`
|
Authorization string `bson:"token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Namespace struct {
|
||||||
|
Name string `json:name`
|
||||||
|
Status string `json:status`
|
||||||
|
Age string `json:age`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PodLog struct {
|
||||||
|
Podname string `json:name`
|
||||||
|
Namespace string `json:namespace`
|
||||||
|
Clustername string `json:clustername`
|
||||||
|
Manifest string `json:clustername`
|
||||||
|
Replicasetname string `json:replicasetname`
|
||||||
|
Statefulset string `json:Statefulset`
|
||||||
|
Daemonsetsname string `json:Daemonsetsname`
|
||||||
|
}
|
||||||
|
|
||||||
type Pod struct {
|
type Pod struct {
|
||||||
Name string `json:name`
|
Name string `json:name`
|
||||||
Namespace string `json:name`
|
Namespace string `json:namespace`
|
||||||
Status string `json:status`
|
Status string `json:status`
|
||||||
Restart int32 `json:restart`
|
|
||||||
Age string `json:age`
|
Age string `json:age`
|
||||||
|
Ready string `json:ready`
|
||||||
|
Restarts int32 `json:restars`
|
||||||
|
Ip string `json:ip`
|
||||||
|
Node string `json:node`
|
||||||
|
Image string `json:iamge`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
@@ -48,12 +68,17 @@ type Service struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Deployment struct {
|
type Deployment struct {
|
||||||
Name string `json:name`
|
Name string `json:name`
|
||||||
Namespace string `json:namespace`
|
Namespace string `json:namespace`
|
||||||
Available string `json:available`
|
Available string `json:available`
|
||||||
Replicas int32 `json:replicas`
|
Replicas int32 `json:replicas`
|
||||||
Message string `json:message`
|
Message string `json:message`
|
||||||
Reason string `json:reason`
|
Reason string `json:reason`
|
||||||
|
Ready string `json:ready`
|
||||||
|
UpdateToDate int32 `json:uptodate`
|
||||||
|
Age string `json:age`
|
||||||
|
Image string `json:iamge`
|
||||||
|
Strategy string `json:iamge`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Daemonset struct {
|
type Daemonset struct {
|
||||||
@@ -78,6 +103,16 @@ type Jobs struct {
|
|||||||
Age string `json:age`
|
Age string `json:age`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CronJob struct {
|
||||||
|
Name string `json:name`
|
||||||
|
Namespace string `json:namespace`
|
||||||
|
Schedule string `json:schedule`
|
||||||
|
Suspend bool `json:suspend`
|
||||||
|
Active int `json:active`
|
||||||
|
LastScheduleTime string `json:lastScheduleTime`
|
||||||
|
Age string `json:age`
|
||||||
|
}
|
||||||
|
|
||||||
type Replicaset struct {
|
type Replicaset struct {
|
||||||
Name string `json:name`
|
Name string `json:name`
|
||||||
Desired int32 `json:desired`
|
Desired int32 `json:desired`
|
||||||
@@ -158,3 +193,65 @@ type Uptime struct {
|
|||||||
LastMaintenance string `json:"lastMaintenance"`
|
LastMaintenance string `json:"lastMaintenance"`
|
||||||
NextMaintenance string `json:"nextMaintenance"`
|
NextMaintenance string `json:"nextMaintenance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ReplicasetScaleReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Replicasetname string `json:"Replicasetname"`
|
||||||
|
Replicas int32 `json:"Replicas"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplicasetRolloutReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Replicasetname string `json:"Replicasetname"`
|
||||||
|
Action string `json:"Action"` // "restart" | "status"
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeploymentScaleReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Deployment string `json:"Deployment"`
|
||||||
|
Replicas int32 `json:"Replicas"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeploymentRolloutReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Deployment string `json:"Deployment"`
|
||||||
|
Action string `json:"Action"` // "restart" | "status"
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeamonSetsRolloutReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Daemonsetsname string `json:"Daemonsetsname"`
|
||||||
|
Action string `json:"Action"` // "restart" | "status"
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatefulsetRolloutReq struct {
|
||||||
|
Clustername string `json:"Clustername"`
|
||||||
|
Namespace string `json:"Namespace"`
|
||||||
|
Statefulset string `json:"Statefulset"`
|
||||||
|
Action string `json:"Action"` // "restart" | "status"
|
||||||
|
Replicas int32 `json:"Replicas"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeploymentRolloutStatus struct {
|
||||||
|
Deployment string `json:"deployment"`
|
||||||
|
Namespace string `json:"namespace"`
|
||||||
|
ObservedGeneration int64 `json:"observedGeneration"`
|
||||||
|
Replicas int32 `json:"replicas"`
|
||||||
|
UpdatedReplicas int32 `json:"updatedReplicas"`
|
||||||
|
ReadyReplicas int32 `json:"readyReplicas"`
|
||||||
|
AvailableReplicas int32 `json:"availableReplicas"`
|
||||||
|
UnavailableReplicas int32 `json:"unavailableReplicas"`
|
||||||
|
ConditionProgressing string `json:"conditionProgressing,omitempty"`
|
||||||
|
ConditionAvailable string `json:"conditionAvailable,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeploymentRolloutResp struct {
|
||||||
|
Clustername string `json:"cluster"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
Status *DeploymentRolloutStatus `json:"status,omitempty"`
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user