Skip to content

Commit

Permalink
Merge pull request #3407 from justinsb/baremetal_further
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue. .

baremetal: more wiring up
  • Loading branch information
Kubernetes Submit Queue authored Sep 19, 2017
2 parents 7518550 + f157ccc commit e559471
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
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

0 comments on commit e559471

Please sign in to comment.