Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
packet: Create DNS entries before starting bootkube
Browse files Browse the repository at this point in the history
Fixes #109
  • Loading branch information
rata committed Mar 5, 2020
1 parent 6b6b012 commit a9a37fc
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions pkg/platform/packet/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,28 +217,19 @@ func (c *config) terraformSmartApply(ex *terraform.Executor) error {
return errors.Wrap(err, "parsing DNS configuration failed")
}

// If the provider isn't manual, apply everything in a single step.
if dnsProvider != dns.DNSManual {
return ex.Apply()
}

arguments := []string{"apply", "-auto-approve"}

// Get DNS entries (it forces the creation of the controller nodes).
// Make sure to create DNS entries before bootkube starts
arguments = append(arguments, fmt.Sprintf("-target=module.packet-%s.null_resource.dns_entries", c.ClusterName))

// Add worker nodes to speed things up.
for index := range c.WorkerPools {
arguments = append(arguments, fmt.Sprintf("-target=module.worker-pool-%d.packet_device.nodes", index))
}

// Create controller and workers nodes.
if err := ex.Execute(arguments...); err != nil {
return errors.Wrap(err, "failed executing Terraform")
}

if err := dns.AskToConfigure(ex, &c.DNS); err != nil {
return errors.Wrap(err, "failed to configure DNS entries")
// If the provider is manual, ask to configure
if dnsProvider == dns.DNSManual {
if err := dns.AskToConfigure(ex, &c.DNS); err != nil {
return errors.Wrap(err, "failed to configure DNS entries")
}
}

// Finish deployment.
Expand Down

0 comments on commit a9a37fc

Please sign in to comment.