Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ocp token instead of password #23

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/main/java/io/tealc/ClusterManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public static synchronized ClusterManager getInstance() {
}

Config config = new ConfigBuilder()
.withUsername(Environment.WORKER_01_USERNAME)
.withPassword(Environment.WORKER_01_PASSWORD)
.withOauthToken(Environment.WORKER_01_TOKEN)
.withMasterUrl(Environment.WORKER_01_URL)
.withDisableHostnameVerification(true)
.withTrustCerts(true)
Expand All @@ -31,8 +30,7 @@ public static synchronized ClusterManager getInstance() {
CLIENTS.put(EClusters.WORKER_01, new KubeClient(config, "default"));

config = new ConfigBuilder()
.withUsername(Environment.WORKER_02_USERNAME)
.withPassword(Environment.WORKER_02_PASSWORD)
.withOauthToken(Environment.WORKER_02_TOKEN)
.withMasterUrl(Environment.WORKER_02_URL)
.withDisableHostnameVerification(true)
.withTrustCerts(true)
Expand All @@ -41,8 +39,7 @@ public static synchronized ClusterManager getInstance() {
CLIENTS.put(EClusters.WORKER_02, new KubeClient(config, "default"));

config = new ConfigBuilder()
.withUsername(Environment.WORKER_03_USERNAME)
.withPassword(Environment.WORKER_03_PASSWORD)
.withOauthToken(Environment.WORKER_03_TOKEN)
.withMasterUrl(Environment.WORKER_03_URL)
.withDisableHostnameVerification(true)
.withTrustCerts(true)
Expand Down
18 changes: 6 additions & 12 deletions src/main/java/io/tealc/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,21 @@ public class Environment {
private static final Logger LOGGER = LoggerFactory.getLogger(Environment.class);
private static final Map<String, String> VALUES = new HashMap<>();

public static final String WORKER_01_USERNAME_ENV = "WORKER_01_USERNAME";
public static final String WORKER_01_PASSWORD_ENV = "WORKER_01_PASSWORD";
public static final String WORKER_01_TOKEN_ENV = "WORKER_01_OCP_TOKEN";
public static final String WORKER_01_URL_ENV = "WORKER_01_URL";
public static final String WORKER_02_USERNAME_ENV = "WORKER_02_USERNAME";
public static final String WORKER_02_PASSWORD_ENV = "WORKER_02_PASSWORD";
public static final String WORKER_02_TOKEN_ENV = "WORKER_02_OCP_TOKEN";
public static final String WORKER_02_URL_ENV = "WORKER_02_URL";
public static final String WORKER_03_USERNAME_ENV = "WORKER_03_USERNAME";
public static final String WORKER_03_PASSWORD_ENV = "WORKER_03_PASSWORD";
public static final String WORKER_03_TOKEN_ENV = "WORKER_03_OCP_TOKEN";
public static final String WORKER_03_URL_ENV = "WORKER_03_URL";

/**
* Set values
*/
public static final String WORKER_01_USERNAME = getOrDefault(WORKER_01_USERNAME_ENV, null);
public static final String WORKER_01_PASSWORD = getOrDefault(WORKER_01_PASSWORD_ENV, null);
public static final String WORKER_01_TOKEN = getOrDefault(WORKER_01_TOKEN_ENV, null);
public static final String WORKER_01_URL = getOrDefault(WORKER_01_URL_ENV, null);
public static final String WORKER_02_USERNAME = getOrDefault(WORKER_02_USERNAME_ENV, null);
public static final String WORKER_02_PASSWORD = getOrDefault(WORKER_02_PASSWORD_ENV, null);
public static final String WORKER_02_TOKEN = getOrDefault(WORKER_02_TOKEN_ENV, null);
public static final String WORKER_02_URL = getOrDefault(WORKER_02_URL_ENV, null);
public static final String WORKER_03_USERNAME = getOrDefault(WORKER_03_USERNAME_ENV, null);
public static final String WORKER_03_PASSWORD = getOrDefault(WORKER_03_PASSWORD_ENV, null);
public static final String WORKER_03_TOKEN = getOrDefault(WORKER_03_TOKEN_ENV, null);
public static final String WORKER_03_URL = getOrDefault(WORKER_03_URL_ENV, null);

private Environment() { }
Expand Down
Loading