INNER CODE UNIT · Ruby

api_paths

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

    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
        paths.select { |path| %r{^\/api.*\/v.*$}.match(path) }
      end
    end

    def fetch_api_path(path)
      @api_path_cache[path] ||= begin
        raw_json, err, st = kubectl.run("get", "--raw", path, attempts: 2, use_namespace: false)
        if st.success?
          JSON.parse(raw_json)
        else

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…