From 25c2bf0e1f2e1ee05c7c99eead7b3b9a926168d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?=
 <charled.breteche@gmail.com>
Date: Thu, 5 May 2022 15:26:55 +0200
Subject: [PATCH] fix: remove k8s apiserver from self-generated cert (#3803)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Co-authored-by: shuting <shuting@nirmata.com>
---
 pkg/tls/tls.go | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go
index a678a6690e..51b505a533 100644
--- a/pkg/tls/tls.go
+++ b/pkg/tls/tls.go
@@ -129,19 +129,11 @@ func GenerateCertPem(caCert *KeyPair, props CertificateProps, serverIP string, c
 	dnsNames[2] = commonName
 
 	var ips []net.IP
-	apiServerIP := net.ParseIP(props.APIServerHost)
-	if apiServerIP != nil {
-		ips = append(ips, apiServerIP)
-	} else {
-		dnsNames = append(dnsNames, props.APIServerHost)
-	}
-
 	if serverIP != "" {
 		if strings.Contains(serverIP, ":") {
 			host, _, _ := net.SplitHostPort(serverIP)
 			serverIP = host
 		}
-
 		ip := net.ParseIP(serverIP)
 		ips = append(ips, ip)
 	}