Skip to content

Commit

Permalink
Merge pull request #2646 from aryan9600/fix-mask-sops
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco authored Apr 19, 2022
2 parents e25bb74 + 5c9cbe6 commit 52f1bfe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"os"
"sync"
Expand Down Expand Up @@ -343,7 +344,11 @@ func maskSopsData(res *resource.Resource) error {
res.PipeE(yaml.FieldClearer{Name: "sops"})

secretType, err := res.GetFieldValue(typeField)
if err != nil {
// If the intented type is Opaque, then it can be omitted from the manifest, since it's the default
// Ref: https://kubernetes.io/docs/concepts/configuration/secret/#opaque-secrets
if errors.As(err, &yaml.NoFieldError{}) {
secretType = "Opaque"
} else if err != nil {
return fmt.Errorf("failed to mask secret %s sops data: %w", res.GetName(), err)
}

Expand Down

0 comments on commit 52f1bfe

Please sign in to comment.