Skip to content

Commit

Permalink
Merge pull request #316 from slickwarren/cwarren/v2.9/add-corral-bastion
Browse files Browse the repository at this point in the history
[v2.9] add corralBastion back as a func
  • Loading branch information
bmdepesa authored Oct 11, 2024
2 parents 47c902e + 0f32fd7 commit 6459ed5
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions clients/corral/corral.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import (
)

const (
debugFlag = "--trace"
skipCleanupFlag = "--skip-cleanup"
corralPrivateSSHKey = "corral_private_key"
corralPublicSSHKey = "corral_public_key"
debugFlag = "--trace"
skipCleanupFlag = "--skip-cleanup"
corralPrivateSSHKey = "corral_private_key"
corralPublicSSHKey = "corral_public_key"
corralRegistryIP = "registry_ip"
corralRegistryPrivateIP = "registry_private_ip"
)

// GetCorralEnvVar gets corral environment variables
Expand Down Expand Up @@ -345,3 +347,23 @@ func SetCorralSSHKeys(corralName string) error {

return UpdateCorralConfig(corralPublicSSHKey, publicSSHkey)
}

// SetCorralBastion is a helper function that will set the corral bastion private and pulic addresses previously generated by `corralName`
func SetCorralBastion(corralName string) error {
bastion_ip, err := GetCorralEnvVar(corralName, corralRegistryIP)
if err != nil {
return err
}

err = UpdateCorralConfig(corralRegistryIP, bastion_ip)
if err != nil {
return err
}

bastion_internal_ip, err := GetCorralEnvVar(corralName, corralRegistryPrivateIP)
if err != nil {
return err
}

return UpdateCorralConfig(corralRegistryPrivateIP, bastion_internal_ip)
}

0 comments on commit 6459ed5

Please sign in to comment.