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

Changes to support Secret Credential type for azure #1275

Merged
merged 13 commits into from
Mar 24, 2022

Conversation

bathina2
Copy link
Contributor

@bathina2 bathina2 commented Mar 10, 2022

Change Overview

The following PR enables Secret Credetial type for azure. This allows us to pass the azure cloud environment down as an argument in the secret.

This PR also uses an updated stow version.

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

  • #XXX

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Merge branch 'master' of https://github.com/kanisterio/kanister into profile-secret-change
Merge branch 'master' of https://github.com/kanisterio/kanister into profile-secret-change
pkg/validate/validate.go Show resolved Hide resolved
pkg/secrets/azure.go Show resolved Hide resolved
pkg/kanctl/profile.go Show resolved Hide resolved
@bathina2 bathina2 changed the title Initial changes to support Secret Credential type for azure Changes to support Secret Credential type for azure Mar 17, 2022
Copy link
Contributor

@pavannd1 pavannd1 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/secrets/azure.go Outdated Show resolved Hide resolved
pkg/secrets/azure.go Outdated Show resolved Hide resolved
Copy link
Contributor

@onkarbhat onkarbhat left a comment

Choose a reason for hiding this comment

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

LGTM. Couple of minor comments.

@@ -234,26 +233,59 @@ func getLocationParams(cmd *cobra.Command) (*locationParams, error) {
}, nil
}

func constructProfile(lP *locationParams, secret *v1.Secret, role string) *v1alpha1.Profile {
func constructProfile(lP *locationParams, secret *v1.Secret) *v1alpha1.Profile {
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that there are no unit tests for testing either constructProfile/constructSecret or even the caller createNewProfile(used in newAzureProfileCmd/newGCPProfileCmd/newS3CompliantProfileCmd). It would be useful to add tests using fake kube clients.

retCredType: v1alpha1.CredentialTypeKeyPair,
},
} {
prof := constructProfile(tc.lp, tc.secret)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nice. I read the test file after adding my comment about testing in profile.go. Happy to see that you have already added the test 👍🏼 .

azSecret.EnvironmentName = string(envName)
}
if azSecret.StorageAccount == "" || azSecret.StorageKey == "" {
return nil, errors.New("Azure secret is missing storage account name or storage key")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, errors.New("Azure secret is missing storage account name or storage key")
return nil, errors.New("Azure secret is missing storage account ID or storage key")

// The following is KeyPair codepath
kp := p.Credential.KeyPair
if kp == nil {
return nil, errorf(validateErr, "Invalid credentials kv cannot be nil")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, errorf(validateErr, "Invalid credentials kv cannot be nil")
return nil, errorf(validateErr, "Invalid credentials kp cannot be nil")

@shuguet shuguet added this to Reviewer approved in Kanister Mar 23, 2022
@bathina2 bathina2 added the kueue label Mar 23, 2022
@pavannd1 pavannd1 removed the kueue label Mar 23, 2022
@pavannd1
Copy link
Contributor

@bathina2 Removing kueue temporarily. Seems like Travis CI is backlogged on a lot of attempted CI runs. Clearing it up a bit

@pavannd1 pavannd1 added the kueue label Mar 24, 2022
@mergify mergify bot merged commit ac4bbb7 into master Mar 24, 2022
Kanister automation moved this from Reviewer approved to Done Mar 24, 2022
@mergify mergify bot deleted the profile-secret-change branch March 24, 2022 01:50
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.

None yet

4 participants