Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baremetal: more wiring up #3407

Merged
merged 1 commit into from
Sep 19, 2017
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
19 changes: 14 additions & 5 deletions upup/pkg/fi/cloudup/apply_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import (

"github.com/blang/semver"
"github.com/golang/glog"
"k8s.io/kops/upup/pkg/fi/cloudup/baremetal"
)

const (
Expand Down Expand Up @@ -548,6 +549,9 @@ func (c *ApplyClusterCmd) Run() error {
case kops.CloudProviderVSphere:
// No special settings (yet!)

case kops.CloudProviderBareMetal:
// No special settings (yet!)

default:
return fmt.Errorf("unknown cloudprovider %q", cluster.Spec.CloudProvider)
}
Expand Down Expand Up @@ -685,6 +689,9 @@ func (c *ApplyClusterCmd) Run() error {
})
}

case kops.CloudProviderBareMetal:
// BareMetal tasks will go here

default:
return fmt.Errorf("unknown cloudprovider %q", cluster.Spec.CloudProvider)
}
Expand All @@ -704,15 +711,17 @@ func (c *ApplyClusterCmd) Run() error {

switch c.TargetName {
case TargetDirect:
switch cluster.Spec.CloudProvider {
case "gce":
switch kops.CloudProviderID(cluster.Spec.CloudProvider) {
case kops.CloudProviderGCE:
target = gce.NewGCEAPITarget(cloud.(gce.GCECloud))
case "aws":
case kops.CloudProviderAWS:
target = awsup.NewAWSAPITarget(cloud.(awsup.AWSCloud))
case "digitalocean":
case kops.CloudProviderDO:
target = do.NewDOAPITarget(cloud.(*digitalocean.Cloud))
case "vsphere":
case kops.CloudProviderVSphere:
target = vsphere.NewVSphereAPITarget(cloud.(*vsphere.VSphereCloud))
case kops.CloudProviderBareMetal:
target = baremetal.NewTarget(cloud.(*baremetal.Cloud))
default:
return fmt.Errorf("direct configuration not supported with CloudProvider:%q", cluster.Spec.CloudProvider)
}
Expand Down
43 changes: 22 additions & 21 deletions upup/pkg/fi/cloudup/template_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,29 +158,30 @@ func (tf *TemplateFunctions) DnsControllerArgv() ([]string, error) {
}
// argv = append(argv, "--watch-ingress=false")

switch kops.CloudProviderID(tf.cluster.Spec.CloudProvider) {
case kops.CloudProviderAWS:
if strings.HasPrefix(os.Getenv("AWS_REGION"), "cn-") {
argv = append(argv, "--dns=gossip")
} else {
argv = append(argv, "--dns=aws-route53")
}
case kops.CloudProviderGCE:
argv = append(argv, "--dns=google-clouddns")
case kops.CloudProviderDO:
// this is not supported yet, here so we can successfully create clusters
// this will be supported for digitalocean in the future
argv = append(argv, "--dns=digitalocean")
case kops.CloudProviderVSphere:
argv = append(argv, "--dns=coredns")
argv = append(argv, "--dns-server="+*tf.cluster.Spec.CloudConfig.VSphereCoreDNSServer)

default:
return nil, fmt.Errorf("unhandled cloudprovider %q", tf.cluster.Spec.CloudProvider)
}

if dns.IsGossipHostname(tf.cluster.Spec.MasterInternalName) {
argv = append(argv, "--dns=gossip")
argv = append(argv, "--gossip-seed=127.0.0.1:3999")
} else {
switch kops.CloudProviderID(tf.cluster.Spec.CloudProvider) {
case kops.CloudProviderAWS:
if strings.HasPrefix(os.Getenv("AWS_REGION"), "cn-") {
argv = append(argv, "--dns=gossip")
} else {
argv = append(argv, "--dns=aws-route53")
}
case kops.CloudProviderGCE:
argv = append(argv, "--dns=google-clouddns")
case kops.CloudProviderDO:
// this is not supported yet, here so we can successfully create clusters
// this will be supported for digitalocean in the future
argv = append(argv, "--dns=digitalocean")
case kops.CloudProviderVSphere:
argv = append(argv, "--dns=coredns")
argv = append(argv, "--dns-server="+*tf.cluster.Spec.CloudConfig.VSphereCoreDNSServer)

default:
return nil, fmt.Errorf("unhandled cloudprovider %q", tf.cluster.Spec.CloudProvider)
}
}

zone := tf.cluster.Spec.DNSZone
Expand Down