Skip to content

Commit 42cc780

Browse files
committed
manifests/capiutils: move ManifestDir to capiutils
Move the path for capi manifests to capiutils and export it. This will allow the use of the same constant when breaking CAPI machine manifests into a separate asset.
1 parent cd74bcd commit 42cc780

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

pkg/asset/manifests/capiutils/manifest.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import (
66
"github.com/openshift/installer/pkg/asset"
77
)
88

9+
const (
10+
// ManifestDir defines the directory name for Cluster API manifests.
11+
ManifestDir = "cluster-api"
12+
)
13+
914
// GenerateClusterAssetsOutput is the output of GenerateClusterAssets.
1015
type GenerateClusterAssetsOutput struct {
1116
Manifests []*asset.RuntimeFile

pkg/asset/manifests/clusterapi/cluster.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ import (
3030
azuretypes "github.com/openshift/installer/pkg/types/azure"
3131
)
3232

33-
const (
34-
manifestDir = "cluster-api"
35-
)
36-
3733
var _ asset.WritableRuntimeAsset = (*Cluster)(nil)
3834

3935
// Cluster generates manifests for target cluster
@@ -77,7 +73,7 @@ func (c *Cluster) Generate(dependencies asset.Parents) error {
7773
return nil
7874
}
7975

80-
if err := os.MkdirAll(filepath.Dir(manifestDir), 0755); err != nil {
76+
if err := os.MkdirAll(filepath.Dir(capiutils.ManifestDir), 0755); err != nil {
8177
return err
8278
}
8379

@@ -188,11 +184,11 @@ func (c *Cluster) Generate(dependencies asset.Parents) error {
188184
}
189185
m.Data = objData
190186

191-
// If the filename is already a path, do not append the manifestDir.
192-
if filepath.Dir(m.Filename) == manifestDir {
187+
// If the filename is already a path, do not append the manifest dir.
188+
if filepath.Dir(m.Filename) == capiutils.ManifestDir {
193189
continue
194190
}
195-
m.Filename = filepath.Join(manifestDir, m.Filename)
191+
m.Filename = filepath.Join(capiutils.ManifestDir, m.Filename)
196192
}
197193

198194
asset.SortManifestFiles(c.FileList)
@@ -215,15 +211,15 @@ func (c *Cluster) RuntimeFiles() []*asset.RuntimeFile {
215211

216212
// Load returns the openshift asset from disk.
217213
func (c *Cluster) Load(f asset.FileFetcher) (bool, error) {
218-
yamlFileList, err := f.FetchByPattern(filepath.Join(manifestDir, "*.yaml"))
214+
yamlFileList, err := f.FetchByPattern(filepath.Join(capiutils.ManifestDir, "*.yaml"))
219215
if err != nil {
220216
return false, errors.Wrap(err, "failed to load *.yaml files")
221217
}
222-
ymlFileList, err := f.FetchByPattern(filepath.Join(manifestDir, "*.yml"))
218+
ymlFileList, err := f.FetchByPattern(filepath.Join(capiutils.ManifestDir, "*.yml"))
223219
if err != nil {
224220
return false, errors.Wrap(err, "failed to load *.yml files")
225221
}
226-
jsonFileList, err := f.FetchByPattern(filepath.Join(manifestDir, "*.json"))
222+
jsonFileList, err := f.FetchByPattern(filepath.Join(capiutils.ManifestDir, "*.json"))
227223
if err != nil {
228224
return false, errors.Wrap(err, "failed to load *.json files")
229225
}

0 commit comments

Comments
 (0)