(originalError error, envName string, operatorURL string)
| 44 | ) |
| 45 | |
| 46 | func ErrorFailedToConnectOperator(originalError error, envName string, operatorURL string) error { |
| 47 | msg := "" |
| 48 | if originalError != nil { |
| 49 | msg += urls.TrimQueryParamsStr(errors.Message(originalError)) + "\n\n" |
| 50 | } |
| 51 | |
| 52 | if envName == "" { |
| 53 | msg += fmt.Sprintf("unable to connect to your cluster (operator endpoint: %s)\n\n", operatorURL) |
| 54 | msg += "if you don't have a cluster running:\n" |
| 55 | msg += " → to create a cluster, run `cortex cluster up`\n" |
| 56 | msg += "\nif you have a cluster running:\n" |
| 57 | msg += " → run `cortex cluster info --configure-env ENV_NAME` to update your environment (replace ENV_NAME with your desired environment name, and include `--config <cluster.yaml>` if you have a cluster configuration file)\n" |
| 58 | } else { |
| 59 | msg += fmt.Sprintf("unable to connect to your cluster in the %s environment (operator endpoint: %s)\n\n", envName, operatorURL) |
| 60 | msg += "if you don't have a cluster running:\n" |
| 61 | msg += fmt.Sprintf(" → if you'd like to create a cluster, run `cortex cluster up --configure-env %s`\n", envName) |
| 62 | msg += fmt.Sprintf(" → otherwise you can ignore this message, and prevent it in the future with `cortex env delete %s`\n", envName) |
| 63 | msg += "\nif you have a cluster running:\n" |
| 64 | msg += fmt.Sprintf(" → run `cortex cluster info --configure-env %s` to update your environment (include `--config <cluster.yaml>` if you have a cluster configuration file)\n", envName) |
| 65 | msg += fmt.Sprintf(" → if you set `operator_load_balancer_scheme: internal` in your cluster configuration file, your CLI must run from within a VPC that has access to your cluster's VPC (see https://docs.cortex.dev/v/%s/)\n", consts.CortexVersionMinor) |
| 66 | msg += fmt.Sprintf(" → confirm that the ip address of this machine falls within the CIDR ranges specified in `operator_load_balancer_cidr_whitelist`") |
| 67 | } |
| 68 | |
| 69 | return errors.WithStack(&errors.Error{ |
| 70 | Kind: ErrFailedToConnectOperator, |
| 71 | Message: msg, |
| 72 | }) |
| 73 | } |
| 74 | |
| 75 | func ErrorOperatorSocketRead(err error) error { |
| 76 | return errors.WithStack(&errors.Error{ |
no test coverage detected