-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to support Secret Credential type for azure (#1275)
* Initial changes to support Secret Credential type for azure * update comments * update stow * Updated stow and added UTs * remove comments * remove trailing white space * after reviews Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e49103b
commit ac4bbb7
Showing
16 changed files
with
771 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package kanctl | ||
|
||
import ( | ||
"github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1" | ||
"github.com/kanisterio/kanister/pkg/secrets" | ||
check "gopkg.in/check.v1" | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func (k *KanctlTestSuite) TestConstructProfile(c *check.C) { | ||
for _, tc := range []struct { | ||
lp *locationParams | ||
secret *v1.Secret | ||
retCredType v1alpha1.CredentialType | ||
}{ | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeS3Compliant, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
StringData: map[string]string{ | ||
secrets.ConfigRole: "role", | ||
}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeSecret, | ||
}, | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeAzure, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
StringData: map[string]string{ | ||
secrets.AzureStorageEnvironment: "env", | ||
}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeSecret, | ||
}, | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeAzure, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
StringData: map[string]string{ | ||
secrets.AzureStorageEnvironment: "", | ||
}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeKeyPair, | ||
}, | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeAzure, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
StringData: map[string]string{}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeKeyPair, | ||
}, | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeGCS, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeKeyPair, | ||
}, | ||
{ | ||
lp: &locationParams{ | ||
locationType: v1alpha1.LocationTypeS3Compliant, | ||
}, | ||
secret: &v1.Secret{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "sec", | ||
Namespace: "ns", | ||
}, | ||
}, | ||
retCredType: v1alpha1.CredentialTypeKeyPair, | ||
}, | ||
} { | ||
prof := constructProfile(tc.lp, tc.secret) | ||
c.Assert(prof.Credential.Type, check.Equals, tc.retCredType) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.