{"id":19426607,"url":"https://github.com/oscaro/clj-k8s","last_synced_at":"2025-04-24T17:31:10.381Z","repository":{"id":154149773,"uuid":"630837489","full_name":"oscaro/clj-k8s","owner":"oscaro","description":"A fully featured Clojure wrapper for the Kubernetes API","archived":false,"fork":false,"pushed_at":"2024-03-22T10:17:37.000Z","size":664,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-17T16:16:27.445Z","etag":null,"topics":["clojure","kubernetes"],"latest_commit_sha":null,"homepage":"https://oscaro.github.io/clj-k8s/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oscaro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-04-21T09:07:15.000Z","updated_at":"2024-12-02T17:26:42.000Z","dependencies_parsed_at":"2023-06-03T03:45:56.853Z","dependency_job_id":null,"html_url":"https://github.com/oscaro/clj-k8s","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscaro%2Fclj-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscaro%2Fclj-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscaro%2Fclj-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscaro%2Fclj-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oscaro","download_url":"https://codeload.github.com/oscaro/clj-k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250674278,"owners_count":21469190,"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":["clojure","kubernetes"],"created_at":"2024-11-10T14:08:19.342Z","updated_at":"2025-04-24T17:31:09.821Z","avatar_url":"https://github.com/oscaro.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-k8s [![Clojure With Minikube](https://github.com/oscaro/clj-k8s/actions/workflows/clojure.yml/badge.svg?branch=master)](https://github.com/oscaro/clj-k8s/actions/workflows/clojure.yml) [![Clojars Project](https://img.shields.io/clojars/v/com.oscaro/clj-k8s.svg)](https://clojars.org/com.oscaro/clj-k8s)\n\n\n\u003ca href=\"https://github.com/oscaro/clj-k8s\"\u003e\u003cimg\n  src=\"https://raw.githubusercontent.com/oscaro/clj-k8s/master/.github/logo.png\"\n  height=\"180\" align=\"right\"\u003e\u003c/a\u003e\n\nA Clojure Wrapper for the [kubernetes](https://kubernetes.io/) API.\n\nSee [OpenAPI specification](https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-specification) for more information.\n\n## Generating Stubs\n\nStubs are generated with [OpenAPIGenerator](https://openapi-generator.tech/) from OpenAPI 2.0/3.x Kubernetes API definition\n\n```bash\n# Check your kubernetes version:\n\n$ kubectl version -o yaml\nclientVersion:\n  gitVersion: v1.26.1\n  platform: linux/amd64\nserverVersion:\n  gitVersion: v1.26.1\n\n$  bin/openapi-generate\n[...]\n\n$ git diff\n```\n\n## API Usage\n\n### Creating client instance\n\nClient is modelized by a map, initialization function depend of your Kubernetes distribution.\n\n\n```clojure\n(ns test\n  (:require [clj-k8s.auth :as ka]))\n\n;; From ServiceAccount\n(def client (ka/from-service-account))\n\n;; From GKE\n(def client (ka/from-gcp-kube-config))\n\n;; From Env\n(def client (ka/from-token))\n\n;; The default \u0026 Generic way\n(def client (ka/from-spec {:base-url \"https://localhost:6443\"\n                           :token \"eyGteo8o...\"\n                           :namespace \"wilkins\"}))\n```\n\n#### Special Notes\n- For GKE, the `KUBECONFIG` env variable is honored and `~/.kube/config` used as fallback if path isn't set via argv.\n- For environment variable, the `K8S_TOKEN` should be setup if not provided by argument\n\nThe Authentification method is subjected to change in the future, with a generic function for context resolving. We recommand using the `from-spec` method for the moment.\n\n## API Methods\n\n### Namespaces\n\n```clojure\n(require [clj-k8s.api :as k])\n\n(k/get-namespace client \"default\")\n(k/create-namespace client \"foobar\")\n(k/delete-namespace client \"foobar\")\n```\n\n## Testing\n\n### Setup Minikube\n\nSetup a minikube cluster and setup token \u0026 environnement variables as follow:\n\n```bash\n$ source bin/source-minikube\n\n$ echo $KUBERNETES_TOKEN\ney...\n```\n\n### Create API Token\n\n```bash\nkubectl -n kube-system create serviceaccount toast\nkubectl -n kube-system create clusterrolebinding toast-bind --clusterrole=cluster-admin --serviceaccount=kube-system:toast\nexport K8S_TOKEN=$(kubectl -n kube-system create token toast)\n```\n\n### Lauching tests\n\nWhen token is properly exported, run tests as follow:\n\n```\nlein test\n```\n\n## License\n\nCopyright © 2019-2023 Oscaro\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n\n[kubernetes]: https://kubernetes.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscaro%2Fclj-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foscaro%2Fclj-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscaro%2Fclj-k8s/lists"}