Stop supporting the minion alias for nodes in kubectl

This commit is contained in:
Jeff Lowdermilk 2015-05-29 15:40:47 -07:00
parent a026ca40f8
commit 0c44be833d
5 changed files with 19 additions and 14 deletions

View File

@ -9,7 +9,7 @@ Display one or many resources.
Possible resources include pods (po), replication controllers (rc), services
(svc), nodes, events (ev), component statuses (cs), limit ranges (limits),
minions (mi), persistent volumes (pv), persistent volume claims (pvc)
nodes (no), persistent volumes (pv), persistent volume claims (pvc)
or resource quotas (quota).
By specifying the output as 'template' and providing a Go template as the value
@ -87,6 +87,6 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7
### SEE ALSO
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-05-28 22:43:52.329286408 +0000 UTC
###### Auto generated by spf13/cobra at 2015-05-29 22:39:51.164275749 +0000 UTC
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/kubectl_get.md?pixel)]()

View File

@ -18,7 +18,7 @@ Display one or many resources.
.PP
Possible resources include pods (po), replication controllers (rc), services
(svc), nodes, events (ev), component statuses (cs), limit ranges (limits),
minions (mi), persistent volumes (pv), persistent volume claims (pvc)
nodes (no), persistent volumes (pv), persistent volume claims (pvc)
or resource quotas (quota).
.PP

View File

@ -124,14 +124,14 @@ for version in "${kube_api_versions[@]}"; do
-s "http://127.0.0.1:${API_PORT}"
--match-server-version
)
[ "$(kubectl get minions -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ]
[ "$(kubectl get nodes -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ]
else
kube_flags=(
-s "http://127.0.0.1:${API_PORT}"
--match-server-version
--api-version="${version}"
)
[ "$(kubectl get minions -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "${version}" ]
[ "$(kubectl get nodes -t '{{ .apiVersion }}' "${kube_flags[@]}")" == "${version}" ]
fi
id_field=".metadata.name"
labels_field=".metadata.labels"
@ -630,18 +630,17 @@ __EOF__
###########
# Minions #
# Nodes #
###########
if [[ "${version}" = "v1beta1" ]] || [[ "${version}" = "v1beta2" ]]; then
kube::log::status "Testing kubectl(${version}:minions)"
kube::log::status "Testing kubectl(${version}:nodes)"
kube::test::get_object_assert minions "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
# TODO: I should be a MinionList instead of List
kube::test::get_object_assert minions '{{.kind}}' 'List'
kube::test::get_object_assert nodes '{{.kind}}' 'List'
kube::test::describe_object_assert minions "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
fi

View File

@ -33,7 +33,7 @@ const (
Possible resources include pods (po), replication controllers (rc), services
(svc), nodes, events (ev), component statuses (cs), limit ranges (limits),
minions (mi), persistent volumes (pv), persistent volume claims (pvc)
nodes (no), persistent volumes (pv), persistent volume claims (pvc)
or resource quotas (quota).
By specifying the output as 'template' and providing a Go template as the value

View File

@ -18,6 +18,7 @@ limitations under the License.
package kubectl
import (
"fmt"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
@ -88,7 +89,12 @@ type ShortcutExpander struct {
// mapper.
func (e ShortcutExpander) VersionAndKindForResource(resource string) (defaultVersion, kind string, err error) {
resource = expandResourceShortcut(resource)
return e.RESTMapper.VersionAndKindForResource(resource)
defaultVersion, kind, err = e.RESTMapper.VersionAndKindForResource(resource)
// TODO: remove this once v1beta1 and v1beta2 are deprecated
if err == nil && kind == "Minion" {
err = fmt.Errorf("Alias minion(s) is deprecated. Use node(s) instead")
}
return defaultVersion, kind, err
}
// expandResourceShortcut will return the expanded version of resource
@ -100,7 +106,7 @@ func expandResourceShortcut(resource string) string {
"cs": "componentstatuses",
"ev": "events",
"limits": "limitRanges",
"mi": "minions",
"no": "nodes",
"po": "pods",
"pv": "persistentVolumes",
"pvc": "persistentVolumeClaims",