Commit 40c6128b authored by Alessio Caiazza's avatar Alessio Caiazza

Fix broken certificate-authority-data with kubectl >= 1.8.0

parent f1b8d79f
---
title: 'Kubernetes integration: ensure v1.8.0 compatibility'
merge_request: 14635
author:
type: fixed
...@@ -113,7 +113,7 @@ module Gitlab ...@@ -113,7 +113,7 @@ module Gitlab
def kubeconfig_embed_ca_pem(config, ca_pem) def kubeconfig_embed_ca_pem(config, ca_pem)
cluster = config.dig(:clusters, 0, :cluster) cluster = config.dig(:clusters, 0, :cluster)
cluster[:'certificate-authority-data'] = Base64.encode64(ca_pem) cluster[:'certificate-authority-data'] = Base64.strict_encode64(ca_pem)
end end
end end
end end
...@@ -4,7 +4,7 @@ clusters: ...@@ -4,7 +4,7 @@ clusters:
- name: gitlab-deploy - name: gitlab-deploy
cluster: cluster:
server: https://kube.domain.com server: https://kube.domain.com
certificate-authority-data: "UEVN\n" certificate-authority-data: "UEVN"
contexts: contexts:
- name: gitlab-deploy - name: gitlab-deploy
context: context:
......
...@@ -208,7 +208,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do ...@@ -208,7 +208,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
config.dig('users', 0, 'user')['token'] = 'token' config.dig('users', 0, 'user')['token'] = 'token'
config.dig('contexts', 0, 'context')['namespace'] = namespace config.dig('contexts', 0, 'context')['namespace'] = namespace
config.dig('clusters', 0, 'cluster')['certificate-authority-data'] = config.dig('clusters', 0, 'cluster')['certificate-authority-data'] =
Base64.encode64('CA PEM DATA') Base64.strict_encode64('CA PEM DATA')
YAML.dump(config) YAML.dump(config)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment