Skip to content

Commit

Permalink
pkg/asset/templates/content/bootkube: add etcd-metrics configmap and …
Browse files Browse the repository at this point in the history
…secret

Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
  • Loading branch information
hexfusion committed Feb 25, 2019
1 parent 778b079 commit 593858d
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package bootkube

import (
"os"
"path/filepath"

"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/templates/content"
)

const (
openshiftConfigConfigmapEtcdMetricsServingCAFileName = "openshift-config-configmap-etcd-metrics-serving-ca.yaml.template"
)

var _ asset.WritableAsset = (*OpenshiftConfigConfigmapEtcdMetricsServingCA)(nil)

// OpenshiftConfigConfigmapEtcdMetricsServingCA is the constant to represent contents of openshift-config-configmap-etcd-metrics-serving-ca.yaml.template file.
type OpenshiftConfigConfigmapEtcdMetricsServingCA struct {
FileList []*asset.File
}

// Dependencies returns all of the dependencies directly needed by the asset
func (t *OpenshiftConfigConfigmapEtcdMetricsServingCA) Dependencies() []asset.Asset {
return []asset.Asset{}
}

// Name returns the human-friendly name of the asset.
func (t *OpenshiftConfigConfigmapEtcdMetricsServingCA) Name() string {
return "OpenshiftConfigConfigmapEtcdMetricsServingCA"
}

// Generate generates the actual files by this asset
func (t *OpenshiftConfigConfigmapEtcdMetricsServingCA) Generate(parents asset.Parents) error {
fileName := openshiftConfigConfigmapEtcdMetricsServingCAFileName
data, err := content.GetBootkubeTemplate(fileName)
if err != nil {
return err
}
t.FileList = []*asset.File{
{
Filename: filepath.Join(content.TemplateDir, fileName),
Data: []byte(data),
},
}
return nil
}

// Files returns the files generated by the asset.
func (t *OpenshiftConfigConfigmapEtcdMetricsServingCA) Files() []*asset.File {
return t.FileList
}

// Load returns the asset from disk.
func (t *OpenshiftConfigConfigmapEtcdMetricsServingCA) Load(f asset.FileFetcher) (bool, error) {
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftConfigConfigmapEtcdMetricsServingCAFileName))
if err != nil {
if os.IsNotExist(err) {
return false, nil
}
return false, err
}
t.FileList = []*asset.File{file}
return true, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package bootkube

import (
"os"
"path/filepath"

"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/templates/content"
)

const (
openshiftConfigSecretEtcdMetricsClientFileName = "openshift-config-secret-etcd-metrics-client.yaml.template"
)

var _ asset.WritableAsset = (*OpenshiftConfigSecretEtcdMetricsClient)(nil)

// OpenshiftConfigSecretEtcdMetricsClient is the constant to represent contents of openshift-config-secret-etcd-metrics-client.yaml.template file.
type OpenshiftConfigSecretEtcdMetricsClient struct {
FileList []*asset.File
}

// Dependencies returns all of the dependencies directly needed by the asset
func (t *OpenshiftConfigSecretEtcdMetricsClient) Dependencies() []asset.Asset {
return []asset.Asset{}
}

// Name returns the human-friendly name of the asset.
func (t *OpenshiftConfigSecretEtcdMetricsClient) Name() string {
return "OpenshiftConfigSecretEtcdMetricsClient"
}

// Generate generates the actual files by this asset
func (t *OpenshiftConfigSecretEtcdMetricsClient) Generate(parents asset.Parents) error {
fileName := openshiftConfigSecretEtcdMetricsClientFileName
data, err := content.GetBootkubeTemplate(fileName)
if err != nil {
return err
}
t.FileList = []*asset.File{
{
Filename: filepath.Join(content.TemplateDir, fileName),
Data: []byte(data),
},
}
return nil
}

// Files returns the files generated by the asset.
func (t *OpenshiftConfigSecretEtcdMetricsClient) Files() []*asset.File {
return t.FileList
}

// Load returns the asset from disk.
func (t *OpenshiftConfigSecretEtcdMetricsClient) Load(f asset.FileFetcher) (bool, error) {
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftConfigSecretEtcdMetricsClientFileName))
if err != nil {
if os.IsNotExist(err) {
return false, nil
}
return false, err
}
t.FileList = []*asset.File{file}
return true, nil
}

0 comments on commit 593858d

Please sign in to comment.