yaml: invalid trailing UTF-8 octet (Kustomize parse errors)
Summary
Issue while kustomize the Helm Chart.
Error: yaml: invalid trailing UTF-8 octet
Error as below
Error: map[string]interface {}{"apiVersion":"rbac.authorization.k8s.io/v1beta1", "kind":"ClusterRole", "metadata":map[string]interface {}{"labels":map[string]interface {}{"app":"cert-manager", "app.kubernetes.io/instance":"gitlab", "app.kubernetes.io/managed-by":"Helm", "app.kubernetes.io/name":"cert-manager", "helm.sh/chart":"certmanager-v0.10.1"}, "name":"gitlab-cert-manager-controller-certificates"}, "rules":[]interface {}{map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates", "certificates/status", "certificaterequests", "certificaterequests/status"}, "verbs":[]interface {}{"update"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates", "certificaterequests", "clusterissuers", "issuers", "orders"}, "verbs":[]interface {}{"get", "list", "watch"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates/finalizers"}, "verbs":[]interface {}{"update"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"orders"}, "verbs":[]interface {}{"create", "delete"}}, map[string]interface {}{"apiGroups":[]interface {}{""}, "resources":[]interface {}{"secrets"}, "verbs":[]interface {}{"get", "list", "watch", "create", "update", "delete"}}, map[string]interface {}{"apiGroups":[]interface {}{""}, "resources":[]interface {}{"events"}, "verbs":[]interface {}{"create", "patch"}}}}: yaml: invalid trailing UTF-8 octet
There are five places with non-UTF-8 character for this lines "# admission controller enabled:" & " # DNS01 rules (duplicated above)", I have attached an image.
kind: ClusterRole
metadata:
name: gitlab-cert-manager-controller-certificates
...
# admission controller enabled:
-----
kind: ClusterRole
metadata:
name: gitlab-cert-manager-controller-orders
...
# admission controller enabled:
----
kind: ClusterRole
metadata:
name: gitlab-cert-manager-controller-challenges
..
# admission controller enabled:
----
kind: ClusterRole
metadata:
name: gitlab-cert-manager-controller-challenges
..
# DNS01 rules (duplicated above)
----
kind: ClusterRole
metadata:
name: gitlab-cert-manager-controller-ingress-shim
...
# admission controller enabled:
Image of non UTF-8 Character
I found this non UTF-8 character. After I replaced it with regular space, it solved the issue.
Previous or open issues
There are other issues in chart too, I have been requested to create new issue for this "invalid trailing UTF-8 octet " issue.
Other issues including this one #2582 (comment 522354218) #2582 (closed)
Request by developer #2582 (comment 523161636)
Steps to reproduce
Using Kustomize
kustomize build .
I am not patching yet and I have all rendered manifest data in all.YAML using command helm install --dry-run
# Kustomization.yaml
resources:
- all.yaml
and I am having the following issues running command kustomize build .
.
Error: map[string]interface {}{"apiVersion":"rbac.authorization.k8s.io/v1beta1", "kind":"ClusterRole", "metadata":map[string]interface {}{"labels":map[string]interface {}{"app":"cert-manager", "app.kubernetes.io/instance":"gitlab", "app.kubernetes.io/managed-by":"Helm", "app.kubernetes.io/name":"cert-manager", "helm.sh/chart":"certmanager-v0.10.1"}, "name":"gitlab-cert-manager-controller-certificates"}, "rules":[]interface {}{map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates", "certificates/status", "certificaterequests", "certificaterequests/status"}, "verbs":[]interface {}{"update"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates", "certificaterequests", "clusterissuers", "issuers", "orders"}, "verbs":[]interface {}{"get", "list", "watch"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"certificates/finalizers"}, "verbs":[]interface {}{"update"}}, map[string]interface {}{"apiGroups":[]interface {}{"certmanager.k8s.io"}, "resources":[]interface {}{"orders"}, "verbs":[]interface {}{"create", "delete"}}, map[string]interface {}{"apiGroups":[]interface {}{""}, "resources":[]interface {}{"secrets"}, "verbs":[]interface {}{"get", "list", "watch", "create", "update", "delete"}}, map[string]interface {}{"apiGroups":[]interface {}{""}, "resources":[]interface {}{"events"}, "verbs":[]interface {}{"create", "patch"}}}}: yaml: invalid trailing UTF-8 octet
Configuration used
There were few patches that I needed to apply on top of GitLab helm chart and I used kustomize for that. Please check steps to reproduce for the helm command with parameters
Current behavior
Using helm command to deploy GitLab into Kubernetes works without any error. However, kustomize command fails to parse yaml generated by helm command. Search for the listed filename paths (see summary) inside all.yaml and you should notice the yaml syntax issues. Fixing those errors manually made kustomize command parse yaml correctly.
Image of non UTF-8 Character
Expected behavior
Helm chart should always generate a clean and valid yaml file.
Versions
- Chart: gitlab-4.9.1.tgz
- Platform:
- Cloud: (ALL)
- Self-hosted: (NA)
- Kubernetes: (
kubectl version
)- Client: NA
- Server: NA
- Helm: (
helm version
)- BuildInfo{Version:"v3.5.2", GitCommit:"167aac70832d3a384f65f9745335e9fb40169dc2", GitTreeState:"dirty", GoVersion:"go1.15.7"}
- Operating: (
Operating System
)- NAME="Red Hat Enterprise Linux Server"
- VERSION="7.6 (Maipo)"
Relevant logs
I was stressed out to find the problem in kustomize, but there is a problem in Chart: GitLab-4.9.1.tgz. Also, Rendered YAML is more than 15,000 lines, very thought to identify the issues.