Commit Graph

46 Commits

Author SHA1 Message Date
Arda Güçlü
a5698efff2 Ignore api-resources not found error until it's ready 2022-12-21 10:34:53 +03:00
Kubernetes Prow Robot
f2fccffd9b
Merge pull request #113708 from apelisse/fix-ssa-flaky-test
Ignore error when getting api-resources until it's ready
2022-11-09 08:30:48 -08:00
Antoine Pelisse
7596488769 Ignore error when getting api-resources until it's ready 2022-11-07 16:36:24 -08:00
Alexander Zielenski
33b9552e70 add kubectl server-side apply migrate managedfields
in discussion with SIG, there is a strong interest in keeping the last-applied-configuration around for a bit longer as other tools transition for of it. This is OK since SSA maintains the annotation on kubectl's behalf on the server-side if it exists

migrate client-side-apply fields to SSA when --serverside-side is used

https://github.com/kubernetes/kubernetes/issues/107980

https://github.com/kubernetes/kubernetes/issues/108081

https://github.com/kubernetes/kubernetes/issues/107417

https://github.com/kubernetes/kubernetes/issues/112826

add test to make sure only one apply is needed after migration
2022-11-04 14:09:29 -07:00
Kubernetes Prow Robot
fb9b466f30
Merge pull request #113159 from pacoxu/patch-3
flake: wait for crd ready in kubectl apply script
2022-10-20 12:06:56 -07:00
Paco Xu
da070707de flake: wait for crd ready in kubectl apply script 2022-10-20 12:58:04 +08:00
Sean Sullivan
9c18bdab9c Removes test of deprecated --dry-run value 2022-10-18 19:39:34 +00:00
Humble Chirammal
6621db7dd1 fix typos in pkg/validation and test/cmd
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-09-20 19:12:17 +05:30
Julian V. Modesto
cc4998b2b1 Re-introduce removed kubectl --dry-run values.
For 1.23, we removed the kubectl `--dry-run` empty default value (`--dry-run`)
and boolean values (`--dry-run=true` and `--dry-run=false`). This change
required requiring users to specify `--dry-run=client` or `--dry-run=server`
due to a deprecation. This change was made in #105327.

After reconsideration, this change is not worth the churn for users.
It's likely that many users rely on these values for automated and manual use
cases.

This change reverts #105327 and re-introduces the values `--dry-run`,
`--dry-run=true`, and `--dry-run=false`.
2021-12-13 15:04:49 -05:00
Julian V. Modesto
e0b7a85ee5 Remove deprecated kubectl --dry-run values.
The boolean values for --dry-run have been deprecated for removal since
1.18, more than 2 releases.

The default value for --dry-run with the flag set and unspecified has
been deprecated for removal since 1.18, more than 2 releases.

Both values are now removed in this change. Any kubectl --dry-run
usage no longer accepts --dry-run=(true|false) boolean values and usage
now requires that a value of (client|server|none) is specified.
2021-09-28 10:21:04 -04:00
David Eads
2fb8420756 update test-cmd to avoid removed beta APIs 2021-04-19 10:06:37 -04:00
Jian Zeng
237f051a58
feat(kubectl): add flag --show-managed-fields to kubectl-get 2021-02-16 22:52:03 +08:00
Shihang Zhang
d40f0c43c4 separate RootCAConfigMap from BoundServiceAccountTokenVolume 2020-11-04 17:10:39 -08:00
Khaled Henidak (Kal)
6675eba3ef
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>
2020-10-26 13:15:59 -07:00
knight42
57619aa9d7
test(apply): deflake run_kubectl_apply_tests
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-09-17 22:51:19 +08:00
knight42
3cb3356645
test(kubectl): deflake run_kubectl_apply_tests
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-08-14 11:12:42 +08:00
knight42
cbf8ec4e2d
fix: deflake run_kubectl_apply_tests
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-08-05 23:27:34 +08:00
Julian V. Modesto
e4368eb67e Implement server-side apply upgrade & downgrade.
- Allow client-side to server-side apply upgrade.

  Ensure that a user can change management of an object from client-side apply to
  server-side apply without conflicts.

