Skip to content

Commit

Permalink
fix: api schema and update kong chart config (#8879)
Browse files Browse the repository at this point in the history
* fix api endpoint type and update kong chart config

* update ingress and cronjob api docs
  • Loading branch information
floreks committed Apr 4, 2024
1 parent f3ae9d2 commit 16df35e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 31 deletions.
3 changes: 3 additions & 0 deletions charts/kubernetes-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,11 @@ metrics-server:
## for our all containers.
kong:
enabled: true
## Configuration reference: https://docs.konghq.com/gateway/3.6.x/reference/configuration
env:
dns_order: A,CNAME,LAST,SRV
plugins: 'off'
nginx_worker_processes: 1
ingressController:
enabled: false
dblessConfig:
Expand Down
8 changes: 5 additions & 3 deletions modules/api/pkg/handler/apihandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
"k8s.io/dashboard/api/pkg/resource/role"
"k8s.io/dashboard/api/pkg/resource/rolebinding"
"k8s.io/dashboard/api/pkg/resource/secret"
"k8s.io/dashboard/api/pkg/resource/service"
resourceService "k8s.io/dashboard/api/pkg/resource/service"
"k8s.io/dashboard/api/pkg/resource/serviceaccount"
"k8s.io/dashboard/api/pkg/resource/statefulset"
Expand Down Expand Up @@ -258,8 +259,8 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
Doc("returns a list of Services for ReplicaSet").
Param(apiV1Ws.PathParameter("namespace", "namespace of the ReplicaSet")).
Param(apiV1Ws.PathParameter("replicaSet", "name of the ReplicaSets")).
Writes(pod.PodList{}).
Returns(http.StatusOK, "OK", pod.PodList{}))
Writes(service.ServiceList{}).
Returns(http.StatusOK, "OK", service.ServiceList{}))
apiV1Ws.Route(
apiV1Ws.GET("/replicaset/{namespace}/{replicaSet}/event").To(apiHandler.handleGetReplicaSetEvents).
// docs
Expand Down Expand Up @@ -551,6 +552,7 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
Doc("returns a list of Jobs for CronJob").
Param(apiV1Ws.PathParameter("namespace", "namespace of the CronJob")).
Param(apiV1Ws.PathParameter("name", "name of the CronJob")).
Param(apiV1Ws.QueryParameter("active", "filter related Jobs by active status")).
Writes(job.JobList{}).
Returns(http.StatusOK, "OK", job.JobList{}))
apiV1Ws.Route(
Expand Down Expand Up @@ -777,7 +779,7 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
// docs
Doc("returns a list of Events for Ingress").
Param(apiV1Ws.PathParameter("namespace", "namespace of the Ingress")).
Param(apiV1Ws.PathParameter("name", "name of the Ingress")).
Param(apiV1Ws.PathParameter("ingress", "name of the Ingress")).
Writes(common.EventList{}).
Returns(http.StatusOK, "OK", common.EventList{}))

Expand Down
56 changes: 31 additions & 25 deletions modules/api/schema/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,12 @@
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "filter related Jobs by active status",
"name": "active",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -3731,7 +3737,7 @@
{
"type": "string",
"description": "name of the Ingress",
"name": "name",
"name": "ingress",
"in": "path",
"required": true
}
Expand Down Expand Up @@ -6624,7 +6630,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/pod.PodList"
"$ref": "#/definitions/service.ServiceList"
}
}
}
Expand Down Expand Up @@ -9918,13 +9924,13 @@
},
"cronjob.CronJobDetail": {
"required": [
"containerImages",
"objectMeta",
"typeMeta",
"schedule",
"suspend",
"active",
"lastSchedule",
"containerImages",
"concurrencyPolicy",
"startingDeadlineSeconds",
"errors"
Expand Down Expand Up @@ -10049,11 +10055,11 @@
},
"daemonset.DaemonSetDetail": {
"required": [
"objectMeta",
"typeMeta",
"podInfo",
"containerImages",
"initContainerImages",
"objectMeta",
"errors"
],
"properties": {
Expand Down Expand Up @@ -10593,13 +10599,13 @@
},
"horizontalpodautoscaler.HorizontalPodAutoscalerDetail": {
"required": [
"objectMeta",
"typeMeta",
"scaleTargetRef",
"minReplicas",
"maxReplicas",
"currentCPUUtilizationPercentage",
"targetCPUUtilizationPercentage",
"objectMeta",
"currentReplicas",
"desiredReplicas",
"lastScaleTime"
Expand Down Expand Up @@ -10876,13 +10882,13 @@
},
"job.JobDetail": {
"required": [
"initContainerImages",
"parallelism",
"jobStatus",
"objectMeta",
"typeMeta",
"podInfo",
"containerImages",
"initContainerImages",
"parallelism",
"jobStatus",
"completions",
"errors"
],
Expand Down Expand Up @@ -11132,9 +11138,9 @@
},
"namespace.NamespaceDetail": {
"required": [
"phase",
"objectMeta",
"typeMeta",
"phase",
"resourceQuotaList",
"resourceLimits",
"errors"
Expand Down Expand Up @@ -11216,8 +11222,8 @@
},
"networkpolicy.NetworkPolicyDetail": {
"required": [
"typeMeta",
"objectMeta",
"typeMeta",
"podSelector",
"errors"
],
Expand Down Expand Up @@ -11552,16 +11558,16 @@
},
"persistentvolume.PersistentVolumeDetail": {
"required": [
"objectMeta",
"capacity",
"storageClass",
"accessModes",
"mountOptions",
"status",
"reason",
"typeMeta",
"accessModes",
"reclaimPolicy",
"mountOptions",
"storageClass",
"claim",
"reason",
"objectMeta",
"message",
"persistentVolumeSource"
],
Expand Down Expand Up @@ -11679,13 +11685,13 @@
},
"persistentvolumeclaim.PersistentVolumeClaimDetail": {
"required": [
"storageClass",
"objectMeta",
"typeMeta",
"status",
"volume",
"capacity",
"accessModes"
"accessModes",
"storageClass",
"objectMeta",
"typeMeta"
],
"properties": {
"accessModes": {
Expand Down Expand Up @@ -12089,11 +12095,11 @@
},
"replicaset.ReplicaSetDetail": {
"required": [
"initContainerImages",
"objectMeta",
"typeMeta",
"podInfo",
"containerImages",
"initContainerImages",
"selector",
"horizontalPodAutoscalerList",
"errors"
Expand Down Expand Up @@ -12203,11 +12209,11 @@
},
"replicationcontroller.ReplicationControllerDetail": {
"required": [
"containerImages",
"initContainerImages",
"objectMeta",
"typeMeta",
"podInfo",
"containerImages",
"initContainerImages",
"labelSelector",
"errors"
],
Expand Down Expand Up @@ -12410,8 +12416,8 @@
},
"role.RoleDetail": {
"required": [
"objectMeta",
"typeMeta",
"objectMeta",
"rules",
"errors"
],
Expand Down Expand Up @@ -13028,12 +13034,12 @@
},
"types.CustomResourceDefinitionDetail": {
"required": [
"objectMeta",
"typeMeta",
"group",
"scope",
"names",
"established",
"objectMeta",
"typeMeta",
"conditions",
"objects",
"subresources",
Expand Down
10 changes: 7 additions & 3 deletions modules/web/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ type Query {
metricNames: String
"""Aggregations to be performed for each metric (default: sum)"""
aggregations: String
): job_JobList @httpOperation(subgraph: "api", path: "/api/v1/cronjob/{args.namespace}/{args.name}/job", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\"}")
"""filter related Jobs by active status"""
active: String
): job_JobList @httpOperation(subgraph: "api", path: "/api/v1/cronjob/{args.namespace}/{args.name}/job", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\",\"active\":\"active\"}")
"""generates a one-time CSRF token that can be used by POST request"""
handleGetCsrfToken(
"""action name to generate CSRF token for"""
Expand Down Expand Up @@ -654,6 +656,8 @@ type Query {
handleGetIngressEvent(
"""namespace of the Ingress"""
namespace: String!
"""name of the Ingress"""
ingress: String!
"""
Comma delimited string used to apply filtering: 'propertyName,filterValue'
"""
Expand All @@ -668,7 +672,7 @@ type Query {
metricNames: String
"""Aggregations to be performed for each metric (default: sum)"""
aggregations: String
): common_EventList @httpOperation(subgraph: "api", path: "/api/v1/ingress/{args.namespace}/{ingress}/event", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\"}")
): common_EventList @httpOperation(subgraph: "api", path: "/api/v1/ingress/{args.namespace}/{args.ingress}/event", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\"}")
"""returns detailed information about Ingress"""
handleGetIngressDetail(
"""namespace of the Ingress"""
Expand Down Expand Up @@ -1366,7 +1370,7 @@ type Query {
metricNames: String
"""Aggregations to be performed for each metric (default: sum)"""
aggregations: String
): pod_PodList @httpOperation(subgraph: "api", path: "/api/v1/replicaset/{args.namespace}/{args.replicaSet}/service", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\"}")
): service_ServiceList @httpOperation(subgraph: "api", path: "/api/v1/replicaset/{args.namespace}/{args.replicaSet}/service", operationSpecificHeaders: "{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\"}", httpMethod: GET, queryParamArgMap: "{\"filterBy\":\"filterBy\",\"sortBy\":\"sortBy\",\"itemsPerPage\":\"itemsPerPage\",\"page\":\"page\",\"metricNames\":\"metricNames\",\"aggregations\":\"aggregations\"}")
"""returns a list of ReplicationController in a namespace"""
handleGetReplicationControllerList(
"""
Expand Down

0 comments on commit 16df35e

Please sign in to comment.