@@ -236,7 +236,7 @@ func (b *ByocAws) Deploy(ctx context.Context, req *defangv1.DeployRequest) (*def
236
236
}, nil
237
237
}
238
238
239
- func (b ByocAws ) findZone (ctx context.Context , domain , role string ) (string , error ) {
239
+ func (b * ByocAws ) findZone (ctx context.Context , domain , role string ) (string , error ) {
240
240
cfg , err := b .driver .LoadConfig (ctx )
241
241
if err != nil {
242
242
return "" , annotateAwsError (err )
@@ -267,7 +267,7 @@ func (b ByocAws) findZone(ctx context.Context, domain, role string) (string, err
267
267
}
268
268
}
269
269
270
- func (b ByocAws ) delegateSubdomain (ctx context.Context ) (string , error ) {
270
+ func (b * ByocAws ) delegateSubdomain (ctx context.Context ) (string , error ) {
271
271
if b .customDomain == "" {
272
272
return "" , errors .New ("custom domain not set" )
273
273
}
@@ -305,7 +305,7 @@ func (b ByocAws) delegateSubdomain(ctx context.Context) (string, error) {
305
305
return resp .Zone , nil
306
306
}
307
307
308
- func (b ByocAws ) WhoAmI (ctx context.Context ) (* defangv1.WhoAmIResponse , error ) {
308
+ func (b * ByocAws ) WhoAmI (ctx context.Context ) (* defangv1.WhoAmIResponse , error ) {
309
309
if _ , err := b .GrpcClient .WhoAmI (ctx ); err != nil {
310
310
return nil , err
311
311
}
@@ -331,7 +331,7 @@ func (ByocAws) GetVersions(context.Context) (*defangv1.Version, error) {
331
331
return & defangv1.Version {Fabric : cdVersion }, nil
332
332
}
333
333
334
- func (b ByocAws ) Get (ctx context.Context , s * defangv1.ServiceID ) (* defangv1.ServiceInfo , error ) {
334
+ func (b * ByocAws ) Get (ctx context.Context , s * defangv1.ServiceID ) (* defangv1.ServiceInfo , error ) {
335
335
all , err := b .GetServices (ctx )
336
336
if err != nil {
337
337
return nil , err
@@ -395,30 +395,15 @@ func (b *ByocAws) Delete(ctx context.Context, req *defangv1.DeleteRequest) (*def
395
395
return & defangv1.DeleteResponse {Etag : etag }, nil
396
396
}
397
397
398
- // stack returns a stack-qualified name, like the Pulumi TS function `stack`
399
- func (b * ByocAws ) stack (name string ) string {
400
- if b .pulumiProject == "" {
401
- panic ("pulumiProject not set" )
402
- }
403
- return fmt .Sprintf ("%s-%s-%s-%s" , DefangPrefix , b .pulumiProject , b .pulumiStack , name ) // same as shared/common.ts
404
- }
405
-
398
+ // stackDir returns a stack-qualified name, like the Pulumi TS function `stackDir`
406
399
func (b * ByocAws ) stackDir (name string ) string {
407
400
if b .pulumiProject == "" {
408
401
panic ("pulumiProject not set" )
409
402
}
410
403
return fmt .Sprintf ("/%s/%s/%s/%s" , DefangPrefix , b .pulumiProject , b .pulumiStack , name ) // same as shared/common.ts
411
404
}
412
405
413
- func (b * ByocAws ) getClusterNames () []string {
414
- // This should match the naming in pulumi/ecs/common.ts
415
- return []string {
416
- b .stack ("cluster" ),
417
- b .stack ("gpu-cluster" ),
418
- }
419
- }
420
-
421
- func (b ByocAws ) GetServices (ctx context.Context ) (* defangv1.ListServicesResponse , error ) {
406
+ func (b * ByocAws ) GetServices (ctx context.Context ) (* defangv1.ListServicesResponse , error ) {
422
407
bucketName := b .bucketName ()
423
408
if bucketName == "" {
424
409
if err := b .driver .FillOutputs (ctx ); err != nil {
@@ -456,14 +441,14 @@ func (b ByocAws) GetServices(ctx context.Context) (*defangv1.ListServicesRespons
456
441
return & serviceInfos , nil
457
442
}
458
443
459
- func (b ByocAws ) getSecretID (name string ) string {
444
+ func (b * ByocAws ) getSecretID (name string ) string {
460
445
if b .pulumiProject == "" {
461
446
panic ("pulumiProject not set" )
462
447
}
463
448
return fmt .Sprintf ("/%s/%s/%s/%s" , DefangPrefix , b .pulumiProject , b .pulumiStack , name ) // same as defang_service.ts
464
449
}
465
450
466
- func (b ByocAws ) PutConfig (ctx context.Context , secret * defangv1.SecretValue ) error {
451
+ func (b * ByocAws ) PutConfig (ctx context.Context , secret * defangv1.SecretValue ) error {
467
452
if ! pkg .IsValidSecretName (secret .Name ) {
468
453
return connect .NewError (connect .CodeInvalidArgument , fmt .Errorf ("invalid secret name; must be alphanumeric or _, cannot start with a number: %q" , secret .Name ))
469
454
}
@@ -473,7 +458,7 @@ func (b ByocAws) PutConfig(ctx context.Context, secret *defangv1.SecretValue) er
473
458
return annotateAwsError (err )
474
459
}
475
460
476
- func (b ByocAws ) ListConfig (ctx context.Context ) (* defangv1.Secrets , error ) {
461
+ func (b * ByocAws ) ListConfig (ctx context.Context ) (* defangv1.Secrets , error ) {
477
462
prefix := b .getSecretID ("" )
478
463
term .Debug (" - Listing parameters with prefix" , prefix )
479
464
awsSecrets , err := b .driver .ListSecretsByPrefix (ctx , prefix )
@@ -554,7 +539,7 @@ func (b *ByocAws) Tail(ctx context.Context, req *defangv1.TailRequest) (client.S
554
539
}
555
540
556
541
// This function was copied from Fabric controller and slightly modified to work with BYOC
557
- func (b ByocAws ) update (ctx context.Context , service * defangv1.Service ) (* defangv1.ServiceInfo , error ) {
542
+ func (b * ByocAws ) update (ctx context.Context , service * defangv1.Service ) (* defangv1.ServiceInfo , error ) {
558
543
if err := b .quota .Validate (service ); err != nil {
559
544
return nil , err
560
545
}
@@ -625,7 +610,7 @@ func (b ByocAws) update(ctx context.Context, service *defangv1.Service) (*defang
625
610
}
626
611
627
612
// This function was copied from Fabric controller and slightly modified to work with BYOC
628
- func (b ByocAws ) checkForMissingSecrets (ctx context.Context , secrets []* defangv1.Secret ) (* defangv1.Secret , error ) {
613
+ func (b * ByocAws ) checkForMissingSecrets (ctx context.Context , secrets []* defangv1.Secret ) (* defangv1.Secret , error ) {
629
614
if len (secrets ) == 0 {
630
615
return nil , nil // no secrets to check
631
616
}
@@ -654,7 +639,7 @@ func searchSecret(sorted []qualifiedName, fqn qualifiedName) bool {
654
639
type qualifiedName = string // legacy
655
640
656
641
// This function was copied from Fabric controller and slightly modified to work with BYOC
657
- func (b ByocAws ) getEndpoint (fqn qualifiedName , port * defangv1.Port ) string {
642
+ func (b * ByocAws ) getEndpoint (fqn qualifiedName , port * defangv1.Port ) string {
658
643
if port .Mode == defangv1 .Mode_HOST {
659
644
privateFqdn := b .getPrivateFqdn (fqn )
660
645
return fmt .Sprintf ("%s:%d" , privateFqdn , port .Target )
@@ -668,7 +653,7 @@ func (b ByocAws) getEndpoint(fqn qualifiedName, port *defangv1.Port) string {
668
653
}
669
654
670
655
// This function was copied from Fabric controller and slightly modified to work with BYOC
671
- func (b ByocAws ) getPublicFqdn (fqn qualifiedName ) string {
656
+ func (b * ByocAws ) getPublicFqdn (fqn qualifiedName ) string {
672
657
if b .customDomain == "" {
673
658
return "" //b.fqdn
674
659
}
@@ -677,12 +662,12 @@ func (b ByocAws) getPublicFqdn(fqn qualifiedName) string {
677
662
}
678
663
679
664
// This function was copied from Fabric controller and slightly modified to work with BYOC
680
- func (b ByocAws ) getPrivateFqdn (fqn qualifiedName ) string {
665
+ func (b * ByocAws ) getPrivateFqdn (fqn qualifiedName ) string {
681
666
safeFqn := dnsSafeLabel (fqn )
682
667
return fmt .Sprintf ("%s.%s" , safeFqn , b .privateDomain ) // TODO: consider merging this with ServiceDNS
683
668
}
684
669
685
- func (b ByocAws ) getProjectDomain (zone string ) string {
670
+ func (b * ByocAws ) getProjectDomain (zone string ) string {
686
671
projectLabel := dnsSafeLabel (b .pulumiProject )
687
672
if projectLabel == dnsSafeLabel (b .tenantID ) {
688
673
return dnsSafe (zone ) // the zone will already have the tenant ID
@@ -799,7 +784,7 @@ func (b *ByocAws) LoadProjectName() (string, error) {
799
784
}
800
785
p , err := b .LoadProject ()
801
786
if err != nil {
802
- return "" , err
787
+ return b . tenantID , err
803
788
}
804
789
return p .Name , nil
805
790
}
0 commit comments