Skip to content

Commit f6875c7

Browse files
authored
feat(api-server): add shortName field to /_resources endpoint response (#14506)
1 parent dcb45e3 commit f6875c7

File tree

5 files changed

+66
-5
lines changed

5 files changed

+66
-5
lines changed

api/openapi/specs/common/resource.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ components:
33
ResourceTypeDescription:
44
description: Description of a resource type, this is useful for dynamically generated clients and the gui
55
type: object
6-
required: [name, scope, readOnly, path, singularDisplayName, pluralDisplayName, includeInFederation]
6+
required: [name, scope, readOnly, path, singularDisplayName, pluralDisplayName, includeInFederation, shortName]
77
properties:
88
name:
99
description: the name of the resource type
@@ -20,6 +20,9 @@ components:
2020
type: string
2121
pluralDisplayName:
2222
type: string
23+
shortName:
24+
description: the short name of the resource type used in KRIs and kubectl
25+
type: string
2326
includeInFederation:
2427
description: description resources of this type should be included in federetion-with-policies export profile (especially useful for moving from non-federated to federated or migrating to a new global).
2528
type: boolean

api/openapi/types/common/zz_generated.resource.go

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/generated/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4256,6 +4256,7 @@ components:
42564256
- singularDisplayName
42574257
- pluralDisplayName
42584258
- includeInFederation
4259+
- shortName
42594260
properties:
42604261
name:
42614262
description: the name of the resource type
@@ -4276,6 +4277,9 @@ components:
42764277
type: string
42774278
pluralDisplayName:
42784279
type: string
4280+
shortName:
4281+
description: the short name of the resource type used in KRIs and kubectl
4282+
type: string
42794283
includeInFederation:
42804284
description: >-
42814285
description resources of this type should be included in

pkg/api-server/mappers/resource_type_description.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func MapResourceTypeDescription(defs []model.ResourceTypeDescriptor, readOnly bo
1818
SingularDisplayName: def.SingularDisplayName,
1919
PluralDisplayName: def.PluralDisplayName,
2020
Scope: api_common.ResourceTypeDescriptionScope(def.Scope),
21+
ShortName: def.ShortName,
2122
// Things in the federation export should be:
2223
// 1. not system managed .i.e: not ReadOnly (ServiceInsight for example is like this)
2324
// 2. have KDS from global to zone

0 commit comments

Comments
 (0)