Merge pull request #45111 from dwradcliffe/fix_kubelet_config_ignore

Automatic merge from submit-queue

kubelet: use the base filename to check if the filename starts with a dot

**What this PR does / why we need it**:
Fixes a bug in https://github.com/kubernetes/kubernetes/pull/39196. The goal was to ignore files that start with a dot but the value used is the full absolute filename including path.

**Which issue this PR fixes**: fixes #44450

@yujuhong

**Release note**:
```release-note
kubelet config should actually ignore files starting with dots
```
This commit is contained in:
Kubernetes Submit Queue 2017-05-16 11:39:02 -07:00 committed by GitHub
commit 88a3b5babd

View File

@ -22,6 +22,7 @@ package config
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/golang/glog"
@ -81,7 +82,7 @@ func (s *sourceFile) watch() error {
func (s *sourceFile) processEvent(e *inotify.Event) error {
// Ignore file start with dots
if strings.HasPrefix(e.Name, ".") {
if strings.HasPrefix(filepath.Base(e.Name), ".") {
glog.V(4).Infof("Ignored pod manifest: %s, because it starts with dots", e.Name)
return nil
}