Skip to content
Merged
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
27 changes: 15 additions & 12 deletions cmd/machine-config-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@ var (
}

bootstrapOpts struct {
cloudConfigFile string
configFile string
destinationDir string
etcdCAFile string
etcdImage string
etcdMetricCAFile string
rootCAFile string
kubeCAFile string
pullSecretFile string
configFile string
oscontentImage string
infraConfigFile string
networkConfigFile string
imagesConfigMapFile string
infraConfigFile string
infraImage string
kubeCAFile string
kubeClientAgentImage string
mccImage string
mcsImage string
mcdImage string
etcdImage string
mcsImage string
networkConfigFile string
oscontentImage string
pullSecretFile string
rootCAFile string
setupEtcdEnvImage string
infraImage string
kubeClientAgentImage string
destinationDir string
}
)

Expand Down Expand Up @@ -74,6 +75,7 @@ func init() {
bootstrapCmd.MarkFlagRequired("config-file")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.infraConfigFile, "infra-config-file", "/assets/manifests/cluster-infrastructure-02-config.yml", "File containing infrastructure.config.openshift.io manifest.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.networkConfigFile, "network-config-file", "/assets/manifests/cluster-network-02-config.yml", "File containing network.config.openshift.io manifest.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.cloudConfigFile, "cloud-config-file", "", "File containing the config map that contains the cloud config for cloudprovider.")
}

func runBootstrapCmd(cmd *cobra.Command, args []string) {
Expand All @@ -97,6 +99,7 @@ func runBootstrapCmd(cmd *cobra.Command, args []string) {
if err := operator.RenderBootstrap(
bootstrapOpts.configFile,
bootstrapOpts.infraConfigFile, bootstrapOpts.networkConfigFile,
bootstrapOpts.cloudConfigFile,
bootstrapOpts.etcdCAFile, bootstrapOpts.etcdMetricCAFile, bootstrapOpts.rootCAFile, bootstrapOpts.kubeCAFile, bootstrapOpts.pullSecretFile,
imgs,
bootstrapOpts.destinationDir,
Expand Down
14 changes: 14 additions & 0 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ func renderTemplate(config RenderConfig, path string, b []byte) ([]byte, error)
funcs["etcdServerCertDNSNames"] = etcdServerCertDNSNames
funcs["etcdPeerCertDNSNames"] = etcdPeerCertDNSNames
funcs["cloudProvider"] = cloudProvider
funcs["cloudConfigFlag"] = cloudConfigFlag
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 @@ -361,6 +362,19 @@ func cloudProvider(cfg RenderConfig) (interface{}, error) {
return "", nil
}

// Process the {{cloudConfigFlag .}}
// If the CloudProviderConfig field is set and not empty, this
// returns the cloud conf flag for kubelet [1] pointing the kubelet to use
// /etc/kubernetes/cloud.conf for configuring the cloud provider.
//
// [1]: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/#options
func cloudConfigFlag(cfg RenderConfig) interface{} {
if len(cfg.CloudProviderConfig) > 0 {
return "--cloud-config=/etc/kubernetes/cloud.conf"
}
return ""
}

// 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
Expand Up @@ -2,7 +2,11 @@ apiVersion: "machineconfigurations.openshift.io/v1"
kind: "ControllerConfig"
spec:
clusterDNSIP: "10.3.0.10"
cloudProviderConfig: ""
cloudProviderConfig: |
testing
multi-line cloud config
[test]
option = dummy
etcdDiscoveryDomain: "my-test-cluster.installer.team.coreos.systems"
etcdInitialCount: 3
platform: "openstack"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ apiVersion: "machineconfigurations.openshift.io/v1"
kind: "ControllerConfig"
spec:
clusterDNSIP: "10.3.0.10"
cloudProviderConfig: ""
cloudProviderConfig: |
testing
multi-line cloud config
[test]
option = dummy
etcdDiscoveryDomain: "my-test-cluster.installer.team.coreos.systems"
etcdInitialCount: 3
platform: "vsphere"
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading