Commit 74ca1045 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49750 from danehans/kubeadm_tolower_certs

Automatic merge from submit-queue (batch tested with PRs 49538, 49708, 47665, 49750, 49528) Lowercases hostname for kubeadm cert slice **What this PR does / why we need it**: Previously, unit tests on master were failing due to this error: ``` --- FAIL: TestSubCmdApiServerFlags (0.99s) certs_test.go:149: APIserverCert.DNSNames[0] is danehans-m-c1kp instead of DANEHANS-M-C1KP ``` The PR fixes the TestSubCmdApiServerFlags test, which uses the OS hostname to compare the apiserver serving cert and fails if the OS hostname is in caps. **Which issue this PR fixes**: fixes # https://github.com/kubernetes/kubeadm/issues/361 **Special notes for your reviewer**: **Release note**: ```NONE ```
parents 7be28a15 3d6a24c4
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path" "path"
"strings"
"testing" "testing"
"github.com/renstrom/dedent" "github.com/renstrom/dedent"
...@@ -144,7 +145,7 @@ func TestSubCmdApiServerFlags(t *testing.T) { ...@@ -144,7 +145,7 @@ func TestSubCmdApiServerFlags(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("couldn't get the hostname: %v", err) t.Errorf("couldn't get the hostname: %v", err)
} }
for i, name := range []string{hostname, "kubernetes", "kubernetes.default", "kubernetes.default.svc", "kubernetes.default.svc.mycluster.local"} { for i, name := range []string{strings.ToLower(hostname), "kubernetes", "kubernetes.default", "kubernetes.default.svc", "kubernetes.default.svc.mycluster.local"} {
if APIserverCert.DNSNames[i] != name { if APIserverCert.DNSNames[i] != name {
t.Errorf("APIserverCert.DNSNames[%d] is %s instead of %s", i, APIserverCert.DNSNames[i], name) t.Errorf("APIserverCert.DNSNames[%d] is %s instead of %s", i, APIserverCert.DNSNames[i], name)
} }
......
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