Merge pull request #47639 from xiangpengzhao/fix-pod-config

Automatic merge from submit-queue (batch tested with PRs 49284, 49555, 47639, 49526, 49724)

Change pod config to manifest

**What this PR does / why we need it**:
As per https://github.com/kubernetes/kubernetes/pull/46494#discussion_r119675805, change `config` to `manifest` to avoid ambiguous.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:
Since it's a minor fix, there is no issue here.

/cc @mtaufen 

**Release note**:

```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-08-01 01:41:58 -07:00 committed by GitHub
commit 82560d974f
3 changed files with 16 additions and 16 deletions

View File

@ -73,7 +73,7 @@ func new(path string, nodeName types.NodeName, period time.Duration, updates cha
func (s *sourceFile) run() {
if err := s.watch(); err != nil {
glog.Errorf("unable to read config path %q: %v", s.path, err)
glog.Errorf("Unable to read manifest path %q: %v", s.path, err)
}
}
@ -118,7 +118,7 @@ func (s *sourceFile) resetStoreFromPath() error {
}
}
// Get as many pod configs as we can from a directory. Return an error if and only if something
// Get as many pod manifests as we can from a directory. Return an error if and only if something
// prevented us from reading anything at all. Do not return an error if only some files
// were problematic.
func (s *sourceFile) extractFromDir(name string) ([]*v1.Pod, error) {
@ -136,29 +136,29 @@ func (s *sourceFile) extractFromDir(name string) ([]*v1.Pod, error) {
for _, path := range dirents {
statInfo, err := os.Stat(path)
if err != nil {
glog.V(1).Infof("Can't get metadata for %q: %v", path, err)
glog.Errorf("Can't get metadata for %q: %v", path, err)
continue
}
switch {
case statInfo.Mode().IsDir():
glog.V(1).Infof("Not recursing into config path %q", path)
glog.Errorf("Not recursing into manifest path %q", path)
case statInfo.Mode().IsRegular():
pod, err := s.extractFromFile(path)
if err != nil {
glog.V(1).Infof("Can't process config file %q: %v", path, err)
glog.Errorf("Can't process manifest file %q: %v", path, err)
} else {
pods = append(pods, pod)
}
default:
glog.V(1).Infof("Config path %q is not a directory or file: %v", path, statInfo.Mode())
glog.Errorf("Manifest path %q is not a directory or file: %v", path, statInfo.Mode())
}
}
return pods, nil
}
func (s *sourceFile) extractFromFile(filename string) (pod *v1.Pod, err error) {
glog.V(3).Infof("Reading config file %q", filename)
glog.V(3).Infof("Reading manifest file %q", filename)
defer func() {
if err == nil && pod != nil {
objKey, keyErr := cache.MetaNamespaceKeyFunc(pod)
@ -193,7 +193,7 @@ func (s *sourceFile) extractFromFile(filename string) (pod *v1.Pod, err error) {
return pod, nil
}
return pod, fmt.Errorf("%v: couldn't parse as pod(%v), please check config file.\n", filename, podErr)
return pod, fmt.Errorf("%v: couldn't parse as pod(%v), please check manifest file.\n", filename, podErr)
}
func (s *sourceFile) replaceStore(pods ...*v1.Pod) (err error) {

View File

@ -62,9 +62,9 @@ func (s *sourceFile) watch() error {
return fmt.Errorf("unable to create inotify for path %q: %v", s.path, err)
}
// Reset store with config files already existing when starting
// Reset store with manifest files already existing when starting
if err := s.resetStoreFromPath(); err != nil {
return fmt.Errorf("unable to read config path %q: %v", s.path, err)
return fmt.Errorf("unable to read manifest path %q: %v", s.path, err)
}
for {
@ -89,7 +89,7 @@ func (s *sourceFile) processEvent(e *inotify.Event) error {
var eventType podEventType
switch {
case (e.Mask & inotify.IN_ISDIR) > 0:
glog.V(1).Infof("Not recursing into config path %q", s.path)
glog.Errorf("Not recursing into manifest path %q", s.path)
return nil
case (e.Mask & inotify.IN_CREATE) > 0:
eventType = podAdd
@ -111,7 +111,7 @@ func (s *sourceFile) processEvent(e *inotify.Event) error {
switch eventType {
case podAdd, podModify:
if pod, err := s.extractFromFile(e.Name); err != nil {
glog.Errorf("can't process config file %q: %v", e.Name, err)
glog.Errorf("Can't process manifest file %q: %v", e.Name, err)
} else {
return s.store.Add(pod)
}

View File

@ -80,7 +80,7 @@ func TestReadPodsFromFileExistAlready(t *testing.T) {
t.Fatalf("unable to create temp dir: %v", err)
}
defer os.RemoveAll(dirName)
file := testCase.writeToFile(dirName, "test_pod_config", t)
file := testCase.writeToFile(dirName, "test_pod_manifest", t)
ch := make(chan interface{})
NewSourceFile(file, hostname, time.Millisecond, ch)
@ -130,7 +130,7 @@ func TestExtractFromBadDataFile(t *testing.T) {
}
defer os.RemoveAll(dirName)
fileName := filepath.Join(dirName, "test_pod_config")
fileName := filepath.Join(dirName, "test_pod_manifest")
err = ioutil.WriteFile(fileName, []byte{1, 2, 3}, 0555)
if err != nil {
t.Fatalf("unable to write test file %#v", err)
@ -254,7 +254,7 @@ func watchFileAdded(watchDir bool, t *testing.T) {
hostname := types.NodeName("random-test-hostname")
var testCases = getTestCases(hostname)
fileNamePre := "test_pod_config"
fileNamePre := "test_pod_manifest"
for index, testCase := range testCases {
func() {
dirName, err := utiltesting.MkTmpdir("dir-test")
@ -292,7 +292,7 @@ func watchFileChanged(watchDir bool, t *testing.T) {
hostname := types.NodeName("random-test-hostname")
var testCases = getTestCases(hostname)
fileNamePre := "test_pod_config"
fileNamePre := "test_pod_manifest"
for index, testCase := range testCases {
func() {
dirName, err := utiltesting.MkTmpdir("dir-test")