-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add secret type for Param.Credentials (#300)
* Add AWS secret support for Param * Change crendential unionn type to v1.Secret * Refactor validation * Remove unused function
- Loading branch information
1 parent
f2dc494
commit ad3cbce
Showing
2 changed files
with
43 additions
and
0 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,21 @@ | ||
package secrets | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
v1 "k8s.io/api/core/v1" | ||
) | ||
|
||
// ValidateCredentials returns error if secret is failed at validation. | ||
// Currently supports following: | ||
// - AWS typed secret with required AWS secret fields. | ||
func ValidateCredentials(secret *v1.Secret) error { | ||
if secret == nil { | ||
return errors.New("Nil secret") | ||
} | ||
switch string(secret.Type) { | ||
case AWSSecretType: | ||
return ValidateAWSCredentials(secret) | ||
default: | ||
return errors.Errorf("Unsupported type '%s' for secret '%s:%s'", string(secret.Type), secret.Namespace, secret.Name) | ||
} | ||
} |