Skip to content

Commit

Permalink
add logs at end of install for kubeadmin, consoleURL
Browse files Browse the repository at this point in the history
  • Loading branch information
sallyom committed Dec 6, 2018
1 parent b4f5ceb commit 19b4f4f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cmd/openshift-install/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package main

import (
"context"
"encoding/json"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
Expand Down Expand Up @@ -263,18 +265,30 @@ func destroyBootstrap(ctx context.Context, directory string) (err error) {
}

// logComplete prints info upon completion
func logComplete(directory string) error {
absDir, err := filepath.Abs(directory)
if err != nil {
return err
}
tfvarsFile := filepath.Join(absDir, cluster.TfVarsFileName)
f, err := os.Open(tfvarsFile)
if err != nil {
return err
}
defer f.Close()
tfVars, _ := ioutil.ReadAll(f)
var result map[string]interface{}
json.Unmarshal([]byte(tfVars), &result)
clusterName := result["cluster_name"]
baseDomain := result["base_domain"]
kubeconfig := filepath.Join(absDir, "auth", "kubeconfig")
pwFile := filepath.Join(absDir, "auth", "kubeadmin-password")
pw, err := ioutil.ReadFile(pwFile)
if err != nil {
return err
}
logrus.Infof("kubeadmin user password: %s", pw)
logrus.Infof("Install complete! The kubeconfig is located here: %s", kubeconfig)
logrus.Info("Install complete!")
logrus.Infof("Run 'export KUBECONFIG=%s' to manage the cluster with 'oc', the OpenShift CLI.", kubeconfig)
logrus.Infof("The cluster is ready when 'oc login -u kubeadmin -p %s' succeeds (wait a few minutes).", pw)
logrus.Infof("Access the OpenShift web-console 'https://console-openshift-console.apps.%s.%s' with user: kubeadmin, password: %s", clusterName, baseDomain, pw)
return nil
}

0 comments on commit 19b4f4f

Please sign in to comment.