Improve describe for LimitRange resource based on user feedback
This commit is contained in:
		@@ -95,12 +95,12 @@ Let's describe the limits that we have imposed in our namespace.
 | 
				
			|||||||
$ kubectl describe limits mylimits --namespace=limit-example
 | 
					$ kubectl describe limits mylimits --namespace=limit-example
 | 
				
			||||||
Name:   mylimits
 | 
					Name:   mylimits
 | 
				
			||||||
Namespace:  limit-example
 | 
					Namespace:  limit-example
 | 
				
			||||||
Type        Resource      Min      Max      Request      Limit      Limit/Request
 | 
					Type        Resource      Min      Max      Default Request      Default Limit      Max Limit/Request Ratio
 | 
				
			||||||
----        --------      ---      ---      -------      -----      -------------
 | 
					----        --------      ---      ---      ---------------      -------------      -----------------------
 | 
				
			||||||
Pod         cpu           200m     2        -            -          -
 | 
					Pod         cpu           200m     2        -                    -                  -
 | 
				
			||||||
Pod         memory        6Mi      1Gi      -            -          -
 | 
					Pod         memory        6Mi      1Gi      -                    -                  -
 | 
				
			||||||
Container   cpu           100m     2        200m         300m       -
 | 
					Container   cpu           100m     2        200m                 300m               -
 | 
				
			||||||
Container   memory        3Mi      1Gi      100Mi        200Mi      -
 | 
					Container   memory        3Mi      1Gi      100Mi                200Mi              -
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In this scenario, we have said the following:
 | 
					In this scenario, we have said the following:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,10 +142,10 @@ limitrange "limits" created
 | 
				
			|||||||
$ kubectl describe limits limits --namespace=quota-example
 | 
					$ kubectl describe limits limits --namespace=quota-example
 | 
				
			||||||
Name:		limits
 | 
					Name:		limits
 | 
				
			||||||
Namespace:	quota-example
 | 
					Namespace:	quota-example
 | 
				
			||||||
Type		Resource	Min	Max	Request	Limit	Limit/Request
 | 
					Type        Resource      Min      Max      Default Request      Default Limit      Max Limit/Request Ratio
 | 
				
			||||||
----		--------	---	---	-------	-----	-------------
 | 
					----        --------      ---      ---      ---------------      -------------      -----------------------
 | 
				
			||||||
Container	memory		-	-	256Mi	512Mi	-
 | 
					Container	  memory    		-	       -      	256Mi                512Mi             	-
 | 
				
			||||||
Container	cpu		-	-	100m	200m	-
 | 
					Container	  cpu       		-	       -      	100m                 200m             	-
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Now any time a pod is created in this namespace, if it has not specified any resource request/limit, the default
 | 
					Now any time a pod is created in this namespace, if it has not specified any resource request/limit, the default
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -187,8 +187,8 @@ func DescribeLimitRanges(limitRanges *api.LimitRangeList, w io.Writer) {
 | 
				
			|||||||
		fmt.Fprint(w, "No resource limits.\n")
 | 
							fmt.Fprint(w, "No resource limits.\n")
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fmt.Fprintf(w, "Resource Limits\n Type\tResource\tMin\tMax\tRequest\tLimit\tLimit/Request\n")
 | 
						fmt.Fprintf(w, "Resource Limits\n Type\tResource\tMin\tMax\tDefault Request\tDefault Limit\tMax Limit/Request Ratio\n")
 | 
				
			||||||
	fmt.Fprintf(w, " ----\t--------\t---\t---\t-------\t-----\t-------------\n")
 | 
						fmt.Fprintf(w, " ----\t--------\t---\t---\t---------------\t-------------\t-----------------------\n")
 | 
				
			||||||
	for _, limitRange := range limitRanges.Items {
 | 
						for _, limitRange := range limitRanges.Items {
 | 
				
			||||||
		for i := range limitRange.Spec.Limits {
 | 
							for i := range limitRange.Spec.Limits {
 | 
				
			||||||
			item := limitRange.Spec.Limits[i]
 | 
								item := limitRange.Spec.Limits[i]
 | 
				
			||||||
@@ -312,8 +312,8 @@ func describeLimitRange(limitRange *api.LimitRange) (string, error) {
 | 
				
			|||||||
	return tabbedString(func(out io.Writer) error {
 | 
						return tabbedString(func(out io.Writer) error {
 | 
				
			||||||
		fmt.Fprintf(out, "Name:\t%s\n", limitRange.Name)
 | 
							fmt.Fprintf(out, "Name:\t%s\n", limitRange.Name)
 | 
				
			||||||
		fmt.Fprintf(out, "Namespace:\t%s\n", limitRange.Namespace)
 | 
							fmt.Fprintf(out, "Namespace:\t%s\n", limitRange.Namespace)
 | 
				
			||||||
		fmt.Fprintf(out, "Type\tResource\tMin\tMax\tRequest\tLimit\tLimit/Request\n")
 | 
							fmt.Fprintf(out, "Type\tResource\tMin\tMax\tDefault Request\tDefault Limit\tMax Limit/Request Ratio\n")
 | 
				
			||||||
		fmt.Fprintf(out, "----\t--------\t---\t---\t-------\t-----\t-------------\n")
 | 
							fmt.Fprintf(out, "----\t--------\t---\t---\t---------------\t-------------\t-----------------------\n")
 | 
				
			||||||
		for i := range limitRange.Spec.Limits {
 | 
							for i := range limitRange.Spec.Limits {
 | 
				
			||||||
			item := limitRange.Spec.Limits[i]
 | 
								item := limitRange.Spec.Limits[i]
 | 
				
			||||||
			maxResources := item.Max
 | 
								maxResources := item.Max
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user