diff --git a/skaha/src/main/java/org/opencadc/skaha/utils/CommandExecutioner.java b/skaha/src/main/java/org/opencadc/skaha/utils/CommandExecutioner.java index 042bedf8..b4c76752 100644 --- a/skaha/src/main/java/org/opencadc/skaha/utils/CommandExecutioner.java +++ b/skaha/src/main/java/org/opencadc/skaha/utils/CommandExecutioner.java @@ -132,7 +132,10 @@ static String[] getDeleteSecretCommand(final String secretName) { if (!StringUtil.hasText(secretName)) { throw new IllegalArgumentException("secretName is required."); } - return new String[] {"kubectl", "--namespace", K8SUtil.getWorkloadNamespace(), "delete", "secret", secretName}; + return KubectlCommandBuilder.command("delete") + .namespace(K8SUtil.getWorkloadNamespace()) + .option("secret", secretName) + .build(); } static String[] getRegistryCreateSecretCommand(final ImageRegistryAuth registryAuth, final String secretName) { @@ -142,18 +145,13 @@ static String[] getRegistryCreateSecretCommand(final ImageRegistryAuth registryA throw new IllegalArgumentException("secretName is required."); } - return new String[] { - "kubectl", - "--namespace", - K8SUtil.getWorkloadNamespace(), - "create", - "secret", - "docker-registry", - secretName, - "--docker-server=" + registryAuth.getHost(), - "--docker-username=" + registryAuth.getUsername(), - "--docker-password=" + new String(registryAuth.getSecret()) - }; + return KubectlCommandBuilder.command("create") + .namespace(K8SUtil.getWorkloadNamespace()) + .argument("secret") + .option("docker-registry", secretName) + .argument("--docker-server=" + registryAuth.getHost()) + .argument("--docker-username=" + registryAuth.getUsername()) + .argument("--docker-password=" + new String(registryAuth.getSecret())).build(); } public static JSONObject getSecretData(final String secretName, final String secretNamespace) throws Exception {