Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching RKE endpoint from the env #2617

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions drivers/scheduler/rke/rke.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *Rancher) GetRancherClusterParametersValue() (*RancherClusterParameters,
// TODO Rancher URL for cloud cluster will not be fetched from master node IP
masterNodeName := node.GetMasterNodes()[0].Name
log.Infof("The master node here is %v", masterNodeName)
endpoint := "https://" + masterNodeName + "/v3"
endpoint := os.Getenv("SOURCE_RKE_URL")
rkeParameters.Endpoint = endpoint
rkeToken = os.Getenv("SOURCE_RKE_TOKEN")
if rkeToken == "" {
Expand All @@ -97,17 +97,20 @@ func (r *Rancher) UpdateRancherClient(clusterName string) error {
var rkeParametersValue RancherClusterParameters
var err error
var rkeToken string
masterNodeName := node.GetMasterNodes()[0].Name
endpoint := "https://" + masterNodeName + "/v3"
var endpoint string
if clusterName == "destination-config" {
rkeToken = os.Getenv("DESTINATION_RKE_TOKEN")
if rkeToken == "" {
return fmt.Errorf("env variable DESTINATION_RKE_TOKEN should not be empty")
endpoint = os.Getenv("DESTINATION_RKE_URL")
log.Infof("Destination endpoint: %v", endpoint)
if rkeToken == "" || endpoint == "" {
return fmt.Errorf("env variable DESTINATION_RKE_TOKEN or DESTINATION_RKE_URL should not be empty")
}
} else if clusterName == "source-config" {
rkeToken = os.Getenv("SOURCE_RKE_TOKEN")
if rkeToken == "" {
return fmt.Errorf("env variable SOURCE_RKE_TOKEN should not be empty")
endpoint = os.Getenv("SOURCE_RKE_URL")
log.Infof("Source endpoint: %v", endpoint)
if rkeToken == "" || endpoint == "" {
return fmt.Errorf("env variable SOURCE_RKE_TOKEN or SOURCE_RKE_URL should not be empty")
Comment on lines +100 to +113
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snigdha-px Do we really need the check here. I believe we can create only one Rancher cluster and add both source & destination clusters to same Rancher cluster. In that case we no need to export two env variables and no check required.
@sudas-px Need your inputs here.

}
} else {
return fmt.Errorf("cluster name is not correct")
Expand Down