-
Notifications
You must be signed in to change notification settings - Fork 84
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
VPC key create and delete operations added #1085
Conversation
✅ Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
22f635e
to
ea49055
Compare
Could you please refer to Power VS key command PR: #1087 and make the necessary changes to make it similar. Also docs are missing in the PR. |
@Madhan-SWE Need to update docs here - Doc ref |
@Prajyot-Parab: GitHub didn't allow me to request PR reviews from the following users: dharaneeshvrd. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Prajyot-Parab: GitHub didn't allow me to request PR reviews from the following users: dharaneeshvrd. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
cmd/capibmadm/cmd/vpc/key/delete.go
Outdated
|
||
func deleteKey(keyDeleteOption keyDeleteOptions) error { | ||
log := logf.Log | ||
v1, err := vpc.NewV1Client(options.GlobalOptions.VPCRegion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets rename v1
to something more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1
is renamed to vpcservice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1
is rename to vpcClient
cmd/capibmadm/cmd/vpc/key/create.go
Outdated
|
||
func createKey(ctx context.Context, keyCreateOption keyCreateOptions) error { | ||
log := logf.Log | ||
v1, err := vpc.NewV1Client(options.GlobalOptions.VPCRegion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets rename v1
to something more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1
is renamed to vpcservice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1
is rename to vpcClient
cmd/capibmadm/cmd/vpc/key/create.go
Outdated
# Create key in VPC | ||
export IBMCLOUD_API_KEY=<api-key> | ||
capibmadm vpc key create --name <key-name> --region <region> --resource-group-name <resource-group-name> | ||
--public-key <public-key-string> `, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be withing quotations right, like --public-key-string ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
can we represent like this?
--public-key "<public-key-string>"
any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we need to represent like
--public-key "<public-key-string>"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
cmd/capibmadm/cmd/vpc/key/create.go
Outdated
options.AddCommonFlags(cmd) | ||
var keyCreateOption keyCreateOptions | ||
cmd.Flags().StringVar(&keyCreateOption.name, "name", keyCreateOption.name, "Key Name") | ||
cmd.Flags().StringVar(&keyCreateOption.resourceGroupName, "resource-group-name", keyCreateOption.resourceGroupName, "IBM cloud resource group name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource-group-name flag is already available under vpc: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/cmd/capibmadm/cmd/vpc/vpc.go#L34, so we can remove it from here
cmd/capibmadm/cmd/vpc/key/create.go
Outdated
|
||
func createKey(ctx context.Context, keyCreateOption keyCreateOptions) error { | ||
log := logf.Log | ||
vpcservice, err := vpc.NewV1Client(options.GlobalOptions.VPCRegion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets name is as vpcService.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Karthik-K-N how about vpcClient
or vpcClientService
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel vpcClient
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we can go ahead with vpcClient,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1
is renamed to vpcClient
cmd/capibmadm/cmd/vpc/key/create.go
Outdated
|
||
key, _, err := vpcservice.CreateKey(options) | ||
if err == nil { | ||
log.Info("VPC Key created successfully,", "key id", *key.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better we log key name instead ID,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
cmd/capibmadm/cmd/vpc/key/delete.go
Outdated
} | ||
|
||
if keyID == "" { | ||
return fmt.Errorf("key with the specified name could not be found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("key with the specified name could not be found") | |
return fmt.Errorf("specified key %s could not be found", keyDeleteOption.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
cmd/capibmadm/cmd/vpc/key/delete.go
Outdated
|
||
_, err = vpcservice.DeleteKey(options) | ||
if err == nil { | ||
log.Info("VPC Key deleted succssfully, ", " key name", keyDeleteOption.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove empty spaces and lets change "key name" to "key-name"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/test all |
7c79eb8
to
3c57e47
Compare
d41b4d6
to
b9208df
Compare
@Madhan-SWE please fix the conflicts. |
b9208df
to
308e6f1
Compare
308e6f1
to
d8d7c9b
Compare
Co-authored-by: Prajyot Parab <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Madhan-SWE, Prajyot-Parab The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Co-authored-by: Manjunath Kumatagi <[email protected]> Co-authored-by: Prajyot Parab <[email protected]>
New changes are detected. LGTM label has been removed. |
This PR contains merge commits which can cause rebasing issues. Created a new PR with all the required changes in a single commit : #1113 |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/close |
@Madhan-SWE: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
This is for creating and deleting key from VPC.
Create key
Delete key
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
/area provider/ibmcloud
Release note: