Commit Graph

60 Commits

Author SHA1 Message Date
Li Bo 1d8a42052c fix problem that NewReplicaSet shows <none> when describing deployments
Kubernetes-commit: a286455a3e230eb1373002b302669c6999c949f1
2021-01-06 11:05:31 +08:00
Hidetatsu Yaginuma 0668abe1cd fix invalid indentation
Kubernetes-commit: f00f114ecaca6065be0cbc4c16c670370e202b1a
2021-01-12 13:02:52 +09:00
shahra 1588007e10 Change pvc describe test
Kubernetes-commit: ff6711140a2319faee57580143a504a3e5adfbf0
2020-10-26 10:49:48 -07:00
shahra 7342d00241 Alter wording to describe pods using a pvc
Kubernetes-commit: bcff03f7d21305a613c7cbfde3143daf6a1d8546
2020-10-14 20:53:10 -07:00
Khaled Henidak (Kal) 2bf7244939 dual stack services (#91824)
* api: structure change

* api: defaulting, conversion, and validation

* [FIX] validation: auto remove second ip/family when service changes to SingleStack

* [FIX] api: defaulting, conversion, and validation

* api-server: clusterIPs alloc, printers, storage and strategy

* [FIX] clusterIPs default on read

* alloc: auto remove second ip/family when service changes to SingleStack

* api-server: repair loop handling for clusterIPs

* api-server: force kubernetes default service into single stack

* api-server: tie dualstack feature flag with endpoint feature flag

* controller-manager: feature flag, endpoint, and endpointSlice controllers handling multi family service

* [FIX] controller-manager: feature flag, endpoint, and endpointSlicecontrollers handling multi family service

* kube-proxy: feature-flag, utils, proxier, and meta proxier

* [FIX] kubeproxy: call both proxier at the same time

* kubenet: remove forced pod IP sorting

* kubectl: modify describe to include ClusterIPs, IPFamilies, and IPFamilyPolicy

* e2e: fix tests that depends on IPFamily field AND add dual stack tests

* e2e: fix expected error message for ClusterIP immutability

* add integration tests for dualstack

the third phase of dual stack is a very complex change in the API,
basically it introduces Dual Stack services. Main changes are:

- It pluralizes the Service IPFamily field to IPFamilies,
and removes the singular field.
- It introduces a new field IPFamilyPolicyType that can take
3 values to express the "dual-stack(mad)ness" of the cluster:
SingleStack, PreferDualStack and RequireDualStack
- It pluralizes ClusterIP to ClusterIPs.

The goal is to add coverage to the services API operations,
taking into account the 6 different modes a cluster can have:

- single stack: IP4 or IPv6 (as of today)
- dual stack: IPv4 only, IPv6 only, IPv4 - IPv6, IPv6 - IPv4

* [FIX] add integration tests for dualstack

* generated data

* generated files

Co-authored-by: Antonio Ojea <aojea@redhat.com>

Kubernetes-commit: 6675eba3eff1c8e565c4060a9c1396f75da7cc3e
2020-10-26 20:46:34 +00:00
Arjun Naik b8a1016326 Added functionality and API for pod autoscaling based on container resources
Signed-off-by: Arjun Naik <anaik@redhat.com>

Kubernetes-commit: 0fec7b0f7e2dfd4b0c6c57e086472546f6c69efa
2020-10-21 11:29:17 +02:00
Quan Tian 81f5e57cae kubectl: add a space between effect and operator when printing tolerations
Empty key and non-empty effect means to match all keys and values and
the specified effect. However "kubectl describe" prints it without space
between effect and operator. This patch adds the space for this case.

Kubernetes-commit: 04185f4e533b9b8ebaabe1ed09516e85c5ed1ae1
2020-09-21 23:45:31 +08:00
John Howard 5a3ba07822 Fix `kubectl describe ingress` format
Fixes https://github.com/kubernetes/kubernetes/issues/94980

Fixes two formatting issues:
* Un-opened parenthesis (`10.244.0.6:8080)`)
* Bad format string and spacing

Before this PR:
```
Name:             example-ingress
Namespace:        default
Address:
Default backend:  istio-ingressgateway:80 (<error: endpoints "istio-ingressgateway" not found>)
Rules:
  Host                                                                                                      Path  Backends
  ----                                                                                                      ----  --------
                                                                                                            * *
%!(EXTRA string=istio-ingressgateway:80 (<error: endpoints "istio-ingressgateway" not found>))Annotations:  <none>
Events:                                                                                                     <none>
```

After this PR:
```
Name:             example-ingress
Namespace:        default
Address:
Default backend:  istio-ingressgateway:80 (<error: endpoints "istio-ingressgateway" not found>)
Rules:
  Host        Path  Backends
  ----        ----  --------
  *           *     istio-ingressgateway:80 (<error: endpoints "istio-ingressgateway" not found>)
Annotations:  <none>
Events:       <none>
```

Compare to an old kubectl without the bug:
```
Name:             example-ingress
Namespace:        default
Address:
Default backend:  istio-ingressgateway:80 (<none>)
Rules:
  Host  Path  Backends
  ----  ----  --------
  *     *     istio-ingressgateway:80 (<none>)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration: ...

Events:  <none>
```

Kubernetes-commit: 9a0b9138aff179e601f854c70271a50842742b12
2020-09-22 13:29:11 -07:00
Jan Chaloupka 81135b09fa kubectl describe pod: use ReportingController as an event source
With https://github.com/kubernetes/kubernetes/pull/91645 merged (promotion of v1beta1 events to v1),
it's no longer permitted to set Source field.
Based on https://stupefied-goodall-e282f7.netlify.app/contributors/design-proposals/instrumentation/events-redesign/#backward-compatibility
Source.Component is supposed to be replaced by ReportingController.
Source.Host is supposed to be replaced by DeprecatedHost, though DeprecatedHost
was never implemented. Thus, ignoring the second field.

Kubernetes-commit: 71edf075de3ea0e26aa40f06f1670862aaebcf33
2020-08-04 18:10:34 +02:00
jingxueli 1cf6fb3a8f add line break when describe hpa
Kubernetes-commit: 1bfd6ed6ec7478038fd3dd9839ac7e7a3bab46fb
2020-06-18 20:40:54 +08:00
Abhishek Raut 05cb9b1f24 Fix NetworkPolicy describe for egress-all policies
NetworkPolicy egress-all `kubectl describe` output should refer
to the term "destination" as opposed to "source" for describing
policies which do not restrict traffic based on the destination.

Kubernetes-commit: e0caf0b46f061c3fafa10aef83592fe300f2bf52
2020-07-15 18:58:25 -07:00
Patrick Ohly 953fac2d9a GenericEphemeralVolume: kubectl describe
This reuses the code for describing a PVC, except that the output gets
indented more and some fields are skipped.

Kubernetes-commit: c1178bd925b54898e66cace37d35bf551380a75b
2020-07-03 12:09:34 +02:00
Christopher M. Luciano c87f320efb ingress: Add v1 describers for Ingress and IngressClass
Ingressv1 Get is attempted for Ingresses and IngressClasses
and falls back to Ingressv1beta1 if there is a failure.

Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>

Kubernetes-commit: 31520ccb9b9a96acc4721b69ae231a6cbb74a503
2020-05-19 16:34:34 -04:00
Jordan Liggitt cd341c1697 Add v1 CSR support to kubectl describe
Kubernetes-commit: 92a665e83f223425608e38286fdf147acb85112d
2020-06-04 12:05:51 -04:00
Yashpal Choudhary ee2d0387c2 Fix kubectl describe output format for empty annotations
Kubernetes-commit: 73a43f35f5c44e861eeb03353e372942e7e03761
2020-05-25 14:03:20 +05:30
Jordan Liggitt be12c7c870 Print and describe failed CSRs
Kubernetes-commit: 6b61cb290786688e3f994f4776f3a672c8f30fbb
2020-04-16 01:05:46 -04:00
Oleg Atamanenko 22e383f0f9 Ignore forbidden error for leases when describing node
Kubernetes-commit: 8aa0df4a74e987f8d0f67e71e2327efbdfd04814
2020-04-24 12:59:41 -07:00
Davanum Srinivas 445ad1366b switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Jan Chaloupka 50e4974848 kubectl describe: print toleration tolerating everything
An empty key with operator Exists matches all keys, values
and effects which means this will tolerate everything:
tolerations:
- operator: "Exists"

as stated in https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/.

However, the current printTolerationsMultilineWithIndent implementation ignores
this case. As the toleration is valid, there's no reason
to skip it when writing the list of all pod's tolerations.

Kubernetes-commit: 0bd9a4c6c5ba4fbbc8439effddc99004ddd6b232
2020-05-12 15:59:52 +02:00
gosoon d47103fdcc kubectl: fix the Scheduled eventTime is <unknown> when use kubectl describe pod xxx
Kubernetes-commit: 798f677aaca0b28f22c09ba6b536c84bec6f5d2f
2020-04-17 19:58:27 +08:00
zhouya0 9e97ec383e Fix kubectl describe job event test nil pointer
Kubernetes-commit: a576a3c7070c9aeb1da1878e0ca956190979f03a
2020-03-27 19:07:18 +08:00
zhouya0 ff83e52b28 Add kubectl describe CSINode test coverage
Kubernetes-commit: 991547edb6bc5d9302034fbb94b97204ea951348
2020-03-31 12:15:20 +08:00
zhouya0 6bc21dccc3 Fix kubectl describe CSINode nil pointer error
Kubernetes-commit: 55c455e61f6f1e52337e04eeb4ebd41668ffef17
2020-03-30 17:10:40 +08:00
Jordan Liggitt 0c62c9a83a client-go dynamic client: add context to callers
Kubernetes-commit: b7c2faf26c2a25427794478c6265e6d55e8acb5a
2020-03-06 10:17:41 -05:00
zhouya0 3422a4e85e Show kubectl describe ingress error
Kubernetes-commit: 773b890b059ffe9956c8de4b7f0214b802888390
2020-03-02 16:08:17 +08:00
Maciej Szulik e034e09126 Squash pkg/describe/versioned/ into pkg/describe/
Kubernetes-commit: 02cd65d7bb5e4aea84a4f466186bcbbe604c4b27
2020-03-03 13:06:26 +01:00
Maciej Szulik f2e2579863 Hide kubectl.kubernetes.io/last-applied-configuration in describe
Kubernetes-commit: c77b297babc6b21b71f2a449c4cce95af9f6b89e
2020-03-03 12:54:00 +01:00
Rob Scott 9212fa917c Adding IngressClass to networking/v1beta1
Co-authored-by: Christopher M. Luciano <cmluciano@us.ibm.com>

Kubernetes-commit: 132d2afca0794b4bcaedb6dbbefe4e9d66e80239
2020-02-24 21:20:45 -08:00
James Munnelly 15819eb467 Add signerName field to CSR resource spec
Signed-off-by: James Munnelly <james.munnelly@jetstack.io>

Kubernetes-commit: a983356caa9876079eafc5e8dd7806473022e958
2019-12-18 02:19:06 +00:00
zhouya0 de11036690 Fix kubectl describe ingress annotations not sorted
Kubernetes-commit: 0acaf5c3e93cc3422aca47eeea96e9ef553ac35c
2020-02-21 11:02:40 +08:00
Odin Ugedal 6db3ac62f1 Add util function to merge resource lists
Kubernetes-commit: 51bff87b18d6482f7383fb2151c7e483a1641ca7
2019-12-14 20:33:35 +01:00
Odin Ugedal 8f16a43328 Add "kubectl describe node" resource tests
Kubernetes-commit: 28f8e52f320595fd434a2699850e57bc297474a4
2019-12-14 13:24:18 +01:00
Odin Ugedal d62698570f Add huge page usage stats to kubectl describe node
Kubernetes-commit: 439a862bba60f05fb21338bfa02e547428c6ce0c
2019-07-25 22:14:35 +02:00
gavinfish 275513cb52 Staticcheck: vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top
Kubernetes-commit: f4940cf55fd7c2787b370464d491a764c4febd78
2020-01-21 10:13:10 +08:00
Mike Danese 71d8052cb0 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Philipp Stehle 78fe2274ad Fix describe of statefulset prints pointer not value
Kubernetes-commit: 772dbbc7d78c909fa68fc5218886a2b517c94ca2
2019-12-03 14:33:31 +01:00
Christian Huffman f9e7f47c2e Included CSINode describer
Kubernetes-commit: 1b63219c5eccdbef1d19c1c4dab40f2b46672dbd
2019-11-14 08:27:42 -05:00
Arjun Naik fa550e796d Adds tests
Signed-off-by: Arjun Naik <arjun@arjunnaik.in>

Kubernetes-commit: 8ab226263a18fa16afdb6fd14da63544095a8937
2019-12-10 18:09:08 +01:00
Ivan Glushkov 3af9a45dfd Adds the algorithm implementation for the Configurable HPA
Kubernetes-commit: 27ffe439b61aaee196190749f1191d9957c86ca1
2019-10-14 19:33:09 +04:00
Nan Yu 656f993514 Rename PodDisruptionsAllowed to DisruptionsAllowed in type PodDisruptionBudgetStatus
Kubernetes-commit: 1fb0dd4ec5134014e466509163152112626d52c3
2019-12-03 11:22:23 -08:00
Christian Huffman fc490f462d Included FSType in CSI volumes
Kubernetes-commit: bbae978d4a0885a6135afb713e252ec4fa41a277
2019-11-14 11:18:40 -05:00
Rob Scott 56eaaf1668 Promoting EndpointSlices to beta
Kubernetes-commit: a7e589a8c689d1a6c0c21d47c5e6c97267822875
2019-10-25 14:59:10 -07:00
Rob Scott 4118a67aeb Splitting IP address type into IPv4 and IPv6 for EndpointSlices
Kubernetes-commit: 0fa9981e0106d7f0d6f9c88fc49d4cdf779c95c1
2019-11-06 22:46:04 -08:00
Jack Kleeman 1f00e044fd Fix incorrect message on describe netpol
When I describe network policies, it often tells me that pods are
isolated for egress connectivity because the policy that applies to them
has no egress rules. However, this would only lead to isolation if there
is an explicitly set egress policy type. Otherwise, the policy allows
egress traffic. The same applies if you have explicitly set an egress
type only, describe will incorrectly report isolated ingress traffic.

This PR fixes this by inferring the applicable direction for the policy
based on the PolicyTypes, and then if a policy doesn't apply eg to
egress, we print 'Not affecting egress traffic'

Kubernetes-commit: 7753bfa3a418d95795420d03193732e024456466
2019-10-22 17:43:03 +01:00
ritho b0cd1c2290 Do some Kubectl optimizations suggested by the golangci linter
The tool golangci-lint gives a bunch of warnings. This PR solves the easier/less controversial ones, so the code is simpler and a little bit more optimal, since it removes some if conditions.

Kubernetes-commit: cd2adbe760641f844d84d411f9adcf17fb6982ff
2019-06-04 01:25:43 -05:00
Mike Danese fc0d402286 support URI SANs in local signer
Kubernetes-commit: 6a004d0c18818f79d7c294091f071706aac2d912
2019-11-04 08:08:59 -08:00
Jan Chaloupka 6fd1ff2fb0 Require exact match when calling Get method within fake clientset
`Get` method within the fake clientset returns an object that would not be normally returned when using the real clientset. Reproducer:

```go
package main

import (
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes/fake"
)

func main () {
	cm := &v1.ConfigMap{
		ObjectMeta: metav1.ObjectMeta{Namespace: metav1.NamespaceSystem, Name: "cm"},
		}

	client := fake.NewSimpleClientset(cm)
	obj, err := client.CoreV1().ConfigMaps("").Get("", metav1.GetOptions{})
	if err != nil {
		panic(err)
	}
	fmt.Printf("obj: %#v\n", obj)
}
```

stored under `test.go` of `github.com/kubernetes/kubernetes` (master HEAD) root directory and ran:

```sh
$ go run test.go
obj: &v1.ConfigMap{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"cm", GenerateName:"", Namespace:"kube-system", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:"", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Data:map[string]string(nil), BinaryData:map[string][]uint8(nil)}
```

As you can see fake clientset with a "test" configmap is created. When getting the object through the clientset back, I intentionally set the object name to an empty string. I would expect to get an error saying config map "" was not found. However, I get "test" configmap instead.

Reason for that is inside implementation of `filterByNamespaceAndName` private function:
```go
func filterByNamespaceAndName(objs []runtime.Object, ns, name string) ([]runtime.Object, error) {
	var res []runtime.Object

	for _, obj := range objs {
		acc, err := meta.Accessor(obj)
		if err != nil {
			return nil, err
		}
		if ns != "" && acc.GetNamespace() != ns {
			continue
		}
		if name != "" && acc.GetName() != name {
			continue
		}
		res = append(res, obj)
	}

	return res, nil
}
```

When `name` is empty, `name != "" && acc.GetName() != name` condition is false and thus `obj` is consider as a fit.

[1] https://github.com/kubernetes/client-go/blob/master/testing/fixture.go#L481-L493

Kubernetes-commit: d32c76fc03381784516c47cb1bf62ef932189afa
2019-09-17 17:52:28 +02:00
wojtekt e55208d067 Add information from Lease to kubectl describe node
Kubernetes-commit: b44f8948a4ec4105ce3e989132199dd6757c65e4
2019-10-14 12:53:38 +02:00
Ted Yu 91465db998 Improve 'No resource limits' message
Kubernetes-commit: 3553de332e9367a9126937c5840da00f8001f2a0
2019-10-10 14:31:17 -07:00
caiweidong 521a90f087 add apigroup to the data source when using kubectl describe pvc
Kubernetes-commit: 9157df47e8db6e10edcd398294e6a4c04b3572e9
2019-09-08 15:03:26 +08:00