Commit Graph

78 Commits

Author SHA1 Message Date
supereagle
9c02d7e38c use extensions client with explicit version 2017-11-22 21:18:14 +08:00
Clayton Coleman
8f4b6c8771
All commands must declare Unstructured or Internal
Callers must take a dependency on one or the other set of conversions
and default client behavior. Future changes may add a Versioned() type,
but this is an accurate reflection of current code state.
2017-11-19 20:41:02 -05:00
juanvallejo
701d6536a2
move cmd/util/printing.go#PrintSuccess to factory_builder.go 2017-11-15 10:46:39 -05:00
Di Xu
057b7bf767 rename selector to labelSelector 2017-11-06 14:30:20 +08:00
Ferran Rodenas
c1802dc472 Update kubectl drain command to use policy V1Beta1 instead of unversioned API
Signed-off-by: Ferran Rodenas <frodenas@gmail.com>
2017-10-25 16:44:57 +02:00
juanvallejo
ee2f9c95e7
update resource selector - kubectl drain 2017-10-19 10:10:06 -04:00
juanvallejo
e11a11140f
add --dry-run option to kubectl drain 2017-10-06 11:55:36 -04:00
juanvallejo
3775a50cb8
add --selector flag support 2017-10-02 16:18:30 -04:00
juanvallejo
90d76adb4b
add Local and Unstructured builder attributes
Moves DisabledClientMapperForMapping wrapper to new Local attribute.
Removes Factory#NewUnstructuredBuilder in favor of new Unstructured
builder attribute.
2017-09-05 11:57:00 -04:00
ymqytw
b776df8a20 move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
Kubernetes Submit Queue
3e8a25e818 Merge pull request #50008 from atlassian/meta-controller-ref
Automatic merge from submit-queue

Migrate to controller references helpers in meta/v1

**What this PR does / why we need it**:
This is a follow up for #48319 that migrates all method usages to new methods in meta/v1.

**Special notes for your reviewer**:
Looking at each commit individually might be easier.

**Release note**:
```release-note
NONE
```
/sig api-machinery
/kind cleanup
2017-08-10 17:07:30 -07:00
Xing Zhou
65c28eb64f Add error return for the Marshal object invocation.
Add error return for the Marshal object invocation.
2017-08-08 13:38:31 +08:00
Mikhail Mazurskiy
b28a83a4cf
Migrate to GetControllerOf from meta/v1 package 2017-08-06 22:41:58 +10:00
Kubernetes Submit Queue
0e94e9439f Merge pull request #49438 from zhangxiaoyu-zidif/delete-err-def-for-drain
Automatic merge from submit-queue (batch tested with PRs 48911, 49475, 49438, 49362, 49274)

Delete redundant err definition

**What this PR does / why we need it**:
Delete redundant err definition
line 642 has its definition and initialization, so line 641 is redundant.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2017-07-24 20:39:18 -07:00
Eric Paris
7c531ecc13 Do not spin forever if kubectl drain races with other removal
In https://github.com/kubernetes/kubernetes/pull/47450 we stopped
returning an error if a pod disappeared before we could remove it.
Instead we just continue to spin forever. Return "success" if a pod
disappeared before we actually removed it.

https://bugzilla.redhat.com/1473777
bug 1473777
2017-07-22 13:39:01 -04:00
zhangxiaoyu-zidif
1b785d09d4 Delete redundant err definition 2017-07-22 16:19:32 +08:00
Kubernetes Submit Queue
d58d29d99d Merge pull request #48082 from ravisantoshgudimetla/kubectl_drain_node_conversion
Automatic merge from submit-queue (batch tested with PRs 48082, 48815, 48901, 48824)

Changes for typecasting node in drain

**What this PR does / why we need it**:

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #48059 

**Special notes for your reviewer**:
Precursor to #44944

**Release note**:

```release-note
kubectl drain now uses PATCH instead of PUT to update the node. The node object is now of type v1 instead of using internal api.
```
2017-07-13 22:43:54 -07:00
ravisantoshgudimetla
db120eb8ca Changes for converting node to v1 in drain 2017-07-12 21:36:29 -04:00
ymqytw
b336691ca3 eliminate kubectl dependency on kubelet 2017-07-05 20:23:30 -07:00
Alexander Campbell
6fd36c10ad kubectl/cmd: many small refactors
* Rename variables and functions to match Go convention.
   For example, UsageError --> UsageErrorf.
 * Remove redundant or unreachable code.
 * Simplify some utility functions (no functionality changes).
 * Fix hanging 'if { return } else { return }' constructs.
 * Fix several incorrect printf verbs.
2017-06-27 16:25:20 -07:00
Kubernetes Submit Queue
60126b0ceb Merge pull request #47471 from crimsonfaith91/drain
Automatic merge from submit-queue (batch tested with PRs 46151, 47602, 47507, 46203, 47471)

deprecate created-by annotation for pod drain

**What this PR does / why we need it**: This PR deprecates created-by annotation for pod drain. This is required as we now have ControllerRef.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: xref #44407

**Special notes for your reviewer**: This is the second PR for deprecating created-by annotation. Other PRs can be found here: https://github.com/kubernetes/kubernetes/pull/47469 , #47475 

**Release note**:

