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`.
This commit is contained in:
Julian V. Modesto
2021-12-13 15:04:49 -05:00
parent e0b7a85ee5
commit cc4998b2b1
3 changed files with 26 additions and 12 deletions

View File

@@ -101,6 +101,7 @@ run_kubectl_apply_tests() {
kube::test::get_object_assert pods "{{range.items}}{{${id_field:?}}}:{{end}}" ''
# apply dry-run
kubectl apply --dry-run=true -f hack/testdata/pod.yaml "${kube_flags[@]:?}"
kubectl apply --dry-run=client -f hack/testdata/pod.yaml "${kube_flags[@]:?}"
kubectl apply --dry-run=server -f hack/testdata/pod.yaml "${kube_flags[@]:?}"
# No pod exists

View File

@@ -49,7 +49,7 @@ run_job_tests() {
kube::test::describe_resource_chunk_size_assert cronjobs events "--namespace=test-jobs"
### Create a job in dry-run mode
output_message=$(kubectl create job test-job --from=cronjob/pi --dry-run=client --namespace=test-jobs -o name)
output_message=$(kubectl create job test-job --from=cronjob/pi --dry-run=true --namespace=test-jobs -o name)
# Post-condition: The text 'job.batch/test-job' should be part of the output
kube::test::if_has_string "${output_message}" 'job.batch/test-job'
# Post-condition: The test-job wasn't created actually