github.com/openshift/installer@v1.4.17/pkg/asset/templates/content/bootkube/cvo-overrides.go (about) 1 package bootkube 2 3 import ( 4 "context" 5 "os" 6 "path/filepath" 7 8 "github.com/openshift/installer/pkg/asset" 9 "github.com/openshift/installer/pkg/asset/templates/content" 10 ) 11 12 const ( 13 cVOOverridesFileName = "cvo-overrides.yaml.template" 14 ) 15 16 var _ asset.WritableAsset = (*CVOOverrides)(nil) 17 18 // CVOOverrides is an asset that generates the cvo-override.yaml.template file. 19 // This is a gate to prevent CVO from installing these operators which conflict 20 // with resources already owned by other operators. 21 // This files can be dropped when the overrides list becomes empty. 22 type CVOOverrides struct { 23 FileList []*asset.File 24 } 25 26 // Dependencies returns all of the dependencies directly needed by the asset 27 func (t *CVOOverrides) Dependencies() []asset.Asset { 28 return []asset.Asset{} 29 } 30 31 // Name returns the human-friendly name of the asset. 32 func (t *CVOOverrides) Name() string { 33 return "CVOOverrides" 34 } 35 36 // Generate generates the actual files by this asset 37 func (t *CVOOverrides) Generate(_ context.Context, parents asset.Parents) error { 38 fileName := cVOOverridesFileName 39 data, err := content.GetBootkubeTemplate(fileName) 40 if err != nil { 41 return err 42 } 43 t.FileList = []*asset.File{ 44 { 45 Filename: filepath.Join(content.TemplateDir, fileName), 46 Data: []byte(data), 47 }, 48 } 49 return nil 50 } 51 52 // Files returns the files generated by the asset. 53 func (t *CVOOverrides) Files() []*asset.File { 54 return t.FileList 55 } 56 57 // Load returns the asset from disk. 58 func (t *CVOOverrides) Load(f asset.FileFetcher) (bool, error) { 59 file, err := f.FetchByName(filepath.Join(content.TemplateDir, cVOOverridesFileName)) 60 if err != nil { 61 if os.IsNotExist(err) { 62 return false, nil 63 } 64 return false, err 65 } 66 t.FileList = []*asset.File{file} 67 return true, nil 68 }