mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-03 03:12:00 +08:00
Merge pull request #2646 from aryan9600/fix-mask-sops
This commit is contained in:
@ -21,6 +21,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@ -343,7 +344,11 @@ func maskSopsData(res *resource.Resource) error {
|
|||||||
res.PipeE(yaml.FieldClearer{Name: "sops"})
|
res.PipeE(yaml.FieldClearer{Name: "sops"})
|
||||||
|
|
||||||
secretType, err := res.GetFieldValue(typeField)
|
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)
|
return fmt.Errorf("failed to mask secret %s sops data: %w", res.GetName(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user