-
Notifications
You must be signed in to change notification settings - Fork 10
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
Adds support for VPC #200
base: master
Are you sure you want to change the base?
Adds support for VPC #200
Conversation
Welcome @prabhav-thali! It looks like this is your first PR to ppc64le-cloud/kubetest2-plugins 🎉 |
Hi @prabhav-thali. Thanks for your PR. I'm waiting for a ppc64le-cloud member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
can you please post the ansible code outside of this PR? |
Yes, sure. I'll raise another PR to update ansible submodule |
8d159c4
to
873805b
Compare
Makefile
Outdated
@@ -14,7 +15,7 @@ INSTALL_DIR?=$(shell $(REPO_ROOT)/hack/goinstalldir.sh) | |||
# the output binary name, overridden when cross compiling | |||
BINARY_NAME=kubetest2-tf | |||
BINARY_PATH=./kubetest2-tf | |||
BUILD_FLAGS=-trimpath -ldflags="-buildid= -X=github.com/ppc64le-cloud/kubetest2-plugins/kubetest2-tf/deployer.GitTag=$(COMMIT)" | |||
BUILD_FLAGS=-trimpath -ldflags="-buildid= -X=github.com/ppc64le-cloud/kubetest2-plugins/kubetest2-tf/deployer.GitTag=$(COMMIT) -X=github.com/ppc64le-cloud/kubetest2-plugins/kubetest2-tf/deployer.TargetProvider=$(PROVIDER)" |
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.
already build mechanism is not that great for this project, lets not add one more to it, lets decide the provider based some flag runtime instead of buildtime.
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 will the code post this change.
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.
Let me check how we can handle this during runtime instead of buildtime.
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.
overall lgtm except few minor comments
kubetest2-tf/deployer/deployer.go
Outdated
@@ -81,6 +82,7 @@ type deployer struct { | |||
Playbook string `desc:"name of ansible playbook to be run"` | |||
ExtraVars map[string]string `desc:"Passes extra-vars to ansible playbook, enter a string of key=value pairs"` | |||
SetKubeconfig bool `desc:"Flag to set kubeconfig"` | |||
TargetProvider string `json:"provider value to be used"` |
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.
TargetProvider string `json:"provider value to be used"` | |
TargetProvider string `desc:"provider value to be used(powervs, vpc)"` |
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.
Implemented this
kubetest2-tf/deployer/deployer.go
Outdated
if targetProvider == "" { | ||
targetProvider = os.Getenv("TARGET_PROVIDER") | ||
} | ||
if targetProvider == "" { | ||
return fmt.Errorf("provider not specified. Use --provider or set the TARGET_PROVIDER environment variable") | ||
} |
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 set the default value as powervs and remove this check and also lets avoid reading from env for now.
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, kept powervs as default
kubetest2-tf/deployer/deployer.go
Outdated
@@ -142,6 +159,7 @@ func New(opts types.Options) (types.Deployer, *pflag.FlagSet) { | |||
} | |||
klog.InitFlags(nil) | |||
flagSet.AddGoFlagSet(goflag.CommandLine) | |||
flagSet.StringVar(&d.TargetProvider, "target-provider", "powervs", "The provider to use (vpc or powervs)") |
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.
this is not required if you use desc
as above
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.
instead add an entry here https://github.com/mkumatag/kubetest2-plugins/blob/df90d8a23d4dadc5fa18cc18ba3e191f181472e4/kubetest2-tf/deployer/deployer.go#L137 to set the default as follows
SetKubeconfig: true,
TargetProvider: "powervs"
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.
Implemented the change.
Thanks for the suggestions. I will post an update here once review comments are implemented and testing is complete. |
change this description as well in the end |
/ok-to-test |
f64abd9
to
cfc45ab
Compare
kubetest2-tf/deployer/deployer.go
Outdated
@@ -81,6 +82,7 @@ type deployer struct { | |||
Playbook string `desc:"name of ansible playbook to be run"` | |||
ExtraVars map[string]string `desc:"Passes extra-vars to ansible playbook, enter a string of key=value pairs"` | |||
SetKubeconfig bool `desc:"Flag to set kubeconfig"` | |||
TargetProvider string `flag:"~target-provider" desc:"provider value to be used(powervs, vpc)"` |
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 think flag tag is not required, can you check ones?
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.
and also for all the go files you have added
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.
Removed the flag tag.
kubetest2-tf/deployer/deployer.go
Outdated
@@ -135,6 +143,7 @@ func New(opts types.Options) (types.Deployer, *pflag.FlagSet) { | |||
RetryOnTfFailure: 1, | |||
Playbook: "install-k8s.yml", | |||
SetKubeconfig: true, | |||
TargetProvider: "powervs", |
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.
please run the go fmt
on this file
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 formatted the files.
cfc45ab
to
3a4f035
Compare
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
/hold
for @Rajalakshmi-Girish @Prajyot-Parab 's review
/cc @Prajyot-Parab |
will review by today. |
|
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.
As @Prajyot-Parab mentioned, it might be better to avoid a folder structure like having a 'vpc' directory inside another 'vpc'. Otherwise, it looks good to me based on my basic understanding of Terraform, considering the structure and resource creation in the Terraform files at a high level.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mkumatag, prabhav-thali, Rajalakshmi-Girish The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please fix these comments, will merge the PR |
Adds support for VPC resources. By default,
make install-deployer-tf
will build for powervs. To use vpc provider pass--provider vpc
inkubetest2 tf
command. This provider value is mapped to TargetProvider variable in deployer.go which allows to select vpc provider. By default, it is powervs.