Skip to content

Commit 16df35e

Browse files
authored
fix: api schema and update kong chart config (#8879)
* fix api endpoint type and update kong chart config * update ingress and cronjob api docs
1 parent f3ae9d2 commit 16df35e

File tree

4 files changed

+46
-31
lines changed

4 files changed

+46
-31
lines changed

charts/kubernetes-dashboard/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ metrics-server:
335335
## for our all containers.
336336
kong:
337337
enabled: true
338+
## Configuration reference: https://docs.konghq.com/gateway/3.6.x/reference/configuration
338339
env:
339340
dns_order: A,CNAME,LAST,SRV
341+
plugins: 'off'
342+
nginx_worker_processes: 1
340343
ingressController:
341344
enabled: false
342345
dblessConfig:

modules/api/pkg/handler/apihandler.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import (
6363
"k8s.io/dashboard/api/pkg/resource/role"
6464
"k8s.io/dashboard/api/pkg/resource/rolebinding"
6565
"k8s.io/dashboard/api/pkg/resource/secret"
66+
"k8s.io/dashboard/api/pkg/resource/service"
6667
resourceService "k8s.io/dashboard/api/pkg/resource/service"
6768
"k8s.io/dashboard/api/pkg/resource/serviceaccount"
6869
"k8s.io/dashboard/api/pkg/resource/statefulset"
@@ -258,8 +259,8 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
258259
Doc("returns a list of Services for ReplicaSet").
259260
Param(apiV1Ws.PathParameter("namespace", "namespace of the ReplicaSet")).
260261
Param(apiV1Ws.PathParameter("replicaSet", "name of the ReplicaSets")).
261-
Writes(pod.PodList{}).
262-
Returns(http.StatusOK, "OK", pod.PodList{}))
262+
Writes(service.ServiceList{}).
263+
Returns(http.StatusOK, "OK", service.ServiceList{}))
263264
apiV1Ws.Route(
264265
apiV1Ws.GET("/replicaset/{namespace}/{replicaSet}/event").To(apiHandler.handleGetReplicaSetEvents).
265266
// docs
@@ -551,6 +552,7 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
551552
Doc("returns a list of Jobs for CronJob").
552553
Param(apiV1Ws.PathParameter("namespace", "namespace of the CronJob")).
553554
Param(apiV1Ws.PathParameter("name", "name of the CronJob")).
555+
Param(apiV1Ws.QueryParameter("active", "filter related Jobs by active status")).
554556
Writes(job.JobList{}).
555557
Returns(http.StatusOK, "OK", job.JobList{}))
556558
apiV1Ws.Route(
@@ -777,7 +779,7 @@ func CreateHTTPAPIHandler(iManager integration.Manager) (*restful.Container, err
777779
// docs
778780
Doc("returns a list of Events for Ingress").
779781
Param(apiV1Ws.PathParameter("namespace", "namespace of the Ingress")).
780-
Param(apiV1Ws.PathParameter("name", "name of the Ingress")).
782+
Param(apiV1Ws.PathParameter("ingress", "name of the Ingress")).
781783
Writes(common.EventList{}).
782784
Returns(http.StatusOK, "OK", common.EventList{}))
783785

modules/api/schema/swagger.json

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,12 @@
19691969
"name": "name",
19701970
"in": "path",
19711971
"required": true
1972+
},
1973+
{
1974+
"type": "string",
1975+
"description": "filter related Jobs by active status",
1976+
"name": "active",
1977+
"in": "query"
19721978
}
19731979
],
19741980
"responses": {
@@ -3731,7 +3737,7 @@
37313737
{
37323738
"type": "string",
37333739
"description": "name of the Ingress",
3734-
"name": "name",
3740+
"name": "ingress",
37353741
"in": "path",
37363742
"required": true
37373743
}
@@ -6624,7 +6630,7 @@
66246630
"200": {
66256631
"description": "OK",
66266632
"schema": {
6627-
"$ref": "#/definitions/pod.PodList"
6633+
"$ref": "#/definitions/service.ServiceList"
66286634
}
66296635
}
66306636
}
@@ -9918,13 +9924,13 @@
99189924
},
99199925
"cronjob.CronJobDetail": {
99209926
"required": [
9921-
"containerImages",
99229927
"objectMeta",
99239928
"typeMeta",
99249929
"schedule",
99259930
"suspend",
99269931
"active",
99279932
"lastSchedule",
9933+
"containerImages",
99289934
"concurrencyPolicy",
99299935
"startingDeadlineSeconds",
99309936
"errors"
@@ -10049,11 +10055,11 @@
1004910055
},
1005010056
"daemonset.DaemonSetDetail": {
1005110057
"required": [
10058+
"objectMeta",
1005210059
"typeMeta",
1005310060
"podInfo",
1005410061
"containerImages",
1005510062
"initContainerImages",
10056-
"objectMeta",
1005710063
"errors"
1005810064
],
1005910065
"properties": {
@@ -10593,13 +10599,13 @@
1059310599
},
1059410600
"horizontalpodautoscaler.HorizontalPodAutoscalerDetail": {
1059510601
"required": [
10596-
"objectMeta",
1059710602
"typeMeta",
1059810603
"scaleTargetRef",
1059910604
"minReplicas",
1060010605
"maxReplicas",
1060110606
"currentCPUUtilizationPercentage",
1060210607
"targetCPUUtilizationPercentage",
10608+
"objectMeta",
1060310609
"currentReplicas",
1060410610
"desiredReplicas",
1060510611
"lastScaleTime"
@@ -10876,13 +10882,13 @@
1087610882
},
1087710883
"job.JobDetail": {
1087810884
"required": [
10879-
"initContainerImages",
10880-
"parallelism",
10881-
"jobStatus",
1088210885
"objectMeta",
1088310886
"typeMeta",
1088410887
"podInfo",
1088510888
"containerImages",
10889+
"initContainerImages",
10890+
"parallelism",
10891+
"jobStatus",
1088610892
"completions",
1088710893
"errors"
1088810894
],
@@ -11132,9 +11138,9 @@
1113211138
},
1113311139
"namespace.NamespaceDetail": {
1113411140
"required": [
11141+
"phase",
1113511142
"objectMeta",
1113611143
"typeMeta",
11137-
"phase",
1113811144
"resourceQuotaList",
1113911145
"resourceLimits",
1114011146
"errors"
@@ -11216,8 +11222,8 @@
1121611222
},
1121711223
"networkpolicy.NetworkPolicyDetail": {
1121811224
"required": [
11219-
"typeMeta",
1122011225
"objectMeta",
11226+
"typeMeta",
1122111227
"podSelector",
1122211228
"errors"
1122311229
],
@@ -11552,16 +11558,16 @@
1155211558
},
1155311559
"persistentvolume.PersistentVolumeDetail": {
1155411560
"required": [
11555-
"objectMeta",
1155611561
"capacity",
11557-
"storageClass",
11562+
"accessModes",
11563+
"mountOptions",
1155811564
"status",
11559-
"reason",
1156011565
"typeMeta",
11561-
"accessModes",
1156211566
"reclaimPolicy",
11563-
"mountOptions",
11567+
"storageClass",
1156411568
"claim",
11569+
"reason",
11570+
"objectMeta",
1156511571
"message",
1156611572
"persistentVolumeSource"
1156711573
],
@@ -11679,13 +11685,13 @@
1167911685
},
1168011686
"persistentvolumeclaim.PersistentVolumeClaimDetail": {
1168111687
"required": [
11682-
"storageClass",
11683-
"objectMeta",
11684-
"typeMeta",
1168511688
"status",
1168611689
"volume",
1168711690
"capacity",
11688-
"accessModes"
11691+
"accessModes",
11692+
"storageClass",
11693+
"objectMeta",
11694+
"typeMeta"
1168911695
],
1169011696
"properties": {
1169111697
"accessModes": {
@@ -12089,11 +12095,11 @@
1208912095
},
1209012096
"replicaset.ReplicaSetDetail": {
1209112097
"required": [
12098+
"initContainerImages",
1209212099
"objectMeta",
1209312100
"typeMeta",
1209412101
"podInfo",
1209512102
"containerImages",
12096-
"initContainerImages",
1209712103
"selector",
1209812104
"horizontalPodAutoscalerList",
1209912105
"errors"
@@ -12203,11 +12209,11 @@
1220312209
},
1220412210
"replicationcontroller.ReplicationControllerDetail": {
1220512211
"required": [
12206-
"containerImages",
12207-
"initContainerImages",
1220812212
"objectMeta",
1220912213
"typeMeta",
1221012214
"podInfo",
12215+
"containerImages",
12216+
"initContainerImages",
1221112217
"labelSelector",
1221212218
"errors"
1221312219
],
@@ -12410,8 +12416,8 @@
1241012416
},
1241112417
"role.RoleDetail": {
1241212418
"required": [
12413-
"objectMeta",
1241412419
"typeMeta",
12420+
"objectMeta",
1241512421
"rules",
1241612422
"errors"
1241712423
],
@@ -13028,12 +13034,12 @@
1302813034
},
1302913035
"types.CustomResourceDefinitionDetail": {
1303013036
"required": [
13037+
"objectMeta",
13038+
"typeMeta",
1303113039
"group",
1303213040
"scope",
1303313041
"names",
1303413042
"established",
13035-
"objectMeta",
13036-
"typeMeta",
1303713043
"conditions",
1303813044
"objects",
1303913045
"subresources",

modules/web/schema/schema.graphql

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ type Query {
346346
metricNames: String
347347
"""Aggregations to be performed for each metric (default: sum)"""
348348
aggregations: String
349-
): 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\"}")
349+
"""filter related Jobs by active status"""
350+
active: String
351+
): 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\"}")
350352
"""generates a one-time CSRF token that can be used by POST request"""
351353
handleGetCsrfToken(
352354
"""action name to generate CSRF token for"""
@@ -654,6 +656,8 @@ type Query {
654656
handleGetIngressEvent(
655657
"""namespace of the Ingress"""
656658
namespace: String!
659+
"""name of the Ingress"""
660+
ingress: String!
657661
"""
658662
Comma delimited string used to apply filtering: 'propertyName,filterValue'
659663
"""
@@ -668,7 +672,7 @@ type Query {
668672
metricNames: String
669673
"""Aggregations to be performed for each metric (default: sum)"""
670674
aggregations: String
671-
): 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\"}")
675+
): 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\"}")
672676
"""returns detailed information about Ingress"""
673677
handleGetIngressDetail(
674678
"""namespace of the Ingress"""
@@ -1366,7 +1370,7 @@ type Query {
13661370
metricNames: String
13671371
"""Aggregations to be performed for each metric (default: sum)"""
13681372
aggregations: String
1369-
): 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\"}")
1373+
): 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\"}")
13701374
"""returns a list of ReplicationController in a namespace"""
13711375
handleGetReplicationControllerList(
13721376
"""

0 commit comments

Comments
 (0)