1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-29 02:45:06 +00:00

fix: remove k8s apiserver from self-generated cert (#3803)

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

Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2022-05-05 15:26:55 +02:00 committed by GitHub
parent 13d8a96f92
commit 25c2bf0e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}