kubernetes_asyncio.leaderelection.resourcelock.configmaplock module

class kubernetes_asyncio.leaderelection.resourcelock.configmaplock.ConfigMapLock(name: str, namespace: str, identity: str, api_client: ApiClient)

Bases: BaseLock

async create(name: str, namespace: str, election_record: LeaderElectionRecord) bool
Parameters:
  • electionRecord – Annotation string

  • name – Name of the configmap object to be created

  • namespace – Namespace in which the configmap object is to be created

Returns:

‘True’ if object is created else ‘False’ if failed

async get(name: str, namespace: str) tuple[bool, LeaderElectionRecord] | tuple[bool, Exception] | tuple[bool, None]
Parameters:
  • name – Name of the configmap object information to get

  • namespace – Namespace in which the configmap object is to be searched

Returns:

‘True, election record’ if object found else ‘False, exception response’

get_lock_dict(leader_election_record: LeaderElectionRecord) dict[str, Any]
get_lock_object(lock_record: dict) LeaderElectionRecord
async update(name: str, namespace: str, updated_record: LeaderElectionRecord) bool
Parameters:
  • name – name of the lock to be updated

  • namespace – namespace the lock is in

  • updated_record – the updated election record

Returns:

True if update is successful False if it fails