-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
extramanifests.go
61 lines (48 loc) · 1.5 KB
/
extramanifests.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package manifests
import (
"path/filepath"
"github.com/pkg/errors"
"github.com/openshift/installer/pkg/asset"
)
const (
openshiftManifestDir = "openshift"
)
// ExtraManifests manages the additional manifests for cluster customization
type ExtraManifests struct {
FileList []*asset.File
}
var (
_ asset.WritableAsset = (*ExtraManifests)(nil)
)
// Name returns a human friendly name for the operator
func (em *ExtraManifests) Name() string {
return "Extra Manifests"
}
// Dependencies returns all of the dependencies directly needed by the
// Master asset
func (em *ExtraManifests) Dependencies() []asset.Asset {
return []asset.Asset{}
}
// Generate is not required for ExtraManifests.
func (em *ExtraManifests) Generate(dependencies asset.Parents) error {
return nil
}
// Files returns the files generated by the asset.
func (em *ExtraManifests) Files() []*asset.File {
return em.FileList
}
// Load reads the asset files from disk.
func (em *ExtraManifests) Load(f asset.FileFetcher) (found bool, err error) {
yamlFileList, err := f.FetchByPattern(filepath.Join(openshiftManifestDir, "*.yaml"))
if err != nil {
return false, errors.Wrap(err, "failed to load *.yaml files")
}
ymlFileList, err := f.FetchByPattern(filepath.Join(openshiftManifestDir, "*.yml"))
if err != nil {
return false, errors.Wrap(err, "failed to load *.yml files")
}
em.FileList = append(em.FileList, yamlFileList...)
em.FileList = append(em.FileList, ymlFileList...)
asset.SortFiles(em.FileList)
return len(em.FileList) > 0, nil
}