René's URL Explorer Experiment


Title: Add LeaseLock for leader election (upstream #1877) · Issue #1 · chala2001/python · GitHub

Open Graph Title: Add LeaseLock for leader election (upstream #1877) · Issue #1 · chala2001/python

X Title: Add LeaseLock for leader election (upstream #1877) · Issue #1 · chala2001/python

Description: Goal Add LeaseLock to kubernetes/base/leaderelection/resourcelock/, so leader election can use the Kubernetes coordination.k8s.io/v1 Lease resource instead of only ConfigMap. Upstream issue: kubernetes-client#1877 Why client-go moved lea...

Open Graph Description: Goal Add LeaseLock to kubernetes/base/leaderelection/resourcelock/, so leader election can use the Kubernetes coordination.k8s.io/v1 Lease resource instead of only ConfigMap. Upstream issue: kubern...

X Description: Goal Add LeaseLock to kubernetes/base/leaderelection/resourcelock/, so leader election can use the Kubernetes coordination.k8s.io/v1 Lease resource instead of only ConfigMap. Upstream issue: kubern...

Opengraph URL: https://github.com/chala2001/python/issues/1

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add LeaseLock for leader election (upstream #1877)","articleBody":"## Goal\n\nAdd `LeaseLock` to `kubernetes/base/leaderelection/resourcelock/`, so leader election can use the\nKubernetes `coordination.k8s.io/v1` `Lease` resource instead of only `ConfigMap`.\n\nUpstream issue: kubernetes-client/python#1877\n\n## Why\n\n`client-go` moved leader election to `Lease` and **removed** ConfigMap support entirely\n(`kubernetes/client-go` commit 276ea3ed). The Python client still only ships `ConfigMapLock`.\nThree separate people have asked for this, including one porting it to `kubernetes_asyncio`.\n\n## Prior art — this is a takeover, not a fresh start\n\nPR kubernetes-client/python#2314 by **@rvlane** (Dec 2024, +139/-7) implemented this.\n\n- `roycaihw` reviewed it: **\"LGTM overall. Could you add a test?\"**\n- The test was never added.\n- `k8s-triage-robot` auto-closed it 2025-11-21 after `lifecycle/stale` -> `lifecycle/rotten`.\n\n**The approach was approved. Only the test was missing.** rvlane's work is Apache-2.0 (CLA signed,\nconfirmed in the thread) and must be credited with a `Co-authored-by` trailer.\n\nReference implementation: `kubernetes/client-go` `tools/leaderelection/resourcelock/leaselock.go`.\n\n## Contract a lock must satisfy\n\nRead from `leaderelection.py`:\n\n- `get(name, namespace) -> (bool, LeaderElectionRecord | ApiException)`\n- `create(name, namespace, election_record) -> bool`\n- `update(name, namespace, updated_record) -> bool`\n- `.name`, `.namespace`, `.identity` attributes\n\n`LeaderElectionRecord` fields as written by `try_acquire_or_renew`:\n\n| field | written as |\n| --- | --- |\n| `holder_identity` | `str` |\n| `lease_duration` | `str(config.lease_duration)` |\n| `acquire_time` | `str(datetime)` -> `\"YYYY-MM-DD HH:MM:SS.ffffff\"` |\n| `renew_time` | same |\n\n**Critical:** `leaderelection.py` compares `old_election_record.__dict__ != self.observed_record.__dict__`.\nSo a value written and then read back **must compare equal**. The record round-trip through\n`V1LeaseSpec` (which stores real datetimes, not strings) is the main correctness risk and is what\nthe test must cover.\n\n## Changes needed on top of rvlane's version\n\n1. **Named logger.** rvlane's file calls `logging.basicConfig(level=logging.INFO)` at import and\n   uses `logging.info(...)`. Since that PR, this package moved to `logger =\n   logging.getLogger(\"leaderelection\")` (see `configmaplock.py:21`, `leaderelection.py`). Calling\n   `basicConfig` from a library reconfigures the **root logger of the importing application** — it\n   must not ship. Use the named logger.\n2. **Set `lease_reference` after a successful `create`**, so a following `update` in the same cycle\n   has a reference to work from.\n3. **Do not silently swallow a time parse failure** — `time_str_to_iso` currently logs and returns\n   `None`, which would write a null `acquireTime`.\n4. **Leave `configmaplock.py` alone.** rvlane's diff also removed unused imports there; that is\n   unrelated to the feature and widens the diff. Keep this PR focused.\n\n## Test plan (the missing piece roycaihw asked for)\n\nNew tests in `leaderelection_test.py`, mocking `CoordinationV1Api`:\n\n1. `create` builds a `V1Lease` with the right name and a spec carrying holder identity, duration\n   and both times.\n2. `get` on a missing lease returns `(False, ApiException)`.\n3. `get` on an existing lease returns a `LeaderElectionRecord` with the right holder identity.\n4. **Round-trip:** a record written by `create`/`update` and read back by `get` compares equal\n   field-for-field to what `leaderelection.py` would have written. This is the test that protects\n   the `__dict__` comparison above.\n5. `update` returns `False` (not raising) when the API raises `ApiException`.\n\n## Out of scope\n\n- Deprecating or removing `ConfigMapLock`.\n- Any change to `leaderelection.py` itself.\n- The asyncio client.\n","author":{"url":"https://github.com/chala2001","@type":"Person","name":"chala2001"},"datePublished":"2026-08-28T18:46:47Z","url":"https://github.com/chala2001/python/issues/1"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:46fd8875-0624-e202-679a-09f09c51f263
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCC72:8FE13:32B50D:440C6A:6AFE9D2D
html-safe-noncecd1b0409f354c6c6aa130560ca8e1e9e5bf6f8ef223f30cc9d409cb7cf799c98
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzcyOjhGRTEzOjMyQjUwRDo0NDBDNkE6NkFGRTlEMkQiLCJ2aXNpdG9yX2lkIjoiMjgxNzU0ODA4MTgyODg5NjA0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac188c2cb079ad2c3c7739a4e046c4c1bd3b05a9ce238685266c045e27ef8158db
hovercard-subject-tagissue:5281270755
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/chala2001/python/1/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1b45e6272d325daac6ce0bc1f46a7266b0de067a2a9d2b3aec13dfc7514431ea/chala2001/python/issues/1
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1b45e6272d325daac6ce0bc1f46a7266b0de067a2a9d2b3aec13dfc7514431ea/chala2001/python/issues/1
og:image:altGoal Add LeaseLock to kubernetes/base/leaderelection/resourcelock/, so leader election can use the Kubernetes coordination.k8s.io/v1 Lease resource instead of only ConfigMap. Upstream issue: kubern...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechala2001
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
go-importgithub.com/chala2001/python git https://github.com/chala2001/python.git
octolytics-dimension-user_id150885184
octolytics-dimension-user_loginchala2001
octolytics-dimension-repository_id1348432992
octolytics-dimension-repository_nwochala2001/python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id72473727
octolytics-dimension-repository_parent_nwokubernetes-client/python
octolytics-dimension-repository_network_root_id72473727
octolytics-dimension-repository_network_root_nwokubernetes-client/python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/chala2001/python/issues/1#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fchala2001%2Fpython%2Fissues%2F1
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fchala2001%2Fpython%2Fissues%2F1
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=chala2001%2Fpython
Reloadhttps://github.com/chala2001/python/issues/1
Reloadhttps://github.com/chala2001/python/issues/1
Reloadhttps://github.com/chala2001/python/issues/1
chala2001https://github.com/chala2001
pythonhttps://github.com/chala2001/python
Codehttps://github.com/chala2001/python
Issueshttps://github.com/chala2001/python/issues
Pull requestshttps://github.com/chala2001/python/pulls
Actionshttps://github.com/chala2001/python/actions
Projectshttps://github.com/chala2001/python/projects
Security and qualityhttps://github.com/chala2001/python/security
Insightshttps://github.com/chala2001/python/pulse
https://github.com/chala2001/python
New issuehttps://github.com/login?return_to=https://github.com/chala2001/python/issues/1
New issuehttps://github.com/login?return_to=https://github.com/chala2001/python/issues/1
Add LeaseLock for leader election (upstream #1877)https://github.com/chala2001/python/issues/1#top
https://github.com/chala2001
chala2001https://github.com/chala2001
on Aug 28, 2026https://github.com/chala2001/python/issues/1#issue-5281270755
kubernetes-client#1877https://github.com/kubernetes-client/python/issues/1877
kubernetes-client#2314https://github.com/kubernetes-client/python/pull/2314
@rvlanehttps://github.com/rvlane
https://github.com/chala2001
chala2001https://github.com/chala2001
on Aug 28, 2026https://github.com/chala2001/python/issues/1#issuecomment-5456534588
kubernetes-client#2690https://github.com/kubernetes-client/python/pull/2690
chala2001https://github.com/chala2001
completedhttps://github.com/chala2001/python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 28, 2026https://github.com/chala2001/python/issues/1#event-30182736615
Sign up for freehttps://github.com/signup?return_to=https://github.com/chala2001/python/issues/1
Sign in to commenthttps://github.com/login?return_to=https://github.com/chala2001/python/issues/1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.