Is your feature request related to a problem? Please describe.
Currently there is no option to see the description of fields using standard kubectl functionality:
kubectl explain gameservers.agones.dev
error: Couldn't find resource for "agones.dev/v1, Kind=GameServer"
Describe the solution you'd like
Output should be similar to this:
kubectl explain pods
KIND: Pod
VERSION: v1
DESCRIPTION:
Pod is a collection of containers that can run on a host. This resource is
created by clients and scheduled onto hosts.
It seems that we could update apiserver.go code to serve requests of this kind.
Describe alternatives you've considered
Additional context
I think this is an issue of openapi spec not existing for CRDs. Based on https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/00xx-publish-crd-openapi.md it looks like once we update to 1.14 (or maybe later) this should "just work." It would be worth testing against a later k8s cluster to see what the behavior is.
Partially fixed in Kubernetes 1.16:
kubectl explain fleet
KIND: Fleet
VERSION: agones.dev/v1
DESCRIPTION:
<empty>
So what left is to understand where to put a description.
I was able to fix output of kubectl explain for gameserverallocationpolicies.multicluster.agones.dev.
CRD extension has been promoted to v1. We have some changes to consider, e.g
spec.validationis removed; usespec.versions[*].schemainstead
spec.validation was switched to spec.versions.schema and apiextensions.k8s.io to v1 and added type: object root element in validation schema field.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
component: crd
app: agones
chart: agones-1.8.0
release: agones-manual
heritage: Helm
name: gameserverallocationpolicies.multicluster.agones.dev
spec:
group: multicluster.agones.dev
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
connectionInfo:
properties:
secretName:
type: string
serverCa:
type: string
format: byte
allocationEndpoints:
items:
type: string
type: array
minItems: 1
clusterName:
type: string
namespace:
type: string
required:
- namespace
type: object
priority:
format: int32
minimum: 0
type: integer
weight:
format: int64
minimum: 0
type: integer
required:
- priority
- weight
type: object
- name: v1alpha1
# Disable the v1alpha1 version, but include it for inplace upgrade.
served: false
storage: false
schema:
openAPIV3Schema:
type: object
names:
kind: GameServerAllocationPolicy
plural: gameserverallocationpolicies
scope: Namespaced
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
We have schemas now for everything - I wonder what the output is now. Could be good to test.
Most helpful comment
I think this is an issue of openapi spec not existing for CRDs. Based on https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/00xx-publish-crd-openapi.md it looks like once we update to 1.14 (or maybe later) this should "just work." It would be worth testing against a later k8s cluster to see what the behavior is.