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