Skip to content

Commit

Permalink
Connect to GKE by default from the tool (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianglai authored Feb 24, 2025
1 parent bcf42bd commit 397f800
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions core/src/main/java/google/registry/tools/RegistryCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.beust.jcommander.ParametersDelegate;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import google.registry.persistence.transaction.JpaTransactionManager;
import google.registry.persistence.transaction.TransactionManagerFactory;
Expand All @@ -42,13 +41,6 @@
@Parameters(separators = " =", commandDescription = "Command-line interface to the registry")
final class RegistryCli implements CommandRunner {

private static final ImmutableSet<RegistryToolEnvironment> DEFAULT_GKE_ENVIRONMENTS =
ImmutableSet.of(
RegistryToolEnvironment.ALPHA,
RegistryToolEnvironment.CRASH,
RegistryToolEnvironment.QA,
RegistryToolEnvironment.SANDBOX);

// The environment parameter is parsed twice: once here, and once with {@link
// RegistryToolEnvironment#parseFromArgs} in the {@link RegistryTool#main} function.
//
Expand Down Expand Up @@ -78,9 +70,6 @@ final class RegistryCli implements CommandRunner {
+ "Beam pipelines")
private String sqlAccessInfoFile = null;

@Parameter(names = "--gke", description = "Whether to use GKE runtime, instead of GAE")
private boolean useGke = false;

@Parameter(names = "--gae", description = "Whether to use GAE runtime, instead of GKE")
private boolean useGae = false;

Expand Down Expand Up @@ -161,12 +150,6 @@ public void run(String[] args) throws Exception {
throw e;
}

checkState(!useGke || !useGae, "Cannot specify both --gke and --gae");
// Special logic to set the default based on the environment if neither --gae nor --gke is set.
if (!useGke && !useGae) {
useGke = DEFAULT_GKE_ENVIRONMENTS.contains(environment);
}

String parsedCommand = jcommander.getParsedCommand();
// Show the list of all commands either if requested or if no subcommand name was specified
// (which does not throw a ParameterException parse error above).
Expand All @@ -186,7 +169,7 @@ public void run(String[] args) throws Exception {
DaggerRegistryToolComponent.builder()
.credentialFilePath(credentialJson)
.sqlAccessInfoFile(sqlAccessInfoFile)
.useGke(useGke)
.useGke(!useGae)
.useCanary(useCanary)
.build();

Expand Down

0 comments on commit 397f800

Please sign in to comment.