-
Notifications
You must be signed in to change notification settings - Fork 890
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
Feat: Support SSH for retrieving terraform modules in private git repo #5059
Conversation
Codecov ReportBase: 49.60% // Head: 61.08% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5059 +/- ##
===========================================
+ Coverage 49.60% 61.08% +11.47%
===========================================
Files 304 305 +1
Lines 45429 45499 +70
===========================================
+ Hits 22537 27792 +5255
+ Misses 20544 14846 -5698
- Partials 2348 2861 +513
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
0667c40
to
bcd07a8
Compare
Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com>
Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com>
Signed-off-by: motilayo <joshuaagboola@live.ca>
…date secret, improve known_hosts logic Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
Signed-off-by: motilayo <joshuaagboola@live.ca>
@wonderflow Please review when you get a chance. I've added some tests and rebased my branch with the master branch. |
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 after nit.
@@ -724,6 +724,10 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu | |||
configuration.Spec.ProviderReference = wl.FullTemplate.ComponentDefinition.Spec.Schematic.Terraform.ProviderReference | |||
} | |||
|
|||
if configuration.Spec.GitCredentialsSecretReference == nil { | |||
configuration.Spec.GitCredentialsSecretReference = wl.FullTemplate.ComponentDefinition.Spec.Schematic.Terraform.GitCredentialsSecretReference |
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.
what if the value is still nil?
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.
Then it's ok to have no credentials. Like when it is a public repo.
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.
great job, generally LGTM!
Signed-off-by: motilayo <joshuaagboola@live.ca>
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! Please fix tests.
Signed-off-by: motilayo <joshuaagboola@live.ca>
kubevela#5059) * Feat: Support SSH for retrieving terraform modules in private git repo Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> * fix lint errors Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> * fix gofmt lint error Signed-off-by: motilayo <joshuaagboola@live.ca> * update gitCredentialsReference to gitCredentialsSecretReference, validate secret, improve known_hosts logic Signed-off-by: motilayo <joshuaagboola@live.ca> * SImplify logic to get publickey Signed-off-by: motilayo <joshuaagboola@live.ca> * Set known_hosts and export SSH_KNOWN_HOSTS Signed-off-by: motilayo <joshuaagboola@live.ca> * Call GetGitSSHPublicKey for cli Signed-off-by: motilayo <joshuaagboola@live.ca> * fix parser.go - nil check for ref.Client Signed-off-by: motilayo <joshuaagboola@live.ca> * Unit test for GetGitSSHPublicKey Signed-off-by: motilayo <joshuaagboola@live.ca> * improve test coverage Signed-off-by: motilayo <joshuaagboola@live.ca> * make reviewable Signed-off-by: motilayo <joshuaagboola@live.ca> * minor improvements & cleanup Signed-off-by: motilayo <joshuaagboola@live.ca> * update secret name in test Signed-off-by: motilayo <joshuaagboola@live.ca> Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> Signed-off-by: motilayo <joshuaagboola@live.ca>
kubevela#5059) * Feat: Support SSH for retrieving terraform modules in private git repo Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> * fix lint errors Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> * fix gofmt lint error Signed-off-by: motilayo <joshuaagboola@live.ca> * update gitCredentialsReference to gitCredentialsSecretReference, validate secret, improve known_hosts logic Signed-off-by: motilayo <joshuaagboola@live.ca> * SImplify logic to get publickey Signed-off-by: motilayo <joshuaagboola@live.ca> * Set known_hosts and export SSH_KNOWN_HOSTS Signed-off-by: motilayo <joshuaagboola@live.ca> * Call GetGitSSHPublicKey for cli Signed-off-by: motilayo <joshuaagboola@live.ca> * fix parser.go - nil check for ref.Client Signed-off-by: motilayo <joshuaagboola@live.ca> * Unit test for GetGitSSHPublicKey Signed-off-by: motilayo <joshuaagboola@live.ca> * improve test coverage Signed-off-by: motilayo <joshuaagboola@live.ca> * make reviewable Signed-off-by: motilayo <joshuaagboola@live.ca> * minor improvements & cleanup Signed-off-by: motilayo <joshuaagboola@live.ca> * update secret name in test Signed-off-by: motilayo <joshuaagboola@live.ca> Signed-off-by: motilayo <44736801+motilayo@users.noreply.github.com> Signed-off-by: motilayo <joshuaagboola@live.ca>
Support SSH for retrieving terraform modules in private git repo
Enable support for terraform modules in private git repo through SSH. A kubernetes secret which holds the ssh private-key and known_hosts should be created and referenced in the component definition.
Terraform controller PR: kubevela/terraform-controller#349
Feature for kubevela/terraform-controller#292
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Tested in a local cluster.
kubernetes.io/ssh-auth
for the git ssh credentials & known-hostsSpecial notes for your reviewer