diff --git a/clients/corral/corral.go b/clients/corral/corral.go index cc02aec6..3a40d7b1 100644 --- a/clients/corral/corral.go +++ b/clients/corral/corral.go @@ -14,10 +14,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 @@ -217,3 +219,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) +}