@@ -2,6 +2,7 @@ package integration
2
2
3
3
import (
4
4
"fmt"
5
+ "math/rand"
5
6
"os"
6
7
"path/filepath"
7
8
"time"
@@ -165,38 +166,41 @@ func (p awsProvisioner) ProvisionNodes(nodeCount NodeCount, distro linuxDistro,
165
166
}
166
167
}
167
168
169
+ // when AWS cloud-provider is enabled all nodes in a cluster must have a unique identifier,
170
+ // set via kubernetes.io/cluster/$UNIQUE_ID EC2 tag
171
+ uniqueTag := fmt .Sprintf ("kubernetes.io/cluster/testcluster%d" , rand .Intn (32767 ))
168
172
provisioned := provisionedNodes {}
169
173
var i uint16
170
174
for i = 0 ; i < nodeCount .Etcd ; i ++ {
171
- nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice )
175
+ nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice , map [ string ] string { uniqueTag : "" } )
172
176
if err != nil {
173
177
return provisioned , err
174
178
}
175
179
provisioned .etcd = append (provisioned .etcd , NodeDeets {id : nodeID })
176
180
}
177
181
for i = 0 ; i < nodeCount .Master ; i ++ {
178
- nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice )
182
+ nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice , map [ string ] string { uniqueTag : "" } )
179
183
if err != nil {
180
184
return provisioned , err
181
185
}
182
186
provisioned .master = append (provisioned .master , NodeDeets {id : nodeID })
183
187
}
184
188
for i = 0 ; i < nodeCount .Worker ; i ++ {
185
- nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice )
189
+ nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice , map [ string ] string { uniqueTag : "" } )
186
190
if err != nil {
187
191
return provisioned , err
188
192
}
189
193
provisioned .worker = append (provisioned .worker , NodeDeets {id : nodeID })
190
194
}
191
195
for i = 0 ; i < nodeCount .Ingress ; i ++ {
192
- nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice )
196
+ nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice , map [ string ] string { uniqueTag : "" } )
193
197
if err != nil {
194
198
return provisioned , err
195
199
}
196
200
provisioned .ingress = append (provisioned .ingress , NodeDeets {id : nodeID })
197
201
}
198
202
for i = 0 ; i < nodeCount .Storage ; i ++ {
199
- nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice )
203
+ nodeID , err := p .client .CreateNode (ami , aws .T2Medium , addBlockDevice , map [ string ] string { uniqueTag : "" } )
200
204
if err != nil {
201
205
return provisioned , err
202
206
}
@@ -429,7 +433,7 @@ func (p packetProvisioner) RemoveDNS(dnsRecord *DNSRecord) error {
429
433
430
434
func (p packetProvisioner ) createNode (distro packet.OS , count uint16 ) (string , error ) {
431
435
hostname := fmt .Sprintf ("kismatic-integration-%d-%d" , time .Now ().UnixNano (), count )
432
- node , err := p .client .CreateNode (hostname , distro )
436
+ node , err := p .client .CreateNode (hostname , distro , nil )
433
437
if err != nil {
434
438
return "" , err
435
439
}
0 commit comments