- Allow server-side apply to client-side downgrade.

  For an object managed with client-side apply, a user may upgrade to
  managing the object with server-side apply, then decide to downgrade.

  We can support this downgrade by keeping the last-applied-configuration
  annotation for client-side apply updated with server-side apply.
2020-07-08 19:14:03 -04:00
Kubernetes Prow Robot
83f343011f
Merge pull request #91308 from julianvmodesto/remove-deprecated-server-dry-run-flag
Remove deprecated --server-dry-run from kubectl apply
2020-05-29 01:05:35 -07:00
Julian V. Modesto
3e93f99262 Remove deprecated --server-dry-run.
For the beta server-side dry-run feature, `kubectl apply` provided the
`--server-dry-run` flag.

As of 1.18, this flag was deprecated and marked to be removed after 1
release.
2020-05-20 16:53:53 -04:00
Julian V. Modesto
f0eb68c0cf Make client-side apply safer
- Remove the ServerDryRun field and delegate it entirely to the resource.Helper
- Use resource.Helper for deletions (as in `kubectl apply --force`)
instead of using the pruner's method that uses a dynamic client
- Reduce the resource.Helpers and times we check for server-side dry-run
in apply
2020-05-19 17:01:47 -04:00
Julian V. Modesto
360c348d0e Set kubectl field manager names 2020-05-09 13:24:39 -04:00
Kubernetes Prow Robot
b0806d0c02
Merge pull request #90165 from ScrapCodes/fix_flake_run_apply
Fixed flaky test by changing get_object_assert -> wait_object_assert.
2020-04-16 08:38:59 -07:00
Prashant Sharma
5a765b1e15 Changed get_object_assert -> wait_object_assert, to fix the flaky test. 2020-04-16 10:01:18 +05:30
Tatsuhiro Tsujikawa
7af3b01f24 Restore the ability to kubectl apply --prune without -n flag
Before https://github.com/kubernetes/kubernetes/pull/83084, `kubectl
apply --prune` can prune resources in all namespaces specified in
config files.  After that PR got merged, only a single namespace is
considered for pruning.  It is OK if namespace is explicitly specified
by --namespace option, but what the PR does is use the default
namespace (or from kubeconfig) if not overridden by command line flag.
That breaks the existing usage of `kubectl apply --prune` without
--namespace option.  If --namespace is not used, there is no error,
and no one notices this issue unless they actually check that pruning
happens.  This issue also prevents resources in multiple namespaces in
config file from being pruned.

kubectl 1.16 does not have this bug.  Let's see the difference between
kubectl 1.16 and kubectl 1.17.  Suppose the following config file:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: foo
  namespace: a
  labels:
    pl: foo
data:
  foo: bar
---
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: bar
  namespace: a
  labels:
    pl: foo
data:
  foo: bar
```

Apply it with `kubectl apply -f file`.  Then comment out ConfigMap foo
in this file.  kubectl 1.16 prunes ConfigMap foo with the following
command:

$ kubectl-1.16 apply -f file -l pl=foo --prune
configmap/bar configured
configmap/foo pruned

But kubectl 1.17 does not prune ConfigMap foo with the same command:

$ kubectl-1.17 apply -f file -l pl=foo --prune
configmap/bar configured

With this patch, kubectl once again can prune the resource as before.
2020-04-09 02:54:10 +00:00
Sean R. Sullivan
748ad74245 Even with build error, kubectl apply should apply all valid resources 2020-04-04 15:48:31 -07:00
Prashant Sharma
3ff54eb10c
Fixes a flaky test, by adding kubectl wait for delete deployment in apply.sh (#89725)
* Add kubectl wait for delete deployment.

* Even better to wait for all pods deleted.

* get_object_assert -> wait_object_assert
2020-04-04 00:07:47 -07:00
Sean R. Sullivan
4ca2d5a9da Fixes kubectl apply tests to run; updates broken tests 2020-03-30 17:04:10 -07:00
Sean R. Sullivan
1083c0fe05 Adds integration test for apply failures when applying multiple resources 2020-03-26 22:33:04 -07:00
Julian V. Modesto
13b80b48cd Use --dry-run=client,server in kubectl.
- Support --dry-run=server for subcommands apply, run, create, annotate,
expose, patch, label, autoscale, apply set-last-applied, drain, rollout undo
- Support --dry-run=server for set subcommands
  - image
  - resources
  - serviceaccount
  - selector
  - env
  - subject
- Support --dry-run=server for create subcommands.
  - clusterrole
  - clusterrolebinding
  - configmap
  - cronjob
  - job
  - deployment
  - namespace
  - poddisruptionbudget
  - priorityclass
  - quota
  - role
  - rolebinding
  - service
  - secret
  - serviceaccount
- Remove GetClientSideDryRun
2020-02-12 20:46:54 -05:00
Odin Ugedal
6a73c0899a
Fix shellcheck failures SC2251
https://github.com/koalaman/shellcheck/wiki/SC2251

This may be masking some test failures.

We have a bunch of test code like this:

set -o errexit
[...]
! kubectl get pod wrong-pod
[...]

This test will succeed no matter what the result (return code) of kubectl is.
2019-10-23 22:47:47 +02:00
Ted Yu
88e2f8e04f Prune should respect namespace 2019-09-25 16:43:08 -07:00
Antoine Pelisse
a3f4e6e933 Rename --experimental-* flags to --* for server-side apply 2019-08-28 15:03:41 -07:00
Xiangyang Chu
7a385bf2ea Fix wrong pipe in grep -q 2019-04-26 14:23:53 +08:00
Xiangyang Chu
906058bf7b Update grep -q usage to avoid closed pipe 2019-04-26 11:39:11 +08:00
Xiangyang Chu
2260cc29b9 Make test/cmd/a*.sh pass shellcheck 2019-04-26 11:39:11 +08:00
Antoine Pelisse
eb904d8fa8 Add "fieldManager" to flag to PATCH/CREATE/UPDATE
And add a corresponding flag in kubectl (for apply), even though the
value is defaulted in kubectl with "kubectl".

The flag is required for Apply patch-type, and optional for other PATCH,
CREATE and UPDATE (in which case we fallback on the user-agent).
2019-03-08 16:03:03 -08:00
Kubernetes Prow Robot
81e6407393
Merge pull request #74140 from Liujingfang1/kflag
add -k flag in cli-runtime and kubectl to process kustomization directories
2019-02-26 19:40:16 -08:00
Jingfang Liu
127c2f1e74 address comments 2019-02-26 14:12:58 -08:00
Jingfang Liu
beacc87ebf add cmdline tests for -k 2019-02-25 16:31:03 -08:00
Katharine Berry
dd4f1c1990 Turn off command echoing to avoid illegal bytes in XML. 2019-02-21 09:30:41 -08:00
Antoine Pelisse
308c981633 Add basic server-side apply test to test-cmd 2019-02-08 16:51:29 -08:00
Antoine Pelisse
d3d4d268ac Add test for CRD server-dry-run and fix bug
Add a new test to make sure we can server-dry-run CRDs and also fix a
typo now that we have a test, we could notice that it doesn't work.
2018-11-12 11:06:27 -08:00
Antoine Pelisse
967280b58e Add --server-dry-run flag to kubectl apply 2018-09-02 13:13:46 -07:00
Di Xu
0af6faed09 kubectl: recreating resources for immutable fields when force is applied 2018-08-09 22:59:02 +08:00
David Eads
aa8110044d straight split of test-cmd 2018-07-05 11:38:26 -04:00