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

Fix the way action set name was being configured #2430

Merged
merged 4 commits into from
Oct 26, 2023
Merged

Conversation

viveksinghggits
Copy link
Contributor

@viveksinghggits viveksinghggits commented Oct 24, 2023

Change Overview

Fixes: #2285

kanctl was able to configure the actionset name using the flag called action-set.
But it had two problems

  1. The better flag to give actionset name would be --name instead of --action-set. Because there is another flag called action, so it gets confusing between --action-set and --action. This PR renames the flag to provide the actionset name to --name.
  2. Even though user would expect that if they have provided --name the actionset would be named exactly that. But the problem was we were using generateName in code that resulted in a string being added in the name. This PR makes sure that if --name is provided, the actionset would have exactly this name.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

Test Plan

go test 
OK: 3 passed
PASS
ok  	github.com/kanisterio/kanister/pkg/kanctl	0.031s
  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E
kanctl create actionset --action backup --namespace kanister --blueprint mysql-blueprint --statefulset mysql/mysql-release --profile mysql/s3-profile-qgbmj --dry-run
apiVersion: cr.kanister.io/v1alpha1
kind: ActionSet
metadata:
  creationTimestamp: null
  name: backup-wvb4r
kanctl create actionset --action backup --namespace kanister --blueprint mysql-blueprint --statefulset mysql/mysql-release --profile mysql/s3-profile-qgbmj --name=newname --dry-run
apiVersion: cr.kanister.io/v1alpha1
kind: ActionSet
metadata:
  creationTimestamp: null
  name: newname
spec:
kanctl create actionset --action restore --from=backup-6cztn --dry-run --profile mysql/s3-profile-qgbmj -n kanister
apiVersion: cr.kanister.io/v1alpha1
kind: ActionSet
metadata:
  creationTimestamp: null
  name: restore-backup-6cztn-cmlrl
spec:

`kanctl` was able to configure the actionset name using the flag called
`action-set`.
This has two problems
1. The better flag to give actionset name would be `--name` instead of
`--action-set`. Becuase there is another flag called `action`, so it
gets confusing between `--action-set` and `--action`.
2. Even though user would expect that if they have provided `--name`
the actionset would be named exactly that. But the problem was we
were using `generateName` in code that resulted in a string being
added in the name.
Copy link
Contributor

@PrasadG193 PrasadG193 left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/kanctl/actionset.go Show resolved Hide resolved
Kanister automation moved this from In Progress to Reviewer approved Oct 25, 2023
@mergify mergify bot merged commit 7c924c3 into master Oct 26, 2023
14 checks passed
Kanister automation moved this from Reviewer approved to Done Oct 26, 2023
@mergify mergify bot deleted the action-name branch October 26, 2023 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Dynamic Naming of Actionsets using kanctl
3 participants