```release-note
```
2017-06-23 05:08:30 -07:00
Jun Xiang Tee
d76b08d154 deprecate created-by annotation for pod drain 2017-06-16 13:33:26 -07:00
Kubernetes Submit Queue
c31893978b Merge pull request #45918 from juanvallejo/jvallejo/fix-kubectl-set-resources-local
Automatic merge from submit-queue

fix --local flag for kubectl commands

Fixes https://github.com/kubernetes/kubernetes/issues/47079

**Release note**:
```release-note
NONE
```

Fixes the `--local` flag for `kubectl set ...` sub-commands.
**As of the 1.7 release**, `PrinterForCommand` was updated to [use a mapper and typer for unstructured objects](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/util/factory_builder.go#L52), which further prevented the use of `--local` when there was no connection to an api server.


**before** (with no connection to a server)
```
$ kubectl set resources -f pod.json --limits=cpu=200m,memory=512Mi --local
error: unable to connect to a server to handle "pods": Get https://10.13.137.149:8443/api: dial tcp 10.13.137.149:8443: getsockopt: connection refused
```

**after** (with no connection to a server)
```
$ kubectl set resources -f pod.json --limits=cpu=200m,memory=512Mi --local
NAME              READY     STATUS    RESTARTS   AGE
mypod   0/1                 0          <unknown>
```

cc @smarterclayton @fabianofranz
2017-06-16 08:19:13 -07:00
Michail Kargakis
26d3eadb46
Ignore 404s on evict 2017-06-13 20:21:26 +02:00
juanvallejo
d036686185
fix --local flag for kubectl set commands 2017-06-13 12:57:05 -04:00
Derek Carr
1dc4d77942 kubectl drain errors if pod is already deleted 2017-06-09 17:05:43 -04:00
Brendan Burns
79f51923d3 Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
Kubernetes Submit Queue
eaf3c47489 Merge pull request #42115 from justinsb/kubectl_expose_drainoptions
Automatic merge from submit-queue (batch tested with PRs 42162, 41973, 42015, 42115, 41923)

kubectl drain: make code reusable

DrainOptions requires a few fields to be set, and the expectation is
that these are set as part of construction of the object.  If they are
set, then the drain code can be reused in other kubernetes projects.

This does not create a contract that DrainOptions should fulfill going
forwards, any more than any of the other types that happen to be exposed
are part of the contract.  Instead, this merely makes use outside the
package possible.

```release-note
NONE
```
2017-02-28 22:06:03 -08:00
Maciej Szulik
27259358cb Switch ClientAccessFactory to use clientset.Interface rather than actual type 2017-02-27 13:13:06 +01:00
Justin Santa Barbara
72afd143c4 kubectl drain: make code reusable
DrainOptions requires a few fields to be set, and the expectation is
that these are set as part of construction of the object.  If they are
set, then the drain code can be reused in other kubernetes projects.

This does not create a contract that DrainOptions should fulfill going
forwards, any more than any of the other types that happen to be exposed
are part of the contract.  Instead, this merely makes use outside the
package possible.
2017-02-26 00:48:48 -05:00
Maru Newby
92d739bebc kubectl: Allow 'drain --force' to remove orphaned pods 2017-02-22 06:59:33 -08:00
Kubernetes Submit Queue
5c4cec21c3 Merge pull request #38771 from derekwaynecarr/fix_drain_typo
Automatic merge from submit-queue (batch tested with PRs 41145, 38771, 41003, 41089, 40365)

Fix typo in drain command
2017-02-09 13:34:47 -08:00
Brendan Burns
d9c4a289a6 Extract strings for translation. 2017-02-06 22:32:01 -08:00
Clayton Coleman
be6d2933df
refactor: Move *Options references to metav1 2017-01-24 13:41:51 -05:00
Clayton Coleman
469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
deads2k
ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k
11e8068d3f move pkg/fields to apimachinery 2017-01-19 09:50:16 -05:00
Clayton Coleman
9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k
77b4d55982 mechanical 2017-01-16 09:35:12 -05:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Derek Carr
f1af1e965a Fix typo in drain command 2016-12-14 13:00:25 -05:00
Wojciech Tyczynski
e8d1cba875 GetOptions in client calls 2016-12-09 09:42:01 +01:00
Clayton Coleman
5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
ymqytw
b358b2df02 make drain retry forever and use new timeout 2016-11-29 14:23:40 -08:00
ymqytw
b8fbf68759 update kubectl drain doc 2016-11-22 15:34:58 -08:00
Kubernetes Submit Queue
4b5667e177 Merge pull request #36211 from brendandburns/cordon
Automatic merge from submit-queue

Add retry to node scheduability marking.

Fixes https://github.com/kubernetes/kubernetes/issues/32391

@justinsb @janetkuo @kubernetes/sig-cli
2016-11-08 16:05:53 -08:00
ymqytw
b73fae6c55 Fix kubectl drain for statefulset and use eviciton for drain if possible 2016-11-07 16:13:06 -08:00
Brendan Burns
55f031e167 Add retry to node scheduability marking. 2016-11-06 08:28:36 -08:00
ymqytw
8a2610c6fb fix drain test flake 2016-10-24 09:32:49 -07:00
ymqytw
55c6116d66 address comments and add tests 2016-10-18 22:55:15 -07:00