@@ -267,9 +267,9 @@ def delete(self, namespace_name, deployment_type, delete_data=False, **kwargs):
267
267
minio_admin = get_minio_admin ()
268
268
failed = False
269
269
for cmd , args , kwargs in [
270
- ('user_remove' , [namespace_name ], {}),
271
270
('policy_unset' , [namespace_name ], {'user' : namespace_name }),
272
271
('policy_remove' , [namespace_name ], {}),
272
+ ('user_remove' , [namespace_name ], {}),
273
273
]:
274
274
try :
275
275
getattr (minio_admin , cmd )(* args , ** kwargs )
@@ -328,16 +328,21 @@ def iterate_cluster_nodes(self):
328
328
assert ret == 0 , out
329
329
node = json .loads (out )
330
330
is_worker = False
331
+ is_cdn = False
331
332
for taint in node .get ('spec' , {}).get ('taints' , []):
332
- if taint .get ('key' ) == 'cwmc-role' and taint .get ('value' ) == 'worker' :
333
- is_worker = True
333
+ if taint .get ('key' ) == 'cwmc-role' :
334
+ if taint .get ('value' ) == 'worker' :
335
+ is_worker = True
336
+ elif taint .get ('value' ) == 'cdn' :
337
+ is_cdn = True
334
338
break
335
339
unschedulable = bool (node .get ('spec' , {}).get ('unschedulable' ))
336
340
public_ip = node .get ('status' , {}).get ('addresses' , [{}])[0 ].get ('address' , '' )
337
341
labels = node .get ('metadata' , {}).get ('labels' , {})
338
342
yield {
339
343
'name' : node_name ,
340
344
'is_worker' : is_worker ,
345
+ 'is_cdn' : is_cdn ,
341
346
'unschedulable' : unschedulable ,
342
347
'public_ip' : public_ip ,
343
348
'cleaner_cordoned' : labels .get (NODE_CLEANER_CORDON_LABEL ) == 'yes'
@@ -376,12 +381,19 @@ def iterate_dns_healthchecks(self):
376
381
healthcheck_name = tag ['Value' ]
377
382
break
378
383
healthcheck_ip = healthcheck .get ('HealthCheckConfig' , {}).get ('IPAddress' ) or ''
379
- if healthcheck_name and healthcheck_name .startswith (config .DNS_RECORDS_PREFIX + ":" ):
380
- yield {
381
- 'id' : healthcheck_id ,
382
- 'node_name' : healthcheck_name .replace (config .DNS_RECORDS_PREFIX + ":" , "" ),
383
- 'ip' : healthcheck_ip
384
- }
384
+ if healthcheck_name :
385
+ if healthcheck_name .startswith (config .DNS_RECORDS_PREFIX + ":" ):
386
+ yield {
387
+ 'id' : healthcheck_id ,
388
+ 'node_name' : healthcheck_name .replace (config .DNS_RECORDS_PREFIX + ":" , "" ),
389
+ 'ip' : healthcheck_ip
390
+ }
391
+ elif healthcheck_name .startswith ('minio-' + config .DNS_RECORDS_PREFIX + ":" ):
392
+ yield {
393
+ 'id' : healthcheck_id ,
394
+ 'node_name' : healthcheck_name .replace ('minio-' + config .DNS_RECORDS_PREFIX + ":" , "" ),
395
+ 'ip' : healthcheck_ip
396
+ }
385
397
if res ['IsTruncated' ]:
386
398
next_marker = res ['NextMarker' ]
387
399
else :
@@ -398,7 +410,10 @@ def iterate_dns_records(self):
398
410
** ({'StartRecordType' : next_record_type } if next_record_type is not None else {}),
399
411
)
400
412
for record in res .get ('ResourceRecordSets' , []):
401
- if record ['Type' ] == 'A' and record ['Name' ] == '{}.{}.' .format (config .DNS_RECORDS_PREFIX , config .AWS_ROUTE53_HOSTEDZONE_DOMAIN ):
413
+ if record ['Type' ] == 'A' and (
414
+ record ['Name' ] == '{}.{}.' .format (config .DNS_RECORDS_PREFIX , config .AWS_ROUTE53_HOSTEDZONE_DOMAIN )
415
+ or record ['Name' ] == 'minio-{}.{}.' .format (config .DNS_RECORDS_PREFIX , config .AWS_ROUTE53_HOSTEDZONE_DOMAIN )
416
+ ):
402
417
if record ['SetIdentifier' ].startswith (config .DNS_RECORDS_PREFIX + ':' ):
403
418
record_ip = ''
404
419
for value in record .get ('ResourceRecords' , []):
@@ -423,7 +438,7 @@ def set_dns_healthcheck(self, node_name, node_ip):
423
438
CallerReference = caller_reference ,
424
439
HealthCheckConfig = {
425
440
"IPAddress" : node_ip ,
426
- "Port" : 12808 ,
441
+ "Port" : 80 ,
427
442
"Type" : "HTTP" ,
428
443
"ResourcePath" : "/healthz" ,
429
444
"RequestInterval" : 30 , # according to AWS docs, when using the recommended regions, it actually does a healthcheck every 2-3 seconds
@@ -440,17 +455,20 @@ def set_dns_healthcheck(self, node_name, node_ip):
440
455
)
441
456
return healthcheck_id
442
457
443
- def set_dns_record (self , node_name , node_ip , healthcheck_id ):
458
+ def set_dns_record (self , node_name , node_ip , healthcheck_id , node_type ):
444
459
client = boto3 .client ('route53' )
460
+ prefix = ''
461
+ if node_type == 'worker' :
462
+ prefix = 'minio-'
445
463
client .change_resource_record_sets (
446
464
HostedZoneId = config .AWS_ROUTE53_HOSTEDZONE_ID ,
447
465
ChangeBatch = {
448
- "Comment" : "cwm-worker-operator deployments_manager.set_dns_record({},{})" .format (node_name , node_ip ),
466
+ "Comment" : "cwm-worker-operator deployments_manager.set_dns_record({}{} ,{})" .format (prefix , node_name , node_ip ),
449
467
"Changes" : [
450
468
{
451
469
"Action" : "CREATE" ,
452
470
"ResourceRecordSet" : {
453
- "Name" : '{}.{}.' .format (config .DNS_RECORDS_PREFIX , config .AWS_ROUTE53_HOSTEDZONE_DOMAIN ),
471
+ "Name" : '{}{} .{}.' .format (prefix , config .DNS_RECORDS_PREFIX , config .AWS_ROUTE53_HOSTEDZONE_DOMAIN ),
454
472
'Type' : 'A' ,
455
473
'SetIdentifier' : config .DNS_RECORDS_PREFIX + ':' + node_name ,
456
474
'MultiValueAnswer' : True ,
0 commit comments