Skip to content

Commit 2644839

Browse files
committed
revises leader election example for clarification
1 parent 3564861 commit 2644839

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/src/main/java/io/kubernetes/client/examples/LeaderElectionExample.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.kubernetes.client.openapi.Configuration;
88
import io.kubernetes.client.util.Config;
99
import java.time.Duration;
10+
import java.util.UUID;
1011

1112
/**
1213
* A simple example of how to use the Java API
@@ -21,7 +22,11 @@ public static void main(String[] args) throws Exception {
2122
ApiClient client = Config.defaultClient();
2223
Configuration.setDefaultApiClient(client);
2324

24-
EndpointsLock lock = new EndpointsLock("kube-system", "leader-election", "foo");
25+
// New
26+
String appNamespace = "default";
27+
String appName = "leader-election-foobar";
28+
String lockHolderIdentityName = UUID.randomUUID().toString(); // Anything unique
29+
EndpointsLock lock = new EndpointsLock(appNamespace, appName, lockHolderIdentityName);
2530

2631
LeaderElectionConfig leaderElectionConfig =
2732
new LeaderElectionConfig(

0 commit comments

Comments
 (0)