Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

Commit 0e5f2af

Browse files
authored
Merge pull request #20 from flanksource/store-marshalled-yaml
Attempt to store requests as marshalled yaml
2 parents ecb3dd7 + 1205292 commit 0e5f2af

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

controllers/gitopsapi_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ func serve(c echo.Context, r *GitopsAPIReconciler) error {
127127
return c.String(http.StatusInternalServerError, err.Error())
128128
}
129129

130+
prettyYaml, err := yaml.Marshall(obj.Object)
131+
if err != nil {
132+
r.Log.Error(err, "error marshalling to yaml, falling back to plaintext")
133+
} else {
134+
body = prettyYaml
135+
}
136+
130137
r.Log.Info("Received", "name", name, "namespace", namespace, "body", obj.GetName())
131138

132139
kustomizationPath, err := text.Template(api.Spec.Kustomization, obj.Object)

0 commit comments

Comments
 (0)