Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangweikop committed Jun 6, 2024
1 parent 92cb91e commit bdfca93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions pkg/kubelet/certificate/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func NewKubeletClientCertificateManager(
func NewKubeletServerCertificateDynamicFileManager(certFile, keyFile string) (certificate.Manager, error) {
c, err := dynamiccertificates.NewDynamicServingContentFromFiles("kubelet-server-cert-files", certFile, keyFile)
if err != nil {
return nil, fmt.Errorf("no certificate available: %w", err)
return nil, fmt.Errorf("unable to set up dynamic certificate manager for kubelet server cert files: %w", err)
}
m := &kubeletServerCertificateDynamicFileManager{
dynamicCertificateContent: c,
Expand Down Expand Up @@ -276,7 +276,6 @@ func (m *kubeletServerCertificateDynamicFileManager) Enqueue() {
}
m.currentTLSCertificate.Store(&cert)
klog.V(4).InfoS("loaded certificate and key pair in kubelet server certificate manager", "certFile", m.certFile, "keyFile", m.keyFile)

}

// Current returns the last valid certificate key pair loaded from files.
Expand All @@ -298,7 +297,7 @@ func (m *kubeletServerCertificateDynamicFileManager) Stop() {
}
}

// ServerHealthy always return true since the file manager doesn't communicate with any server
// ServerHealthy always returns true since the file manager doesn't communicate with any server
func (m *kubeletServerCertificateDynamicFileManager) ServerHealthy() bool {
return true
}
4 changes: 2 additions & 2 deletions pkg/kubelet/certificate/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func TestKubeletServerCertificateFromFiles(t *testing.T) {
t.Errorf("expected the same loaded certificate object when there is no cert file change, got different")
}

// simulate certificate files update in the background
// simulate certificate files updated in the background
if _, _, err := createFn(certDir); err != nil {
t.Fatalf("got errors when rotating certificate files in the test: %v", err)
}
Expand Down Expand Up @@ -256,7 +256,7 @@ func TestKubeletServerCertificateFromFiles(t *testing.T) {

time.Sleep(1 * time.Second)
if m.Current() == nil {
t.Errorf("expected the manager still provide cached content when certificate file was not available")
t.Errorf("expected the manager still provides cached content when certificate file was not available")
}
})
}
Expand Down

0 comments on commit bdfca93

Please sign in to comment.