Skip to content

Commit

Permalink
feat(provider/google): Added all cloudrun commands in halyard
Browse files Browse the repository at this point in the history
  • Loading branch information
sanopsmx committed Aug 28, 2024
1 parent 23e23c0 commit f5a20b4
Show file tree
Hide file tree
Showing 15 changed files with 534 additions and 0 deletions.
201 changes: 201 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@
* [**hal config provider cloudfoundry account list**](#hal-config-provider-cloudfoundry-account-list)
* [**hal config provider cloudfoundry disable**](#hal-config-provider-cloudfoundry-disable)
* [**hal config provider cloudfoundry enable**](#hal-config-provider-cloudfoundry-enable)
* [**hal config provider cloudrun**](#hal-config-provider-cloudrun)
* [**hal config provider cloudrun account**](#hal-config-provider-cloudrun-account)
* [**hal config provider cloudrun account add**](#hal-config-provider-cloudrun-account-add)
* [**hal config provider cloudrun account delete**](#hal-config-provider-cloudrun-account-delete)
* [**hal config provider cloudrun account edit**](#hal-config-provider-cloudrun-account-edit)
* [**hal config provider cloudrun account get**](#hal-config-provider-cloudrun-account-get)
* [**hal config provider cloudrun account list**](#hal-config-provider-cloudrun-account-list)
* [**hal config provider cloudrun disable**](#hal-config-provider-cloudrun-disable)
* [**hal config provider cloudrun edit**](#hal-config-provider-cloudrun-edit)
* [**hal config provider cloudrun enable**](#hal-config-provider-cloudrun-enable)
* [**hal config provider dcos**](#hal-config-provider-dcos)
* [**hal config provider dcos account**](#hal-config-provider-dcos-account)
* [**hal config provider dcos account add**](#hal-config-provider-dcos-account-add)
Expand Down Expand Up @@ -7124,6 +7134,7 @@ hal config provider [subcommands]
* `aws`: Manage and view Spinnaker configuration for the aws provider
* `azure`: Manage and view Spinnaker configuration for the azure provider
* `cloudfoundry`: Manage and view Spinnaker configuration for the cloudfoundry provider
* `cloudrun`: Manage and view Spinnaker configuration for the cloudrun provider
* `dcos`: Manage and view Spinnaker configuration for the dcos provider
* `docker-registry`: Manage and view Spinnaker configuration for the dockerRegistry provider
* `ecs`: Manage and view Spinnaker configuration for the ecs provider
Expand Down Expand Up @@ -8172,6 +8183,196 @@ hal config provider cloudfoundry enable [parameters]
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun

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/](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`.

#### Usage
```
hal config provider cloudrun [parameters] [subcommands]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.

#### Subcommands
* `account`: Manage and view Spinnaker configuration for the cloudrun provider's account
* `disable`: Set the cloudrun provider as disabled
* `edit`: Edit Spinnaker's cloudrun configuration.
* `enable`: Set the cloudrun provider as enabled

---
## hal config provider cloudrun account

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>`.

#### Usage
```
hal config provider cloudrun account ACCOUNT [parameters] [subcommands]
```

#### Parameters
`ACCOUNT`: The name of the account to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.

#### Subcommands
* `add`: Add an account to the cloudrun provider.
* `delete`: Delete a specific cloudrun account by name.
* `edit`: Edit an account in the cloudrun provider.
* `get`: Get the specified account details for the cloudrun provider.
* `list`: List the account names for the cloudrun provider.

---
## hal config provider cloudrun account add

Add an account to the cloudrun provider.

#### Usage
```
hal config provider cloudrun account add ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the account to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--environment`: The environment name for the account. Many accounts can share the same environment (e.g. dev, test, prod)
* `--json-path`: The path to a JSON service account that Spinnaker will use as credentials. This is only needed if Spinnaker is not deployed on a Google Compute Engine VM, or needs permissions not afforded to the VM it is running on. See [https://cloud.google.com/compute/docs/access/service-accounts](https://cloud.google.com/compute/docs/access/service-accounts) for more information.
* `--local-repository-directory`: (*Default*: `/var/tmp/clouddriver`) A local directory to be used to stage source files for Cloud Run deployments within Spinnaker's Clouddriver microservice.
* `--no-validate`: (*Default*: `false`) Skip validation.
* `--project`: (*Required*) The Google Cloud Platform project this Spinnaker account will manage.
* `--read-permissions`: (*Default*: `[]`) A user must have at least one of these roles in order to view this account's cloud resources.
* `--required-group-membership`: (*Default*: `[]`) A user must be a member of at least one specified group in order to make changes to this account's cloud resources.
* `--ssh-trust-unknown-hosts`: (*Default*: `false`) 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.
* `--write-permissions`: (*Default*: `[]`) A user must have at least one of these roles in order to make changes to this account's cloud resources.


---
## hal config provider cloudrun account delete

Delete a specific cloudrun account by name.

#### Usage
```
hal config provider cloudrun account delete ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the account to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun account edit

Edit an account in the cloudrun provider.

#### Usage
```
hal config provider cloudrun account edit ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the account to operate on.
* `--add-read-permission`: Add this permission to the list of read permissions.
* `--add-required-group-membership`: Add this group to the list of required group memberships.
* `--add-write-permission`: Add this permission to the list of write permissions.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--environment`: The environment name for the account. Many accounts can share the same environment (e.g. dev, test, prod)
* `--json-path`: The path to a JSON service account that Spinnaker will use as credentials. This is only needed if Spinnaker is not deployed on a Google Compute Engine VM, or needs permissions not afforded to the VM it is running on. See [https://cloud.google.com/compute/docs/access/service-accounts](https://cloud.google.com/compute/docs/access/service-accounts) for more information.
* `--local-repository-directory`: A local directory to be used to stage source files for Cloud Run deployments within Spinnaker's Clouddriver microservice.
* `--no-validate`: (*Default*: `false`) Skip validation.
* `--project`: The Google Cloud Platform project this Spinnaker account will manage.
* `--read-permissions`: A user must have at least one of these roles in order to view this account's cloud resources.
* `--remove-read-permission`: Remove this permission from the list of read permissions.
* `--remove-required-group-membership`: Remove this group from the list of required group memberships.
* `--remove-write-permission`: Remove this permission to from list of write permissions.
* `--required-group-membership`: A user must be a member of at least one specified group in order to make changes to this account's cloud resources.
* `--ssh-known-hosts-file-path`: The path to a known_hosts file to be used when connecting with a remote git repository over SSH.
* `--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.
* `--write-permissions`: A user must have at least one of these roles in order to make changes to this account's cloud resources.


---
## hal config provider cloudrun account get

Get the specified account details for the cloudrun provider.

#### Usage
```
hal config provider cloudrun account get ACCOUNT [parameters]
```

#### Parameters
`ACCOUNT`: The name of the account to operate on.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun account list

List the account names for the cloudrun provider.

#### Usage
```
hal config provider cloudrun account list [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun disable

Set the cloudrun provider as disabled

#### Usage
```
hal config provider cloudrun disable [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun edit

Edit Spinnaker's cloudrun configuration.

#### Usage
```
hal config provider cloudrun edit [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--gcloudPath`: The path to the gcloud executable on the machine running clouddriver.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider cloudrun enable

Set the cloudrun provider as enabled

#### Usage
```
hal config provider cloudrun enable [parameters]
```

#### Parameters
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.


---
## hal config provider dcos

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.aws.AwsCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.azure.AzureCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudfoundry.CloudFoundryCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.cloudrun.CloudrunCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.dcos.DCOSCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.dockerRegistry.DockerRegistryCommand;
import com.netflix.spinnaker.halyard.cli.command.v1.config.providers.ecs.EcsCommand;
Expand Down Expand Up @@ -50,6 +51,7 @@ public ProviderCommand() {
registerSubcommand(new AwsCommand());
registerSubcommand(new AzureCommand());
registerSubcommand(new CloudFoundryCommand());
registerSubcommand(new CloudrunCommand());
registerSubcommand(new DCOSCommand());
registerSubcommand(new DockerRegistryCommand());
registerSubcommand(new EcsCommand());
Expand Down
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());
}
}
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();
}
}
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());
}
}
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.";
}
Loading

0 comments on commit f5a20b4

Please sign in to comment.