rcs returns entities for the rcs in the RCFile
(objects []deploy.KubeObject)
| 84 | |
| 85 | // rcs returns entities for the rcs in the RCFile |
| 86 | func (fs FileSource) rcs(objects []deploy.KubeObject) (rcs []entity.Entity, err error) { |
| 87 | pattern := fmt.Sprintf("%s/*%s", fs, RCExtension) |
| 88 | |
| 89 | patternExts := withExtensions(pattern) |
| 90 | paths, err := multiGlob(patternExts...) |
| 91 | if err != nil { |
| 92 | return rcs, err |
| 93 | } |
| 94 | |
| 95 | for _, filePath := range paths { |
| 96 | err = walkPathForObjects(filePath, func(info *resource.Info, err error) error { |
| 97 | kubeRC, ok := info.Object.(*kube.ReplicationController) |
| 98 | if !ok { |
| 99 | return fmt.Errorf("expected type `ReplicationController` but found `%s`", info.Object.GetObjectKind().GroupVersionKind().Kind) |
| 100 | } |
| 101 | |
| 102 | rc, err := entity.NewReplicationController(kubeRC, kube.ObjectMeta{}, info.Source, objects...) |
| 103 | if err != nil { |
| 104 | return err |
| 105 | } |
| 106 | |
| 107 | rcs = append(rcs, rc) |
| 108 | return nil |
| 109 | }) |
| 110 | |
| 111 | if checkErrPathDoesNotExist(err) { |
| 112 | // it's okay if directory doesn't exit |
| 113 | err = nil |
| 114 | } |
| 115 | |
| 116 | if err != nil { |
| 117 | return |
| 118 | } |
| 119 | } |
| 120 | return |
| 121 | } |
| 122 | |
| 123 | // pods returns Pods for the rcs in the PodFile |
| 124 | func (fs FileSource) pods(objects []deploy.KubeObject) (pods []entity.Entity, err error) { |
no test coverage detected