Automatic merge from submit-queue (batch tested with PRs 63871, 63927, 63966, 63957, 63844). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Add strategy description for 'kubectl describe sts' command
**What this PR does / why we need it**:
To display `UpdateStrategyType` and `RollingUpdateStrategy` information when execute `kubectl describe sts` command, the output likes:
```
Name: web
Namespace: default
CreationTimestamp: Thu, 17 May 2018 10:21:19 +0800
Selector: app=nginx
Labels: app=nginx
Annotations: <none>
Replicas: 3 desired | 1 total
Update Strategy: RollingUpdate
Partition: 2
Pods Status: 0 Running / 1 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: app=nginx
Containers:
nginx:
Image: k8s.gcr.io/nginx-slim:0.8
Port: 80/TCP
Host Port: 0/TCP
Environment: <none>
Mounts:
/usr/share/nginx/html from www (rw)
Volumes: <none>
Volume Claims:
Name: www
StorageClass: my-storage-class
Labels: <none>
Annotations: <none>
Capacity: 1Gi
Access Modes: [ReadWriteOnce]
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 10s statefulset-controller create Pod web-0 in StatefulSet web successful
```
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes None
**Special notes for your reviewer**:
**Release note**:
```release-note
Add 'UpdateStrategyType' and 'RollingUpdateStrategy' to 'kubectl describe sts' command output.
```
Automatic merge from submit-queue (batch tested with PRs 63367, 63718, 63446, 63723, 63720). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
finish new dynamic client and deprecate old dynamic client
Builds on a couple other pulls. This completes the transition to the new dynamic client.
@kubernetes/sig-api-machinery-pr-reviews
@caesarxuchao @sttts
```release-note
The old dynamic client has been replaced by a new one. The previous dynamic client will exist for one release in `client-go/deprecated-dynamic`. Switch as soon as possible.
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
should use time.Since instead of time.Now().Sub
**What this PR does / why we need it**:
should use time.Since instead of time.Now().Sub
**Special notes for your reviewer**:
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Use single struct in internal type to reduce difference with external type
**What this PR does / why we need it**:
This PR reduces the differences between internal and external types by removing leftovers after revert of one of the changes.
**Special notes for your reviewer**:
We had `IDRange` in both types prior 9440a68744 commit (https://github.com/kubernetes/kubernetes/pull/44714) that splitted it into `UserIDRange`/`GroupIDRange`. Later, in c91a12d205 commit (https://github.com/kubernetes/kubernetes/pull/47824) we had to revert these changes because they broke backward compatibility but `UserIDRange`/`GroupIDRange` structs were left in the internal type.
Automatic merge from submit-queue (batch tested with PRs 63421, 63432, 63333). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
update tests to be specific about the versions they are testing
When setting up tests, you want to rely on your own scheme. This eliminates coupling to floating versions which gives unnecessary flexibility in most cases and prevents testing all the versions you need.
@liggitt scrubs unnecessary deps.
```release-note
NONE
```
We had IDRange in both types prior 9440a68744 commit that splitted it
into UserIDRange/GroupIDRange. Later, in c91a12d205 commit we had to
revert this changes because they broke backward compatibility but
UserIDRange/GroupIDRange struct left in the internal type.
This commit removes these leftovers and reduces the differences
between internal and external types.
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
wire printflags through additional cmds
**Release note**:
```release-note
NONE
```
Adds PrintFlag pattern to more commands.
cc @deads2k @soltysh
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
make describers more generic from the CLI
I've made this change very small so the intent and explanation make sense to people.
Clients are not generic. Client**Configs** are generic. We faced this distinction in the apiserver and it took us a little to hurdle it. When you try to provide a generic example or function, you need to provide Client**Config**, not a kube clientset. The reason is that the code you're calling may have generated their own clientset, may want to use a dynamic one, or may want to a simple restclient. As we seek to make `kubectl` primitives more generally applicable, this is an example we'll want to follow. I suspect we'll be making more changes along these veins as we tease out the generic pieces of `kubectl ` to make a friendly CLI library.
@kubernetes/sig-cli-maintainers
/hold
Holding for a few days to make sure that people have time to read and digest.
```release-note
NONE
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
we should use Infof when we are using format string
**What this PR does / why we need it**:
we should use Infof when we are using format string.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Make pod status to Running if some are Running and some are Completed
**What this PR does / why we need it**:
Make pod status to Running if some are Running and some are Completed
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes#62588
**Special notes for your reviewer**:
Only Set Pod status to Completed when no other reason, no Running container and only Completed containers.
Set status to Running if some are Running and some are Completed
**Release note**:
```release-note
Set pod status to "Running" if there is at least one container still reporting as "Running" status and others are "Completed".
```
Automatic merge from submit-queue (batch tested with PRs 62510, 61689). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Extend kubectl describe for networkPolicy
**What this PR does / why we need it**:
Recently `networkpolicy` was allowed podSelector and namespaceSelector to be specified together in a NetworkPolicyPeer, so we need to extend `kubectl describe` for networkpolicy.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixeskubernetes/kubectl#376
**Special notes for your reviewer**:
Here is the example output of `kubectl describe networkpolicies`:
NetworkPolicy file:
```yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default
spec:
podSelector:
matchLabels:
role: db
ingress:
- from:
- namespaceSelector:
matchLabels:
project: myproject
podSelector:
matchLabels:
role: frontend
ports:
- protocol: TCP
port: 6379
egress:
- to:
- namespaceSelector:
matchLabels:
project: myproject
podSelector:
matchLabels:
role: frontend
ports:
- protocol: TCP
port: 6379
```
describe:
```shell
# ./kubectl describe netpol test-network-policy
Name: test-network-policy
Namespace: default
Created on: 2018-03-26 15:20:11 +0800 CST
Labels: <none>
Annotations: <none>
Spec:
PodSelector: role=db
Allowing ingress traffic:
To Port: 6379/TCP
From NamespaceSelector: project=myproject
PodSelector: role=frontend
Allowing egress traffic:
To Port: 6379/TCP
To NamespaceSelector: project=myproject
PodSelector: role=frontend
Policy Types: Ingress, Egress
```
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Fix kubectl describe cronjob
CronJob describer was attempting to use the internal batch clientset, which speaks to the batch/v1 API group. CronJobs do not exist in that API group.
Automatic merge from submit-queue (batch tested with PRs 62063, 62169, 62155, 62139, 61445). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
begin wiring printflags through set cmds
**Release note**:
```release-note
NONE
```
Begin wiring PrintFlags struct through commands
cc @deads2k @soltysh
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Fix bad column alignment when using custom columns from OpenAPI schema
Columns printed by `kubectl get` weren't aligned properly when they were coming from the OpenAPI schema.
This was caused by `CustomColumnPrinter.PrintObj`, which was creating a new `tabwriter.Writer` instead of re-using the tabwriter received through the `out` method parameter (basically, a tabwriter was writing to another tabwriter). Because the PrintObj flushed the tabwriter after writing each individual line, the column widths would reset.
**What this PR does / why we need it**:
This PR fixes the bad column alignment.
**Which issue(s) this PR fixes**
Fixes#56282
**Special notes for your reviewer**:
I've aligned how `CustomColumnPrinter.PrintObj` handles tabwriter with how `HumanReadablePrinter.PrintObj` does it (see https://github.com/kubernetes/kubernetes/blob/master/pkg/printers/humanreadable.go#L299-L303)
**Release note**:
```release-note
Fixed column alignment when kubectl get is used with custom columns from OpenAPI schema
```
Automatic merge from submit-queue (batch tested with PRs 61790, 61808, 60339, 61615, 61757). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Ensure -o yaml populates kind/apiVersion
Fixes#61780
```release-note
kubectl: fixes issue with `-o yaml` and `-o json` omitting kind and apiVersion when used with `--dry-run`
```
Automatic merge from submit-queue (batch tested with PRs 61434, 61501, 59609, 61467, 61531). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Add others's status in hpa describe
**What this PR does / why we need it**:
Add other status in HPA describe
- rs
- deployment
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
Add all kinds of resource objects' statuses in HPA description.
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
fix sorting taints in case the sorting keys are equal
**What this PR does / why we need it**:
/kind bug
/sig cli
When describing node taints, the similar issue mentioned in #61250 also exists.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
xref #61250
**Special notes for your reviewer**:
/cc @kubernetes/sig-cli-bugs
@kubernetes/sig-cli-api-reviews
**Release note**:
```release-note
fix sorting taints in case the sorting keys are equal
```
Automatic merge from submit-queue (batch tested with PRs 61354, 61366, 61386, 61394, 60755). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
pkg/printers: Support base64 decode in kubectl get go-template
**What this PR does / why we need it**:
Adds a `base64decode` function to templates in `kubectl` so that it's possible to extract secret data in plaintext instead of base64 without requiring a separate executable to do the decode.
Sample usage:
```sh
kubectl get secret SECRET -o go-template='{{ .data.KEY | base64decode }}'
```
**Which issue(s) this PR fixes**:
Fixeskubernetes/kubernetes#45293.
**Special notes for your reviewer**:
**Release note**:
```release-note
You can now use the `base64decode` function in kubectl go templates to decode base64-encoded data, for example `kubectl get secret SECRET -o go-template='{{ .data.KEY | base64decode }}'`.
```
Automatic merge from submit-queue (batch tested with PRs 60793, 61181, 61267, 61252, 61334). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
fix sorting tolerations in case the keys are equal
**What this PR does / why we need it**:
/kind bug
/sig cli
find a better way to sort `api.Toleration`, in case the key are the same
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes#61250
**Special notes for your reviewer**:
/cc @k82cn @kubernetes/sig-cli-api-reviews
**Release note**:
```release-note
fix sorting tolerations in case the keys are equal
```
Automatic merge from submit-queue (batch tested with PRs 60793, 61181, 61267, 61252, 61334). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
--show-all is inert in v1.11
**What this PR does / why we need it**:
`--show-all` is inert in v1.11
ref: #60210
**Special notes for your reviewer**:
/assign @deads2k
**Release note**:
```release-note
`--show-all` (which only affected pods and only for human readable/non-API printers) is inert in v1.11, and will be removed in a future release.
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Add description of pvc condition for kubectl describe command
**What this PR does / why we need it**:
As the title says, add description of `PersistentVolumeClaim.Status.Conditions` for `kubectl describe pvc` command, the output will look like this:
```
Conditions:
Type Status LastProbeTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
Resizing True Mon, 01 Jan 0001 00:00:00 +0000 Sat, 10 Feb 2018 19:20:56 +0800
```
**Release note**:
```release-note
NONE
```
/sig storage
/kind enhancement
Adds a `base64decode` function to templates in `kubectl` so that
it's possible to extract secret data in plaintext instead of
base64 without requiring a separate executable.
Sample usage:
```sh
kubectl get secret SECRET -o go-template='{{ .data.KEY | base64decode }}'
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Update kubectl describe to print out PV node affinity
**What this PR does / why we need it**:
Print out PV NodeAffinity in kubectl describe.
Sample output:
```
Name: example-local-pv
Labels: foo1=bar1
foo2=bar2
Annotations: <none>
Finalizers: []
StorageClass: local-storage
Status: Available
Claim:
Reclaim Policy: Delete
Access Modes: RWO
Capacity: 5Gi
Node Affinity:
Required Terms:
Term 0: kubernetes.io/hostname in [my-node]
foo1 in [bar1, bar2]
Term 1: foo2 exists
Message:
Source:
Type: LocalVolume (a persistent volume backed by local storage on a node)
Path: /mnt/disks/ssd1
Events: <none>
```
No NodeAffinity is set:
```
Name: nfs
Labels: <none>
Annotations: <none>
Finalizers: []
StorageClass:
Status: Available
Claim:
Reclaim Policy: Retain
Access Modes: RWX
Capacity: 1Mi
Node Affinity: <none>
Message:
Source:
Type: NFS (an NFS mount that lasts the lifetime of a pod)
Server: 10.244.1.4
Path: /exports
ReadOnly: false
Events: <none>
```
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes#60119
**Special notes for your reviewer**:
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 60324, 60269, 59771, 60314, 59941). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Implement a stub server printer for CRDs
This wires up TableConvertor to CRDs and puts a basic implementation in place for custom paths. However, since our OpenAPISchema can't store OpenAPI extension fields there is no way to expose the custom column piece that get.go supports today (`x-kubernetes-print-columns`). That piece can be implemented separately and needs discussion.
As this is purely exposing the default interface, very low risk. Will add an e2e test that covers this under a registered CRD.
@soltysh @sttts @kubernetes/sig-api-machinery-pr-reviews
A couple of options for wiring up the actual definition:
1. add a new "extensions" map to spec.validation
1. Downside: won't handle future child nested fields, not the correct schema
2. try to change the OpenAPISchema3 field to support extensions
1. Would require a breaking protobuf change, is also very difficult
2. Could store the entire schema as opaque JSON and then parse on load (might be the right thing anyway)
3. Support this as an annotation in 1.11 - `alpha.customresource.k8s.io/x-kubernetes-print-columns` like the CLI
Part of #58536
Automatic merge from submit-queue (batch tested with PRs 57672, 60299, 59757, 60283, 60265). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Add description of MountOptions to StorageClass describe printer
**What this PR does / why we need it**:
Print `StorageClass.MountOptions` for `kubectl describe` command.
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Fix kubectl describe output for priority class objects.
**What this PR does / why we need it**:
Fixes `kubectl describe priorityclass` (try https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#example-priorityclass)
```
Name: high-priority
Value: %!s(int32=1000000)
GlobalDefault: %!s(bool=false)
Description: This priority class should be used for XYZ service pods only.
Annotations: <none>
Events: <none>
```
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
None
```
@bsalamat @kubernetes/sig-scheduling-bugs @kubernetes/sig-cli-bugs
/king bug
/sig scheduling
/sig cli
Automatic merge from submit-queue (batch tested with PRs 59391, 58097, 60057, 60090). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
cleanup printers some more
This cleans up some more dead printer flags and unnecessary arguments for various methods. We're getting closer. Still need to clean up some ugly around `PrintSuccess` and then its time to start trimming layers.
@kubernetes/sig-cli-maintainers
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 59634, 59821, 57850, 59916, 60032). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
AllowVolumeExpansion field to storageclass describe
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
**What this PR does / why we need it**:
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
```