// ensureCurrentContext compares the current kubectl context with the targent
// context and exits if they do not match.
ensureCurrentContext compares the current kubectl context with the targent
context and exits if they do not match.
// ensureCurrentContext compares the current kubectl context with the targent // context and exits if they do not match .
func ensureCurrentContext(logger *logrus.Entry, config lib.MHConfig) {
	out, err := sh.Command("kubectl", "config", "current-context").Output()
	if err != nil {
		logger.WithField("error", err).Fatal("Failed running `kubectl config current-context`.")
	}
	currentContext := strings.TrimSuffix(string(out), "\n")
	if config.TargetContext != currentContext {
		logger.WithFields(logrus.Fields{
			"currentContext": currentContext,
			"targetContext":  config.TargetContext,
		}).Fatal("`kubectl config current-context` does not match configured targetContext")
	}
}
func ensureCurrentContext ( logger * logrus . Entry , config lib . MHConfig ) { out , err := sh . Command ( " " , " " , " " ) . Output ( ) if err != nil { logger . WithField ( " " , err ) . Fatal ( " " ) } currentContext := strings . TrimSuffix ( string ( out ) , " \n " ) if config . TargetContext != currentContext { logger . WithFields ( logrus . Fields { " " : currentContext , " " : config . TargetContext , } ) . Fatal ( " " ) } }
ensureCurrentContext compares the current kubectl context with the targent
context and exits if they do not match.
ensureCurrentContext compares the current kubectl context with the targent context and exits if they do not match .
// Fetch current context // Compare contexts