{"id":37141746,"url":"https://github.com/berquerant/k8s-lease","last_synced_at":"2026-01-14T16:38:18.034Z","repository":{"id":318735397,"uuid":"1075172495","full_name":"berquerant/k8s-lease","owner":"berquerant","description":"manage locks from shell scripts within Kubernetes","archived":false,"fork":false,"pushed_at":"2026-01-10T07:05:03.000Z","size":348,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T01:56:33.935Z","etag":null,"topics":["go","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","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/berquerant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-13T06:22:14.000Z","updated_at":"2026-01-10T07:05:07.000Z","dependencies_parsed_at":"2025-10-23T01:13:56.275Z","dependency_job_id":null,"html_url":"https://github.com/berquerant/k8s-lease","commit_stats":null,"previous_names":["berquerant/k8s-lease"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/berquerant/k8s-lease","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fk8s-lease","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fk8s-lease/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fk8s-lease/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fk8s-lease/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/k8s-lease/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fk8s-lease/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28426115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:32:27.303Z","status":"ssl_error","status_checked_at":"2026-01-14T16:28:36.419Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","kubernetes"],"created_at":"2026-01-14T16:38:17.591Z","updated_at":"2026-01-14T16:38:18.027Z","avatar_url":"https://github.com/berquerant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/berquerant/k8s-lease)](https://goreportcard.com/report/github.com/berquerant/k8s-lease)\n[![Go Reference](https://pkg.go.dev/badge/github.com/berquerant/k8s-lease.svg)](https://pkg.go.dev/github.com/berquerant/k8s-lease)\n\n# k8s-lease\n\n```\n❯ klock --help\nklock -- manage locks from shell scripts within Kubernetes\n\n# Usage\n\n  klock [flags] -- command [arguments]\n\nklock manages the Kubernetes lease locks from shell scripts or from the command line.\n\nklock runs the provided command (or a command with arguments) with mutual exclusion guaranteed by a lease.\nklock acquires a lock via a holder identity from a lease, which is created if it does not already exist.\n\nThe following labels are always applied to leases created by klock:\n\napp.kubernetes.io/managed-by=k8s-lease-klock\n\n# Examples\n\nSuppose you have a command, some_cmd, that you want to run regularly but not concurrently.\nYou can execute multiple instances of some_cmd exclusively using klock.\n\n  klock -l some_cmd_lease -i \"$(uuidgen)\" -- some_cmd\n\nA unique uuid is associated with the execution of some_cmd as the holder identity.\n\n# Permissions\n\nThe execution of klock requires permissions similar to the following role:\n\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  name: klock-role\nrules:\n  - apiGroups: [\"coordination.k8s.io\"]\n    resources: [\"leases\"]\n    verbs: [\"create\", \"get\", \"update\", \"patch\"]\n\nIf you use --cleanup-lease, please add delete to the verbs.\n\n# Exit status\n\n1 if failure.\nThe exit status of the given command, if klock executed it.\n\n# Flags\n\n      --add_dir_header                   If true, adds the file directory to the header of the log messages\n      --alsologtostderr                  log to standard error as well as files (no effect when -logtostderr=true)\n      --cleanup-lease                    If true, delete the created lease after processing.\n  -E, --conflict-exit-code uint8         The exit status used when the -w option is in use, and the timeout is reached. (default 1)\n  -i, --identity string                  The id of a lease holder. (default \"klock\")\n  -k, --kill-after duration              Also send a KILL signal if command is still running this long after the initial signal was sent.\n      --kubeconfig string\n      --labels value                     The additional labels of a lease\n  -l, --lease string                     The name of a lease. (default \"klock\")\n      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)\n      --log_dir string                   If non-empty, write log files in this directory (no effect when -logtostderr=true)\n      --log_file string                  If non-empty, use this log file (no effect when -logtostderr=true)\n      --log_file_max_size uint           Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)\n      --logtostderr                      log to standard error instead of files (default true)\n  -n, --namespace string                 The namespace of a lease. (default \"default\")\n      --one_output                       If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)\n  -s, --signal value                     Specify the signal to be sent on cancel; SIGNAL may be a name like 'HUP' or a number;\n                                         default is TERM; see 'kill -l' for a list of signals\n      --skip_headers                     If true, avoid header prefixes in the log messages\n      --skip_log_headers                 If true, avoid headers when opening log files (no effect when -logtostderr=true)\n      --stderrthreshold severity         logs at or above this threshold go to stderr when writing to files and stderr (no effect when -logtostderr=true or -alsologtostderr=true) (default 2)\n      --timeout duration                 Same as --wait.\n  -u, --unlock                           Same as --cleanup-lease.\n  -v, --v Level                          number for the log level verbosity\n  -V, --version                          Display version and exit.\n      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging\n  -w, --wait duration                    Fail if the lock cannot be acquired within the duration.\n                                         0 means wait infinitely.\n```\n\n## Development\n\n### Prerequisites\n\n- [direnv](https://github.com/direnv/direnv)\n- go version v1.25.1+\n- docker version 28.5.1+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fk8s-lease","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fk8s-lease","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fk8s-lease/lists"}