Skip to content

Support unsetting string-based flags by passing empty string ("") #447

@heyjcollins

Description

@heyjcollins

Description of problem

workload create/apply supports setting a handful of string-based workload object values via flags.
Once any of those flag/values have been set, the only way to unset them today is to pass a --file workload.yaml with those properties/values removed and use --update-strategy replace.

For someone who prefers to manage/configure their workload via apps commands/flags or someone unfamiliar with the workload object and/or yaml, this is inconvenient toil.

Proposed solution

Enable unsetting of string-based flags by passing an empty string.

Given I've created a workload via command such as `tanzu apps workload create my-app --git-repo github.com/foo/bar --git-branch main --limit-cpu 500m`
When I run an update command such as `tanzu apps workload create my-app --git-repo github.com/foo/bar --git-branch main --limit-cpu ""`
Then limit-cpu and it's value are unset in my workload
Given I'm looking at the output for  `tanzu apps workload create/apply --help`
When I view any help line for a flag in the list of flags to be updated as per this issue
Then I see `(to unset, pass empty string "")` appended to the flag description

List of flags to update

  1. --app
  2. --image (not sure if this one belongs in the list - let's discuss)
  3. --limit-cpu
  4. --limit-memory
  5. --maven-type
  6. --request-cpu
  7. --request-memory

And these already have this feature enabled:

  1. --service-account
  2. --sub-path
  3. --git*

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions