Class ResourceLock<T extends io.fabric8.kubernetes.api.model.HasMetadata>
- java.lang.Object
-
- io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.ResourceLock<T>
-
- All Implemented Interfaces:
Lock
- Direct Known Subclasses:
ConfigMapLock,LeaseLock
public abstract class ResourceLock<T extends io.fabric8.kubernetes.api.model.HasMetadata> extends Object implements Lock
-
-
Field Summary
-
Fields inherited from interface io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.Lock
LEADER_ELECTION_RECORD_ANNOTATION_KEY
-
-
Constructor Summary
Constructors Constructor Description ResourceLock(io.fabric8.kubernetes.api.model.ObjectMeta meta, String identity)ResourceLock(String namespace, String name, String identity)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcreate(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)Attempt to create a newLeaderElectionRecord.Stringdescribe()Full description of the current lock.LeaderElectionRecordget(KubernetesClient client)Returns the currentLeaderElectionRecordor null if none.protected abstract Class<T>getKind()protected io.fabric8.kubernetes.api.model.ObjectMetaBuildergetObjectMeta(String version)Stringidentity()Returns the unique id of the lock holder.protected abstract LeaderElectionRecordtoRecord(T resource)protected abstract TtoResource(LeaderElectionRecord leaderElectionRecord, io.fabric8.kubernetes.api.model.ObjectMetaBuilder meta)Convert the record to a resourcevoidupdate(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)Attempts to update the currentLeaderElectionRecord.
-
-
-
Method Detail
-
get
public LeaderElectionRecord get(KubernetesClient client)
Description copied from interface:LockReturns the currentLeaderElectionRecordor null if none.
-
create
public void create(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)
Description copied from interface:LockAttempt to create a newLeaderElectionRecord.
-
update
public void update(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)
Description copied from interface:LockAttempts to update the currentLeaderElectionRecord.
-
toResource
protected abstract T toResource(LeaderElectionRecord leaderElectionRecord, io.fabric8.kubernetes.api.model.ObjectMetaBuilder meta)
Convert the record to a resource- Parameters:
leaderElectionRecord-meta- not null- Returns:
-
toRecord
protected abstract LeaderElectionRecord toRecord(T resource)
-
getObjectMeta
protected io.fabric8.kubernetes.api.model.ObjectMetaBuilder getObjectMeta(String version)
-
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.
-
-