{"id":16701631,"url":"https://github.com/mruoss/kubereq","last_synced_at":"2025-06-15T10:38:03.050Z","repository":{"id":230284419,"uuid":"776098680","full_name":"mruoss/kubereq","owner":"mruoss","description":"A Kubernetes Client for Elixir based on Req","archived":false,"fork":false,"pushed_at":"2025-06-03T21:01:54.000Z","size":360,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-04T14:44:16.410Z","etag":null,"topics":["api-client","elixir","kubernetes","kubernetes-client"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mruoss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["mruoss"]}},"created_at":"2024-03-22T17:19:10.000Z","updated_at":"2025-06-03T21:01:43.000Z","dependencies_parsed_at":"2024-03-28T21:35:31.223Z","dependency_job_id":"cc9eafca-a059-4caa-a0b4-fd77220da598","html_url":"https://github.com/mruoss/kubereq","commit_stats":null,"previous_names":["mruoss/kubereq"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/mruoss/kubereq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruoss%2Fkubereq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruoss%2Fkubereq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruoss%2Fkubereq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruoss%2Fkubereq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mruoss","download_url":"https://codeload.github.com/mruoss/kubereq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruoss%2Fkubereq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259960586,"owners_count":22938092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","elixir","kubernetes","kubernetes-client"],"created_at":"2024-10-12T18:44:56.647Z","updated_at":"2025-06-15T10:38:03.026Z","avatar_url":"https://github.com/mruoss.png","language":"Elixir","funding_links":["https://github.com/sponsors/mruoss"],"categories":["Cloud Infrastructure and Management"],"sub_categories":[],"readme":"# Kubereq\n\nUsed by [`kubegen`](https://github.com/mruoss/kubegen) to build Resource based\nKubernetes API clients using Req with `kubereq`.\n\n[![Module Version](https://img.shields.io/hexpm/v/kubereq.svg)](https://hex.pm/packages/kubereq)\n[![Last Updated](https://img.shields.io/github/last-commit/mruoss/kubereq.svg)](https://github.com/mruoss/kubereq/commits/main)\n\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/kubereq/)\n[![Total Download](https://img.shields.io/hexpm/dt/kubereq.svg)](https://hex.pm/packages/kubereq)\n[![License](https://img.shields.io/hexpm/l/kubereq.svg)](https://github.com/mruoss/kubereq/blob/main/LICENSE.md)\n\nWhile this library can be used directly, it is easier to let\n[`kubegen`](https://github.com/mruoss/kubegen) generate the API client modules\nfor you. The resulting clients are then using `kubereq` to get the prepared\n`Req.Request` struct and make the requests to the Kubernetes API Server.\n\n## Installation\n\nThe package can be installed by adding `kubereq` to your list of dependencies in\n`mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:kubereq, \"~\u003e 0.4.0\"}\n  ]\nend\n```\n\nThe docs can be found at \u003chttps://hexdocs.pm/kubereq\u003e.\n\n## Usage\n\nThis library can be used with plain `Req` but the functions in this module\nprovide an easier API to people used to `kubectl` and friends.\n\n### Kubereq API\n\nWhile you can use this library with plain `Req` functions (see below), it is\neasier to prepare a `Req` request for a specific resource and then use the\nfunctions defined in the `Kubereq` module.\n\n```ex\nsa_req = Req.new() |\u003e Kubereq.attach(api_version: \"v1\", kind: \"ServiceAccount\")\n\nKubereq.get(sa_req, \"my-namespace\", \"default\")\nKubereq.list(sa_req, \"my-namespace\")\n```\n\nOr use the functions right away, defining the resource through options:\n\n```ex\nreq = Req.new() |\u003e Kubereq.attach()\n\nKubereq.get(req, \"my-namespace\", \"default\", api_version: \"v1\", kind: \"ServiceAccount\")\n\n# get the \"status\" subresource of the default namespace\nKubereq.get(req, \"my-namespace\", api_version: \"v1\", kind: \"Namespace\", subresource: \"status\")\n```\n\nFor resources defined by Kubernetes, the `api_version` can be omitted:\n\n```ex\nReq.new()\n|\u003e Kubereq.attach(kind: \"Namespace\")\n|\u003e Kubereq.get(\"my-namespace\")\n```\n\n### Plain Req\n\nInestead of using the function in `Kubereq`, you can use\n`Kubereq.Kubeconfig.Default` to create connection to the cluster and then use\nplain `Req.request()` to make the request.\n\n```ex\nreq = Req.new() |\u003e Kubereq.attach()\n\nReq.request!(req,\n  api_version: \"v1\",\n  kind: \"ServiceAccount\",\n  operation: :get,\n  path_params: [namespace: \"default\", name: \"default\"]\n)\n```\n\nYou can pass your own Kubeconfigloader pipeline when attaching:\n\n```ex\nreq = Req.new() |\u003e Kubereq.attach(kubeconfig: {Kubereq.Kubeconfig.File, path: \"/path/to/kubeconfig.yaml\"})\n\nReq.request!(req,\n  api_version: \"v1\",\n  kind: \"ServiceAccount\",\n  operation: :get,\n  path_params: [namespace: \"default\", name: \"default\"]\n)\n```\n\nPrepare a `Req` struct for a specific resource:\n\n```ex\nsa_req = Req.new() |\u003e Kubereq.attach(api_version: \"v1\", kind: \"ServiceAccount\")\n\nReq.request!(sa_req,  operation: :get, path_params: [namespace: \"default\", name: \"default\"])\nReq.request!(sa_req,  operation: :list, path_params: [namespace: \"default\"])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmruoss%2Fkubereq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmruoss%2Fkubereq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmruoss%2Fkubereq/lists"}