MCPcopy
hub / github.com/cortexlabs/cortex / ErrorFailedToConnectOperator

Function ErrorFailedToConnectOperator

cli/cluster/errors.go:46–73  ·  view source on GitHub ↗
(originalError error, envName string, operatorURL string)

Source from the content-addressed store, hash-verified

44)
45
46func 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
75func ErrorOperatorSocketRead(err error) error {
76 return errors.WithStack(&errors.Error{

Callers 2

streamLogsFunction · 0.85
makeOperatorRequestFunction · 0.85

Calls 3

TrimQueryParamsStrFunction · 0.92
MessageFunction · 0.92
WithStackFunction · 0.92

Tested by

no test coverage detected