kustomize-controller icon indicating copy to clipboard operation
kustomize-controller copied to clipboard

MalformedYAMLError when kustomize remote base can’t be accessed

Open zahodi opened this issue 11 months ago • 6 comments

Flux is unable to kustomize a kustomization object with https url resource in.

Warning BuildFailed 2m (x33 over 5h12m) kustomize-controller kustomize build failed: accumulating resources: accumulating resources from 'https://gitlab.interl.url/repo/repo-library.git//library?ref=xxxxxxxxxxxx': MalformedYAMLError: yaml: line 3: mapping values are not allowed in this context in File: https://gitlab.internal.url/repo/repo-library.git//library?ref=xxxxxxxxxxx

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
 - "https://gitlab.internal.url/repo/repo-library.git//library?ref=xxxxxxxxxxxx"

zahodi avatar Jul 31 '23 23:07 zahodi

Does it work with kustomize build .?

stefanprodan avatar Aug 01 '23 07:08 stefanprodan

both kubectl kustomize and kustomize binary directly work

zahodi avatar Aug 01 '23 15:08 zahodi

Is that repository public? Can you also post here your flux check output please.

stefanprodan avatar Aug 01 '23 16:08 stefanprodan

➜ flux check
► checking prerequisites
✔ Kubernetes 1.24.9+rke2r2 >=1.24.0-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.32.2
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.0.0-rc.2
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.0.0-rc.2
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.0.0-rc.2
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta2
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta2
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed

zahodi avatar Aug 02 '23 20:08 zahodi

the repo is private, for now I was able to workaround the issue by adding the url kustomize object as a submodule and then referencing a local directory vs a remote url. Not sure if this was an issue with authentication that looked like kustomization parsing error.

zahodi avatar Aug 02 '23 20:08 zahodi

Yeah looks like Kustomize v5 has a bug where it shows MalformedYAMLError instead of network errors. We don’t recommend using remote bases, nor do we support private repos like that, using Flux GitRepositories is how you can fetch manifests from Git and unlike Kustomize, we do cache them.

stefanprodan avatar Aug 03 '23 06:08 stefanprodan