docs: private static boolean loadFromKubeconfig(Config config, String context, String kubeconfigContents, String kubeconfigPath) {
      try {
        io.fabric8.kubernetes.api.model.Config kubeConfig = KubeConfigUtils.parseConfigFromString(kubeconfigContents);
        if (context != null) {
          kubeConfig.setCurrentContext(context);
        }
        Context currentContext = KubeConfigUtils.getCurrentContext(kubeConfig);
        Cluster currentCluster = KubeConfigUtils.getCluster(kubeConfig, currentContext);
        if (currentCluster != null) {
          config.setMasterUrl(currentCluster.getServer());
          config.setNamespace(currentContext.getNamespace());
          config.setTrustCerts(currentCluster.getInsecureSkipTlsVerify() != null && currentCluster.getInsecureSkipTlsVerify());
          config.setDisableHostnameVerification(currentCluster.getInsecureSkipTlsVerify() != null && currentCluster.getInsecureSkipTlsVerify());
          config.setCaCertData(currentCluster.getCertificateAuthorityData());
          AuthInfo currentAuthInfo = KubeConfigUtils.getUserAuthInfo(kubeConfig, currentContext);
          if (currentAuthInfo != null) {
            // rewrite tls asset paths if needed
            String caCertFile = currentCluster.getCertificateAuthority();
            String clientCertFile = currentAuthInfo.getClientCertificate();
            String clientKeyFile = currentAuthInfo.getClientKey();
            if (kubeconfigPath != null && !kubeconfigPath.isEmpty()) {
              caCertFile = absolutify(new File(kubeconfigPath), currentCluster.getCertificateAuthority());
              clientCertFile = absolutify(new File(kubeconfigPath), currentAuthInfo.getClientCertificate());
              clientKeyFile = absolutify(new File(kubeconfigPath), currentAuthInfo.getClientKey());
            }
            config.setCaCertFile(caCertFile);
            config.setClientCertFile(clientCertFile);
            config.setClientCertData(currentAuthInfo.getClientCertificateData());
            config.setClientKeyFile(clientKeyFile);
            config.setClientKeyData(currentAuthInfo.getClientKeyData());
            config.setOauthToken(currentAuthInfo.getToken());
            config.setUsername(currentAuthInfo.getUsername());
            config.setPassword(currentAuthInfo.getPassword());
  
            if (Utils.isNullOrEmpty(config.getOauthToken()) && currentAuthInfo.getAuthProvider() != null && !Utils.isNullOrEmpty(currentAuthInfo.getAuthProvider().getConfig().get(ACCESS_TOKEN))) {
              config.setOauthToken(currentAuthInfo.getAuthProvider().getConfig().get(ACCESS_TOKEN));
            } else if (config.getOauthTokenProvider() == null) {  // https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins
              ExecConfig exec = currentAuthInfo.getExec();
              if (exec != null) {
                String apiVersion = exec.getApiVersion();
                if ("client.authentication.k8s.io/v1alpha1".equals(apiVersion) || "client.authentication.k8s.io/v1beta1".equals(apiVersion)) {
                  List<String> argv = new ArrayList<String>();
                  String command = exec.getCommand();
                  if (command.contains("/") && !command.startsWith("/") && kubeconfigPath != null && !kubeconfigPath.isEmpty()) {
                    // Appears to be a relative path; normalize. Spec is vague about how to detect this situation.
                    command = Paths.get(kubeconfigPath).resolveSibling(command).normalize().toString();
                  }
                  argv.add(command);
                  List<String> args = exec.getArgs();
                  if (args != null) {
                    argv.addAll(args);
                  }
                  ProcessBuilder pb = new ProcessBuilder(argv);
                  List<ExecEnvVar> env = exec.getEnv();
                  if (env != null) {
                    Map<String, String> environment = pb.environment();
                    env.forEach(var -> environment.put(var.getName(), var.getValue()));
                  }
                  // TODO check behavior of tty & stdin
                  Process p = pb.start();
                  if (p.waitFor() != 0) {
                    LOGGER.warn(IOHelpers.readFully(p.getErrorStream()));
                  }
                  ExecCredential ec = Serialization.unmarshal(p.getInputStream(), ExecCredential.class);
                  if (!apiVersion.equals(ec.apiVersion)) {
                    LOGGER.warn("Wrong apiVersion {} vs. {}", ec.apiVersion, apiVersion);
                  }
                  if (ec.status != null && ec.status.token != null) {
                    config.setOauthToken(ec.status.token);
                  } else {
                    LOGGER.warn("No token returned");
                  }
                } else { // TODO v1beta1?
                  LOGGER.warn("Unsupported apiVersion: {}", apiVersion);
                }
              }
            }
  
            config.getErrorMessages().put(401, "Unauthorized! Token may have expired! Please log-in again.");
            config.getErrorMessages().put(403, "Forbidden! User "+currentContext.getUser()+ " doesn't have permission.");
          }
          return true;
        }
      } catch (Exception e) {
        LOGGER.error("Failed to parse the kubeconfig.", e);
      }
  
      return false;
    }