Skip to content

Commit

Permalink
feat: vault local service url for k3d (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristhianF7 authored Feb 8, 2024
1 parent ab51fb6 commit 80ec8e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *types.Gitop
fullDomainName = cl.DomainName
}

vaultUrl := fmt.Sprintf("https://vault.%s", fullDomainName)

if cl.CloudProvider == "k3d" {
vaultUrl = "http://vault.vault.svc:8200"
}

// If there are secret values, create a vault secret
if len(req.SecretKeys) > 0 {
log.Info().Msgf("cluster %s - application %s has secrets, creating vault values", cl.ClusterName, appDef.Name)
Expand All @@ -140,7 +146,7 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *types.Gitop
}

vaultClient, err := vaultapi.NewClient(&vaultapi.Config{
Address: fmt.Sprintf("https://vault.%s", fullDomainName),
Address: vaultUrl,
})
if err != nil {
return fmt.Errorf("cluster %s - error initializing vault client: %s", cl.ClusterName, err)
Expand Down

0 comments on commit 80ec8e2

Please sign in to comment.