Class ConfigMapLock
- java.lang.Object
-
- io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.ConfigMapLock
-
-
Field Summary
-
Fields inherited from interface io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.Lock
LEADER_ELECTION_RECORD_ANNOTATION_KEY
-
-
Constructor Summary
Constructors Constructor Description ConfigMapLock(String configMapNamespace, String configMapName, String identity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C extends Namespaceable<C> & KubernetesClient>
voidcreate(C client, LeaderElectionRecord leaderElectionRecord)
Attempt to create a newLeaderElectionRecord
.String
describe()
Full description of the current lock.<C extends Namespaceable<C> & KubernetesClient>
LeaderElectionRecordget(C client)
Returns the currentLeaderElectionRecord
or null if none.String
identity()
Returns the unique id of the lock holder.<C extends Namespaceable<C> & KubernetesClient>
voidupdate(C client, LeaderElectionRecord leaderElectionRecord)
Attempts to update the currentLeaderElectionRecord
.
-
-
-
Method Detail
-
get
public <C extends Namespaceable<C> & KubernetesClient> LeaderElectionRecord get(C client)
Returns the currentLeaderElectionRecord
or null if none.
-
create
public <C extends Namespaceable<C> & KubernetesClient> void create(C client, LeaderElectionRecord leaderElectionRecord) throws LockException
Attempt to create a newLeaderElectionRecord
.- Specified by:
create
in interfaceLock
- Type Parameters:
C
- Type parameter for the Client- Parameters:
client
- used to retrieve the LeaderElectionRecordleaderElectionRecord
- to update- Throws:
LockException
- if update was not possible
-
update
public <C extends Namespaceable<C> & KubernetesClient> void update(C client, LeaderElectionRecord leaderElectionRecord) throws LockException
Attempts to update the currentLeaderElectionRecord
.- Specified by:
update
in interfaceLock
- Type Parameters:
C
- Type parameter for the Client- Parameters:
client
- used to retrieve the LeaderElectionRecordleaderElectionRecord
- to update- Throws:
LockException
- if update was not possible
-
identity
public String identity()
Returns the unique id of the lock holder. This id is to compare ids with currentLeaderElectionRecord.getHolderIdentity()
to check for leadership.
-
-