public abstract class ResourceLock<T extends io.fabric8.kubernetes.api.model.HasMetadata> extends Object implements Lock
LEADER_ELECTION_RECORD_ANNOTATION_KEY| Constructor and Description |
|---|
ResourceLock(io.fabric8.kubernetes.api.model.ObjectMeta meta,
String identity) |
ResourceLock(String namespace,
String name,
String identity) |
| Modifier and Type | Method and Description |
|---|---|
void |
create(KubernetesClient client,
LeaderElectionRecord leaderElectionRecord)
Attempt to create a new
LeaderElectionRecord. |
String |
describe()
Full description of the current lock.
|
LeaderElectionRecord |
get(KubernetesClient client)
Returns the current
LeaderElectionRecord or null if none. |
protected abstract Class<T> |
getKind() |
protected io.fabric8.kubernetes.api.model.ObjectMetaBuilder |
getObjectMeta(String version) |
String |
identity()
Returns the unique id of the lock holder.
|
protected abstract LeaderElectionRecord |
toRecord(T resource) |
protected abstract T |
toResource(LeaderElectionRecord leaderElectionRecord,
io.fabric8.kubernetes.api.model.ObjectMetaBuilder meta)
Convert the record to a resource
|
void |
update(KubernetesClient client,
LeaderElectionRecord leaderElectionRecord)
Attempts to update the current
LeaderElectionRecord. |
public ResourceLock(io.fabric8.kubernetes.api.model.ObjectMeta meta,
String identity)
public LeaderElectionRecord get(KubernetesClient client)
LockLeaderElectionRecord or null if none.public void create(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)
LockLeaderElectionRecord.public void update(KubernetesClient client, LeaderElectionRecord leaderElectionRecord)
LockLeaderElectionRecord.protected abstract T toResource(LeaderElectionRecord leaderElectionRecord, io.fabric8.kubernetes.api.model.ObjectMetaBuilder meta)
leaderElectionRecord - meta - not nullprotected abstract LeaderElectionRecord toRecord(T resource)
protected io.fabric8.kubernetes.api.model.ObjectMetaBuilder getObjectMeta(String version)
public String identity()
LeaderElectionRecord.getHolderIdentity()
to check for leadership.Copyright © 2015–2023 Red Hat. All rights reserved.