mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Merge pull request #46977 from php-coder/improve_cert_controller_logging
Automatic merge from submit-queue newCFSSLSigner: improve error reporting by including file name in the message **What this PR does / why we need it**: This PR improves error reporting by including an action and a file name into the error message. Before: >E0605 17:01:57.020485 29156 certificates.go:38] Failed to start certificate controller: open : no such file or directory After: >E0605 18:21:32.375884 4896 certificates.go:38] Failed to start certificate controller: error reading CA file "": open : no such file or directory **Release note**: ```release-note NONE ``` CC @mfojtik
This commit is contained in:
commit
d062629543
@ -64,16 +64,16 @@ type cfsslSigner struct {
|
|||||||
func newCFSSLSigner(caFile, caKeyFile string, client clientset.Interface, certificateDuration time.Duration) (*cfsslSigner, error) {
|
func newCFSSLSigner(caFile, caKeyFile string, client clientset.Interface, certificateDuration time.Duration) (*cfsslSigner, error) {
|
||||||
ca, err := ioutil.ReadFile(caFile)
|
ca, err := ioutil.ReadFile(caFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("error reading CA cert file %q: %v", caFile, err)
|
||||||
}
|
}
|
||||||
cakey, err := ioutil.ReadFile(caKeyFile)
|
cakey, err := ioutil.ReadFile(caKeyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("error reading CA key file %q: %v", caKeyFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedCa, err := helpers.ParseCertificatePEM(ca)
|
parsedCa, err := helpers.ParseCertificatePEM(ca)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("error parsing CA cert file %q: %v", caFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
strPassword := os.Getenv("CFSSL_CA_PK_PASSWORD")
|
strPassword := os.Getenv("CFSSL_CA_PK_PASSWORD")
|
||||||
|
Loading…
Reference in New Issue
Block a user