Skip to content

Commit

Permalink
Log error when Secret is not retrieved
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Kenis committed Jan 16, 2024
1 parent 66b308b commit ea9c32e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ FROM scratch
COPY --from=build /go/bin/velero-plugin-for-aws /plugins/
COPY --from=build /go/bin/cp-plugin /bin/cp-plugin
USER 65532:65532
ENTRYPOINT ["cp-plugin", "/plugins/velero-plugin-for-aws", "/target/velero-plugin-for-aws"]
ENTRYPOINT ["cp-plugin", "/plugins/velero-plugin-for-aws", "/target/velero-plugin-for-aws-with-credentials"]
5 changes: 4 additions & 1 deletion velero-plugin-for-aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ func loadCredentialsFromSecret(name string) (aws.Credentials, error) {
// We don't do error handling for now
cfg, _ := rest.InClusterConfig()
clientset, _ := kubernetes.NewForConfig(cfg)
secret, _ := clientset.CoreV1().Secrets("velero").Get(context.Background(), name, v1.GetOptions{})
secret, err := clientset.CoreV1().Secrets("velero").Get(context.Background(), name, v1.GetOptions{})
if err != nil {
return aws.Credentials{}, err
}
return aws.Credentials{
AccessKeyID: string(secret.Data["AWS_ACCESS_KEY_ID"]),
SecretAccessKey: string(secret.Data["AWS_SECRET_ACCESS_KEY"]),
Expand Down

0 comments on commit ea9c32e

Please sign in to comment.