Skip to content

Commit

Permalink
Use droplet ID for node names in DO
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Oct 6, 2023
1 parent 7a37a36 commit 2858a29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/releases/1.29-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a document to gather the release notes prior to the release.

## DigitalOcean

* Node names have changed from the droplet's private IP to the droplet hostname
* Node names have changed from the droplet's private IP to the droplet's ID

# Breaking changes

Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/do/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (o digitalOceanVerifier) VerifyToken(ctx context.Context, rawRequest *http.
}

result := &bootstrap.VerifyResult{
NodeName: droplet.Name,
NodeName: strconv.Itoa(droplet.ID),
CertificateNames: addresses,
ChallengeEndpoint: challengeEndpoints[0],
}
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,14 @@ func evaluateHostnameOverride(cloudProvider api.CloudProviderID) (string, error)
bareHostname := strings.Split(fullyQualified, ".")[0]
return bareHostname, nil
case api.CloudProviderDO:
vBytes, err := vfs.Context.ReadFile("metadata://digitalocean/hostname")
vBytes, err := vfs.Context.ReadFile("metadata://digitalocean/id")
if err != nil {
return "", fmt.Errorf("error reading droplet hostname from DigitalOcean metadata: %v", err)
return "", fmt.Errorf("error reading droplet ID from DigitalOcean metadata: %v", err)
}

hostname := string(vBytes)
if hostname == "" {
return "", errors.New("hostname for digitalocean droplet was empty")
return "", errors.New("id for digitalocean droplet was empty")
}

return hostname, nil
Expand Down

0 comments on commit 2858a29

Please sign in to comment.