refactor(yaml): globalize fixups

The ToK8SYaml() function makes the job, it's now simpler to manage fixes
This commit is contained in:
2024-11-09 14:18:27 +01:00
parent 9b392a1f64
commit b09316b416
9 changed files with 34 additions and 34 deletions

View File

@@ -9,7 +9,6 @@ import (
"github.com/compose-spec/compose-go/types"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)
var (
@@ -97,11 +96,11 @@ func (s *Secret) SetData(data map[string]string) {
// Yaml returns the yaml representation of the secret.
func (s *Secret) Yaml() ([]byte, error) {
y, err := yaml.Marshal(s)
if err != nil {
var y []byte
var err error
if y, err = ToK8SYaml(s); err != nil {
return nil, err
}
y = UnWrapTPL(y)
// replace the b64 value by the real value
for _, value := range s.Data {