-
Notifications
You must be signed in to change notification settings - Fork 704
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/google): Added all cloudrun commands in halyard
- Loading branch information
Showing
15 changed files
with
534 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ix/spinnaker/halyard/cli/command/v1/config/providers/cloudrun/CloudrunAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudrun; | ||
|
||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.AbstractAccountCommand; | ||
|
||
@Parameters(separators = "=") | ||
public class CloudrunAccountCommand extends AbstractAccountCommand { | ||
protected String getProviderName() { | ||
return "cloudrun"; | ||
} | ||
|
||
@Override | ||
protected String getLongDescription() { | ||
return String.join( | ||
"", | ||
"An account in the Cloud Run provider refers to a single Cloud Run application. ", | ||
"Spinnaker assumes that your Cloud Run application already exists. ", | ||
"You can create an application in your Google Cloud Platform project by running ", | ||
"`gcloud app create --region <region>`."); | ||
} | ||
|
||
public CloudrunAccountCommand() { | ||
super(); | ||
registerSubcommand(new CloudrunAddAccountCommand()); | ||
registerSubcommand(new CloudrunEditAccountCommand()); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...spinnaker/halyard/cli/command/v1/config/providers/cloudrun/CloudrunAddAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudrun; | ||
|
||
import com.beust.jcommander.Parameter; | ||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.account.AbstractAddAccountCommand; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.google.CommonGoogleCommandProperties; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.converter.LocalFileConverter; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.Account; | ||
import com.netflix.spinnaker.halyard.config.model.v1.providers.cloudrun.CloudrunAccount; | ||
|
||
@Parameters(separators = "=") | ||
public class CloudrunAddAccountCommand extends AbstractAddAccountCommand { | ||
protected String getProviderName() { | ||
return "cloudrun"; | ||
} | ||
|
||
@Parameter( | ||
names = "--project", | ||
required = true, | ||
description = CommonGoogleCommandProperties.PROJECT_DESCRIPTION) | ||
private String project; | ||
|
||
@Parameter( | ||
names = "--json-path", | ||
converter = LocalFileConverter.class, | ||
description = CommonGoogleCommandProperties.JSON_PATH_DESCRIPTION) | ||
private String jsonPath; | ||
|
||
@Parameter( | ||
names = "--local-repository-directory", | ||
description = CloudrunCommandProperties.LOCAL_REPOSITORY_DIRECTORY_DESCRIPTION) | ||
private String localRepositoryDirectory = "/var/tmp/clouddriver"; | ||
|
||
@Parameter( | ||
names = "--ssh-trust-unknown-hosts", | ||
description = CloudrunCommandProperties.SSH_TRUST_UNKNOWN_HOSTS, | ||
arity = 1) | ||
private boolean sshTrustUnknownHosts = false; | ||
|
||
@Override | ||
protected Account buildAccount(String accountName) { | ||
CloudrunAccount account = (CloudrunAccount) new CloudrunAccount().setName(accountName); | ||
account.setProject(project).setJsonPath(jsonPath); | ||
|
||
account | ||
.setLocalRepositoryDirectory(localRepositoryDirectory) | ||
.setSshTrustUnknownHosts(sshTrustUnknownHosts); | ||
return account; | ||
} | ||
|
||
@Override | ||
protected Account emptyAccount() { | ||
return new CloudrunAccount(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...m/netflix/spinnaker/halyard/cli/command/v1/config/providers/cloudrun/CloudrunCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudrun; | ||
|
||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.AbstractNamedProviderCommand; | ||
|
||
@Parameters(separators = "=") | ||
public class CloudrunCommand extends AbstractNamedProviderCommand { | ||
protected String getProviderName() { | ||
return "cloudrun"; | ||
} | ||
|
||
@Override | ||
protected String getLongDescription() { | ||
return String.join( | ||
"", | ||
"The Cloud Run provider is used to deploy resources to any number of Cloud Run applications. ", | ||
"To get started with Cloud Run, visit https://cloud.google.com/run/docs/. ", | ||
"For more information on how to configure individual accounts, please read the documentation ", | ||
"under `hal config provider cloudrun account -h`."); | ||
} | ||
|
||
public CloudrunCommand() { | ||
super(); | ||
registerSubcommand(new CloudrunEditCommand()); | ||
registerSubcommand(new CloudrunAccountCommand()); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...spinnaker/halyard/cli/command/v1/config/providers/cloudrun/CloudrunCommandProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudrun; | ||
|
||
public class CloudrunCommandProperties { | ||
static final String LOCAL_REPOSITORY_DIRECTORY_DESCRIPTION = | ||
"A local directory to be used to stage source files" | ||
+ " for Cloud Run deployments within Spinnaker's Clouddriver microservice."; | ||
static final String GIT_HTTPS_USERNAME_DESCRIPTION = | ||
"A username to be used when connecting with a remote git" + " repository server over HTTPS."; | ||
static final String GIT_HTTPS_PASSWORD_DESCRIPTION = | ||
"A password to be used when connecting with a remote git" + " repository server over HTTPS."; | ||
static final String GITHUB_OAUTH_ACCESS_TOKEN_DESCRIPTION = | ||
"An OAuth token provided by Github for connecting to " | ||
+ " a git repository over HTTPS." | ||
+ " See https://help.github.com/articles/creating-an-access-token-for-command-line-use for more information."; | ||
static final String SSH_PRIVATE_KEY_FILE_PATH = | ||
"The path to an SSH private key to be used when" | ||
+ " connecting with a remote git repository over SSH."; | ||
static final String SSH_PRIVATE_KEY_PASSPHRASE = | ||
"The passphrase to an SSH private key to be used" | ||
+ " when connecting with a remote git repository over SSH."; | ||
static final String SSH_KNOWN_HOSTS_FILE_PATH = | ||
"The path to a known_hosts file to be used when connecting with" | ||
+ " a remote git repository over SSH."; | ||
static final String SSH_TRUST_UNKNOWN_HOSTS = | ||
"Enabling this flag will allow Spinnaker to connect" | ||
+ " with a remote git repository over SSH without verifying the server's IP address" | ||
+ " against a known_hosts file."; | ||
static final String GCLOUD_RELEASE_TRACK = | ||
"The gcloud release track (ALPHA, BETA, or STABLE) that Spinnaker" | ||
+ " will use when deploying to Cloud Run."; | ||
static final String SERVICES = | ||
"A list of regular expressions. Any service matching one of these regexes " | ||
+ "will be indexed by Spinnaker."; | ||
static final String VERSIONS = | ||
"A list of regular expressions. Any version matching one of these regexes " | ||
+ "will be indexed by Spinnaker."; | ||
static final String OMIT_SERVICES = | ||
"A list of regular expressions. Any service matching one of these regexes " | ||
+ "will be ignored by Spinnaker."; | ||
static final String OMIT_VERSIONS = | ||
"A list of regular expressions. Any version matching one of these regexes " | ||
+ "will be ignored by Spinnaker."; | ||
static final String CACHING_INTERVAL_SECONDS = | ||
"The interval in seconds at which Spinnaker will poll for updates " | ||
+ "in your Cloud Run clusters."; | ||
} |
Oops, something went wrong.