kubernetes_asyncio.leaderelection.resourcelock.baselock module

class kubernetes_asyncio.leaderelection.resourcelock.baselock.BaseLock(name: str, namespace: str, identity: str)

Bases: object

abstractmethod 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

abstractmethod 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’

abstractmethod 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