Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.

Adding capability to set serviceAccountName through flags#117

Merged
rashedkvm merged 2 commits into
vmware-tanzu:mainfrom
warango4:issue83
May 18, 2022
Merged

Adding capability to set serviceAccountName through flags#117
rashedkvm merged 2 commits into
vmware-tanzu:mainfrom
warango4:issue83

Conversation

@warango4
Copy link
Copy Markdown
Contributor

Pull request

What this PR does / why we need it

In this feature, serviceAccountName is added as a flag and can be used in create/update/apply commands.
To delete serviceAccountName from workload, the flag should be set to "" or ''

E.g.

  • tanzu apps workload create rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --type web --service-account myServiceAccount -y
  • tanzu apps workload apply rmq-sample-app --service-account myServiceAccountUpdated -y // When retrieving the workload, the new service account name should be 'myServiceAccountUpdated'
  • tanzu apps workload update rmq-sample-app --service-account "" -y // Should delete serviceAccountName from workload

Which issue(s) this PR fixes

Fixes #83

Describe testing done for PR

  • Added unit test
  • Tested in local cluster

Additional information or special notes for your reviewer

Signed-off by: Wendy Arango warango@vmware.com

@warango4

This comment was marked as resolved.

@warango4 warango4 force-pushed the issue83 branch 2 times, most recently from e216b91 to 148cd1f Compare May 13, 2022 18:57
@warango4 warango4 requested review from rashedkvm and shashwathi May 13, 2022 20:26
Comment thread pkg/apis/cartographer/v1alpha1/workload_helpers.go Outdated
Comment thread pkg/flags/flags.go Outdated
Comment thread pkg/apis/cartographer/v1alpha1/workload_helpers.go
In this feature, serviceAccountName is added as a flag and can be used in create/update/apply commands.
To delete serviceAccountName from workload, the flag should be set to "" or ''

E.g.
- tanzu apps workload create rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --type web --service-account myServiceAccount -y
- tanzu apps workload apply rmq-sample-app --service-account myServiceAccountUpdated -y // When retrieving the workload, the new service account name should be 'myServiceAccountUpdated'
- tanzu apps workload update rmq-sample-app --service-account "" -y // Should delete serviceAccountName from workload

Signed-off by: Wendy Arango warango@vmware.com
@warango4 warango4 requested a review from shashwathi May 16, 2022 20:01
@warango4 warango4 marked this pull request as ready for review May 16, 2022 20:17
Copy link
Copy Markdown
Member

@rashedkvm rashedkvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Usage string for new flag (missing design)

@warango4 please update PR with design input

Copy link
Copy Markdown
Member

@rashedkvm rashedkvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the user know to use an empty string so an existing serviceAccountName value can be removed?

Comment thread pkg/commands/workload_apply.go
Comment thread pkg/commands/workload_update.go
Signed-off by: Wendy Arango warango@vmware.com
@rashedkvm rashedkvm merged commit 9aabef1 into vmware-tanzu:main May 18, 2022
@warango4 warango4 deleted the issue83 branch July 14, 2022 13:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

As an app dev or app opp, I can CRUD the workload.spec.serviceAccountName via command flag in create/update/apply

4 participants