Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--dry-run fails with workload create for pre-existing workload and returns full workload object with status rather than just example of what would be created/applied. #426

Open
2 tasks done
heyjcollins opened this issue Dec 1, 2022 · 1 comment
Labels
bug Something isn't working MIGRATED-MIGRATED Migrated to private repo needs-design needs-pm needs-triage

Comments

@heyjcollins
Copy link
Contributor

heyjcollins commented Dec 1, 2022

WIP

to do:

  1. create separate issue for the enhancement, leave create --dry-run error issue as bug
  2. spec supported flag values/default
  3. update help
  4. default = server (start deprecation)
  5. deprecation warning
  6. consider time-bomb (once deprecation window is up, automatic switch of default , hide warning message, update default in helpoutput)

Please fill out the issue checklist below and provide ALL the requested information.

  • I reviewed open and closed Github issues that may be related to my problem.
  • I am reporting a bug that others will be able to reproduce.

Describe the bug

2 issues:

  1. running tanzu apps workload create/apply appname -f workload.yaml --dry-run for an existing workload should return output the workload object that would be created/applied if the command were to actually run - but currently, the entire object including status is returned -- that's not expected.
  2. running tanzu apps workload create appname -f workload.yaml --dry-run for an existing workload throws an error -- but in the case of --dry-run, the intention is to see what changes would be made - but the changes aren't applied
    ** the validation which errors because you can't create something that's already been created is happening here, but when --dry-run is included, that should short-circuit the validation

Expected behavior

issue 1: return output the workload object that would be created/applied
issue 2: return output the workload object that would be created/applied

Steps to Reproduce

issue 1:

  1. create a workload named foo
  2. run tanzu apps workload create foo --env foo=bar --dry-run
  3. returned the full workload object including status rather than just the workload object that would be submitted

issue 2:

  1. create a workload named foo
  2. run tanzu apps workload create foo --env foo=bar --dry-run
  3. error

Screenshots

If applicable, add screenshots to help explain your problem.

Version (Apps plugin version, Version of K8s running on cluster)

apps v0.9.0, but this issue likely goes all the way back to v0.1.0

@heyjcollins heyjcollins added bug Something isn't working needs-triage labels Dec 1, 2022
@shashwathi
Copy link
Contributor

For context, in CLI dry-run is implemented with server side strategy, i.e., object is submitted to the API but not persisted. To allow users to use dry-run without submitting to server, CLI needs to add support for client side strategy.

Proposed solution: Allow users to set client or server for --dry-run flag. This is inspired from kubectl
ref: https://kubernetes.io/blog/2019/01/14/apiserver-dry-run-and-kubectl-diff/#apiserver-dry-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working MIGRATED-MIGRATED Migrated to private repo needs-design needs-pm needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants