illegal base64 data at input with k8s autodevops
Summary
I'm using Auto Devops with an on-premise k8s.
Deploy using k8s fails with "illegal base64 data at input byte", in the output the certificate-authority-data
field has a lot of \n
which I think shouldn't be there.
I think because we're using Base64.encode64
which will add line feed
Returns the Base64-encoded version of bin. This method complies with RFC 2045. Line feeds are added to every 60 encoded characters.
Instead of Base64.strict_encode64
which will not add linefeed
What is the current bug behavior?
error: Error loading config file "/csoc/slowfield.tmp/KUBECONFIG": v1.Config: Contexts: []v1.NamedContext: Clusters: []v1.NamedCluster: v1.NamedCluster: Name: Cluster: v1.Cluster: Server: CertificateAuthorityData: decode base64: illegal base64 data at input byte 60, parsing 1558 ...S0tLS0=\n"... at {"apiVersion":"v1","clusters":[{"cluster":{"certificate-authority-data":"xxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxx=\n"
What is the expected correct behavior?
No error
Possible fixes
I can fix the issue by change the file lib/gitlab/kubernetes.rb
Change Base64.encode64(ca_pem)
to Base64.strict_encode64(ca_pem)