Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 053d864

Browse files
authored
Merge pull request #150 from gianarb/fix/new-tag-for-eip
Use a more verbose tag to mark the elastic IP
2 parents 4d9cb7b + dfb4700 commit 053d864

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/cloud/packet/client.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (p *PacketClient) CreateIP(namespace, clusterName, projectID, facility stri
156156
Quantity: 1,
157157
Facility: &facility,
158158
FailOnApprovalRequired: true,
159-
Tags: []string{namespace + "/" + clusterName},
159+
Tags: []string{generateElasticIPIdentifier(clusterName)},
160160
}
161161

162162
r, resp, err := p.ProjectIPs.Request(projectID, &req)
@@ -183,10 +183,14 @@ func (p *PacketClient) GetIPByClusterIdentifier(namespace, name, projectID strin
183183
}
184184
for _, reservedIP := range reservedIPs {
185185
for _, v := range reservedIP.Tags {
186-
if v == namespace+"/"+name {
186+
if v == generateElasticIPIdentifier(name) {
187187
return reservedIP, nil
188188
}
189189
}
190190
}
191191
return reservedIP, ErrControlPlanEndpointNotFound
192192
}
193+
194+
func generateElasticIPIdentifier(name string) string {
195+
return fmt.Sprintf("cluster-api-provider-packet:cluster-id:%s", name)
196+
}

0 commit comments

Comments
 (0)