cloud-runner

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2021 License: Apache-2.0

README

cloud-runner

Cloud Runner is a simple microservice that builds and runs a gcloud run deploy command against a given GCP project ID. For flag support please visit the wiki.

Development
Environment Variables
Name Description Required Notes
API_KEY Validated for Create/Delete operations ✔️
SQL_HOST SQL host If not set will default to local sqlite DB
SQL_NAME SQL database name If not set will default to local sqlite DB
SQL_PASS SQL password If not set will default to local sqlite DB
SQL_USER SQL username If not set will default to local sqlite DB
Build
make build
Test
make test
Run Locally

The following will show you how to run Cloud Runner locally and onboard your first account! Running locally will by default create a SQLite DB named cloud-runner.db in the current directory.

  1. Run cloud-runner
$ export API_KEY=test
$ make run
  1. Create an account. Cloud Runner connects to Spinnaker's fiat (at http://spin-fiat.spinnaker:7003) when deploying to GCP to verify the current user has read and write access to the account. The user is defined in the X-Spinnaker-User request header. When onboarding an account into Spinnaker make sure to define the read and write groups correctly!
$ curl -H "API-Key: test" localhost:80/v1/credentials -d '{
  "projectID": "test-project-id",
  "readGroups": [
    "test-group"
  ],
  "writeGroups": [
    "test-group"
  ]
}' | jq

You should see the response

{
  "account": "cr-test-project-id",
  "projectID": "test-project-id",
  "readGroups": [
    "test-group"
  ],
  "writeGroups": [
    "test-group"
  ]
}
  1. List credentials
$ curl localhost:80/v1/credentials | jq

You should see the response

{
  "credentials": [
    {
      "account": "cr-test-project-id",
      "projectID": "test-project-id",
      "readGroups": [
        "test-read-group"
      ],
      "writeGroups": [
        "test-group"
      ]
    }
  ]
}

To generate CURL commands to create and monitor a deployment, reference the swagger YAML at api/swagger.yaml.

Directories

Path Synopsis
cmd
cloud-runner command
internal
pkg
pkg/fiat/fiatfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
pkg/gcloud/gcloudfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
pkg/sql/sqlfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL