INNER CODE UNIT · Ruby

base_api_path

Shopify/krane · lib/krane/cluster_resource_discovery.rb:43

    def base_api_path
      @base_api_path ||= begin
        raw_response, err, st = kubectl.run("config", "view", "--minify", "--output",
          "jsonpath={.clusters[*].cluster.server}", attempts: 5, use_namespace: false)
        raise FatalKubeAPIError, "Error retrieving cluster url: #{err}" unless st.success?

        URI(raw_response).path.blank? ? "/" : URI(raw_response).path
      end
    end

    def api_paths
      @api_path_cache["/"] ||= begin
        raw_json, err, st = kubectl.run("get", "--raw", base_api_path, attempts: 5, use_namespace: false)
        paths = if st.success?
          JSON.parse(raw_json)["paths"]
        else
          raise FatalKubeAPIError, "Error retrieving raw path /: #{err}"
        end

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…