INNER CODE UNIT · Ruby

path_regex

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

      path_regex = %r{(/apis?/)(?<group>[^/]*)/?(?<version>v.+)}
      match = path.match(path_regex)
      {
        "verbs" => blob["verbs"],
        "kind" => blob["kind"],
        "apigroup" => match[:group],
        "version" => match[:version],
      }
    end

    def fetch_crds
      raw_json, err, st = kubectl.run("get", "CustomResourceDefinition", output: "json", attempts: 5,
        use_namespace: false)
      if st.success?
        JSON.parse(raw_json)["items"]
      else
        raise FatalKubeAPIError, "Error retrieving CustomResourceDefinition: #{err}"
      end

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…