Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@ revision = "44145f04b68cf362d9c4df2182967c2275eaefed"
[[constraint]]
name = "github.com/ashcrow/osrelease"
version = "1.0.0"

[[constraint]]
branch = "master"
name = "github.com/gophercloud/utils"
2 changes: 1 addition & 1 deletion hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ fi

mkdir -p ${BIN_PATH}

echo "Building ${REPO}/cmd/${WHAT} (${VERSION})"
echo "Building ${REPO}/cmd/${WHAT} (${VERSION_OVERRIDE})"
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build ${GOFLAGS} -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${WHAT} ${REPO}/cmd/${WHAT}
24 changes: 24 additions & 0 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"sort"
"strings"
"text/template"
"encoding/base64"

"github.com/Masterminds/sprig"
ctconfig "github.com/coreos/container-linux-config-transpiler/config"
Expand All @@ -19,6 +20,8 @@ import (
"github.com/golang/glog"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

install_types "github.com/openshift/installer/pkg/types"
)

// renderConfig is wrapper around ControllerConfigSpec.
Expand Down Expand Up @@ -268,6 +271,7 @@ func renderTemplate(config renderConfig, path string, b []byte) ([]byte, error)
funcs["etcdPeerCertDNSNames"] = etcdPeerCertDNSNames
funcs["apiServerURL"] = apiServerURL
funcs["cloudProvider"] = cloudProvider
funcs["cloudProviderConfig"] = cloudProviderConfig
tmpl, err := template.New(path).Funcs(funcs).Parse(string(b))
if err != nil {
return nil, fmt.Errorf("failed to parse template %s: %v", path, err)
Expand Down Expand Up @@ -337,6 +341,26 @@ func cloudProvider(cfg renderConfig) (interface{}, error) {
return "", nil
}

func cloudProviderConfig(cfg renderConfig) (interface{}, error) {
config, err := base64.StdEncoding.DecodeString(cfg.CloudProviderConfig)
if err != nil {
return "", err
}

switch cfg.Platform {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a default in this switch statement?

case "aws":
return "", nil
case "openstack":
var openstack *install_types.OpenStackPlatform
err = yaml.Unmarshal(config, &openstack)
if err != nil {
return "", err
}
return openstack, nil
}
return "", nil
}

// existsDir returns true if path exists and is a directory, false if the path
// does not exist, and error if there is a runtime error or the path is not a directory
func existsDir(path string) (bool, error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
contents:
source: data:,%0A%0A%5BLoadBalancer%5D%0Asubnet-id%3D%0A
verification: {}
filesystem: root
mode: 420
path: /etc/openstack/clouds.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
contents:
source: data:,%0A%0A%5BLoadBalancer%5D%0Asubnet-id%3D%0A
verification: {}
filesystem: root
mode: 420
path: /etc/openstack/clouds.conf
Loading