From 7c99865c9454db7b2e77208dc820e60ac2e3ec53 Mon Sep 17 00:00:00 2001 From: nikhiljindal Date: Tue, 28 Apr 2015 18:19:15 -0700 Subject: [PATCH] Fixing hooks/description to catch API fields without description tags --- hooks/description.sh | 2 +- pkg/api/v1/types.go | 36 ++++++++++++++++++------------------ pkg/api/v1beta3/types.go | 18 +++++++++--------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hooks/description.sh b/hooks/description.sh index 5a027d67af5..df7edf234d4 100755 --- a/hooks/description.sh +++ b/hooks/description.sh @@ -17,7 +17,7 @@ # Print 1 if the file in $1 is not in need of additional field descriptions, 0 otherwise. FILE="$1" -if grep json: "${FILE}" | grep -v ,inline | grep -v -q description: | grep -v // ; then +if grep json: "${FILE}" | grep -v // | grep -v ,inline | grep -v -q description: ; then echo "0" else echo "1" diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index e162cbf1a07..525514777a1 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -251,7 +251,7 @@ type PersistentVolumeSource struct { type PersistentVolume struct { TypeMeta `json:",inline"` - ObjectMeta `json:"metadata,omitempty"` + ObjectMeta `json:"metadata,omitempty" description:"standard object metadata; see http://docs.k8s.io/api-conventions.md#metadata"` //Spec defines a persistent volume owned by the cluster Spec PersistentVolumeSpec `json:"spec,omitempty" description:"specification of a persistent volume as provisioned by an administrator"` @@ -278,14 +278,14 @@ type PersistentVolumeStatus struct { type PersistentVolumeList struct { TypeMeta `json:",inline"` - ListMeta `json:"metadata,omitempty"` + ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://docs.k8s.io/api-conventions.md#types-kinds` Items []PersistentVolume `json:"items,omitempty" description:"list of persistent volumes"` } // PersistentVolumeClaim is a user's request for and claim to a persistent volume type PersistentVolumeClaim struct { TypeMeta `json:",inline"` - ObjectMeta `json:"metadata,omitempty"` + ObjectMeta `json:"metadata,omitempty" description:"standard object metadata; see http://docs.k8s.io/api-conventions.md#metadata"` // Spec defines the volume requested by a pod author Spec PersistentVolumeClaimSpec `json:"spec,omitempty" description: "the desired characteristics of a volume"` @@ -296,7 +296,7 @@ type PersistentVolumeClaim struct { type PersistentVolumeClaimList struct { TypeMeta `json:",inline"` - ListMeta `json:"metadata,omitempty"` + ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://docs.k8s.io/api-conventions.md#types-kinds` Items []PersistentVolumeClaim `json:"items,omitempty" description: "a list of persistent volume claims"` } @@ -519,25 +519,25 @@ type VolumeMount struct { type EnvVar struct { // Required: This must be a C_IDENTIFIER. Name string `json:"name" description:"name of the environment variable; must be a C_IDENTIFIER"` - // Optional: defaults to "". + // Optional: No more than one of the following may be set. + // Optional: Defaults to "" Value string `json:"value,omitempty" description:"value of the environment variable; defaults to empty string"` - // Optional: specify a source the value of this var should come from. + // Optional: Specifies a source the value of this var should come from. ValueFrom *EnvVarSource `json:"valueFrom,omitempty" description:"source for the environment variable's value; cannot be used if value is not empty"` } // EnvVarSource represents a source for the value of an EnvVar. -// Only one of its members may be specified. type EnvVarSource struct { - // Selects a field of the pod; only name and namespace are supported. - FieldPath *ObjectFieldSelector `json:"fieldPath,omitempty" description:"selects a field of the pod; only name and namespace are supported"` + // Required: Selects a field of the pod; only name and namespace are supported. + FieldPath *ObjectFieldSelector `json:"fieldPath" description:"selects a field of the pod; only name and namespace are supported"` } // ObjectFieldSelector selects an APIVersioned field of an object. type ObjectFieldSelector struct { - // The API version the FieldPath is written in terms of. - APIVersion string `json:"apiVersion,omitempty" description="The API version that FieldPath is written in terms of"` - // The path of the field to select in the specified API version - FieldPath string `json:"fieldPath,omitempty" description="The path of the field to select in the specified API version"` + // Optional: Version of the schema the FieldPath is written in terms of, defaults to "v1" + APIVersion string `json:"apiVersion,omitempty" description:"version of the schema that fieldPath is written in terms of; defaults to v1"` + // Required: Path of the field to select in the specified API version + FieldPath string `json:"fieldPath" description:"path of the field to select in the specified API version"` } // HTTPGetAction describes an action based on HTTP Get requests. @@ -1101,9 +1101,9 @@ type NodeSpec struct { // NodeSystemInfo is a set of ids/uuids to uniquely identify the node. type NodeSystemInfo struct { // MachineID is the machine-id reported by the node - MachineID string `json:"machineID"` + MachineID string `json:"machineID" description:"machine-id reported by the node"` // SystemUUID is the system-uuid reported by the node - SystemUUID string `json:"systemUUID"` + SystemUUID string `json:"systemUUID" description:"system-uuid reported by the node"` // BootID is the boot-id reported by the node BootID string `json:"bootID" description:"boot id is the boot-id reported by the node"` // Kernel version reported by the node @@ -1130,7 +1130,7 @@ type NodeStatus struct { // Queried from cloud provider, if available. Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node" patchStrategy:"merge" patchMergeKey:"type"` // NodeSystemInfo is a set of ids/uuids to uniquely identify the node - NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"` + NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" description:"set of ids/uuids to uniquely identify the node"` } type NodePhase string @@ -1174,8 +1174,8 @@ const ( ) type NodeAddress struct { - Type NodeAddressType `json:"type"` - Address string `json:"address"` + Type NodeAddressType `json:"type" description:"node address type, one of Hostname, ExternalIP or InternalIP"` + Address string `json:"address" description:"the node address"` } // ResourceName is the name identifying various resources in a ResourceList. diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index a9f8d162496..48fc3d4cb21 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -251,7 +251,7 @@ type PersistentVolumeSource struct { type PersistentVolume struct { TypeMeta `json:",inline"` - ObjectMeta `json:"metadata,omitempty"` + ObjectMeta `json:"metadata,omitempty" description:"standard object metadata; see http://docs.k8s.io/api-conventions.md#metadata"` //Spec defines a persistent volume owned by the cluster Spec PersistentVolumeSpec `json:"spec,omitempty" description:"specification of a persistent volume as provisioned by an administrator"` @@ -278,14 +278,14 @@ type PersistentVolumeStatus struct { type PersistentVolumeList struct { TypeMeta `json:",inline"` - ListMeta `json:"metadata,omitempty"` + ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://docs.k8s.io/api-conventions.md#types-kinds` Items []PersistentVolume `json:"items,omitempty" description:"list of persistent volumes"` } // PersistentVolumeClaim is a user's request for and claim to a persistent volume type PersistentVolumeClaim struct { TypeMeta `json:",inline"` - ObjectMeta `json:"metadata,omitempty"` + ObjectMeta `json:"metadata,omitempty" description:"standard object metadata; see http://docs.k8s.io/api-conventions.md#metadata"` // Spec defines the volume requested by a pod author Spec PersistentVolumeClaimSpec `json:"spec,omitempty" description: "the desired characteristics of a volume"` @@ -296,7 +296,7 @@ type PersistentVolumeClaim struct { type PersistentVolumeClaimList struct { TypeMeta `json:",inline"` - ListMeta `json:"metadata,omitempty"` + ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://docs.k8s.io/api-conventions.md#types-kinds` Items []PersistentVolumeClaim `json:"items,omitempty" description: "a list of persistent volume claims"` } @@ -1101,9 +1101,9 @@ type NodeSpec struct { // NodeSystemInfo is a set of ids/uuids to uniquely identify the node. type NodeSystemInfo struct { // MachineID is the machine-id reported by the node - MachineID string `json:"machineID"` + MachineID string `json:"machineID" description:"machine-id reported by the node"` // SystemUUID is the system-uuid reported by the node - SystemUUID string `json:"systemUUID"` + SystemUUID string `json:"systemUUID" description:"system-uuid reported by the node"` // BootID is the boot-id reported by the node BootID string `json:"bootID" description:"boot id is the boot-id reported by the node"` // Kernel version reported by the node @@ -1130,7 +1130,7 @@ type NodeStatus struct { // Queried from cloud provider, if available. Addresses []NodeAddress `json:"addresses,omitempty" description:"list of addresses reachable to the node" patchStrategy:"merge" patchMergeKey:"type"` // NodeSystemInfo is a set of ids/uuids to uniquely identify the node - NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"` + NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty" description:"set of ids/uuids to uniquely identify the node"` } type NodePhase string @@ -1174,8 +1174,8 @@ const ( ) type NodeAddress struct { - Type NodeAddressType `json:"type"` - Address string `json:"address"` + Type NodeAddressType `json:"type" description:"node address type, one of Hostname, ExternalIP or InternalIP"` + Address string `json:"address" description:"the node address"` } // ResourceName is the name identifying various resources in a ResourceList.