mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Add certlist.go - a declarative list of all certs kubeadm requires
* Sub out New*CertAndKey for functions using the new certlist
This commit is contained in:
parent
742b258ca2
commit
f5e9eb8674
@ -17,7 +17,9 @@ limitations under the License.
|
||||
package certs
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
"crypto/rsa"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -803,3 +805,17 @@ func TestCreateCertificateFilesMethods(t *testing.T) {
|
||||
testutil.AssertFileExists(t, tmpdir, test.expectedFiles...)
|
||||
}
|
||||
}
|
||||
|
||||
func parseCertAndKey(basePath string, t *testing.T) (*x509.Certificate, crypto.PrivateKey) {
|
||||
certPair, err := tls.LoadX509KeyPair(basePath+".crt", basePath+".key")
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't parse certificate and key: %v", err)
|
||||
}
|
||||
|
||||
parsedCert, err := x509.ParseCertificate(certPair.Certificate[0])
|
||||
if err != nil {
|
||||
t.Fatalf("couldn't parse certificate: %v", err)
|
||||
}
|
||||
|
||||
return parsedCert, certPair.PrivateKey
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user