[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nytimes/drone-gke

Repository files navigation

drone-gke

Build Status

Drone plugin to deploy container images to Kubernetes on Google Container Engine. For the usage information and a listing of the available options please take a look at the docs.

Simplify deploying to Google Kubernetes Engine. Derive the API endpoints and credentials from the Google credentials and open the yaml file to templatization and customization with each Drone build.

Links

Releases and versioning

Tool

This tool follows semantic versioning.

Use the minor version (x.X) releases for stable use cases (eg 0.9). Changes are documented in the release notes.

  • Pushes to the main branch will update the image tagged latest.
  • Releases will create the images with each major/minor/patch tag values (eg 0.7.1 and 0.7).

Kubernetes API

Since the 237.0.0 (2019-03-05) Google Cloud SDK, the container image contains multiple versions of kubectl. The corresponding client version that matches the cluster version will be used automatically. This follows the minor release support that GKE offers.

If you want to use a different version, you can specify the version of kubectl used with the kubectl_version parameter.

Usage

⚠️ For usage within in a .drone.yml pipeline, please take a look at the docs

Executing locally from the working directory:

# Deploy the manifest templates in local-example/
cd local-example/

# Set to the path of your GCP service account JSON-formatted key file
export JSON_TOKEN_FILE=xxx

# Set to your cluster
export PLUGIN_CLUSTER=yyy

# Set to your cluster's zone
export PLUGIN_ZONE=zzz

# Set to a namespace within your cluster's
export PLUGIN_NAMESPACE=drone-gke

# Example variables referenced within .kube.yml
export PLUGIN_VARS="$(cat vars.json)"
# {
#   "app": "echo",
#   "env": "dev",
#   "image": "gcr.io/google_containers/echoserver:1.4"
# }

# Example secrets referenced within .kube.sec.yml
export SECRET_APP_API_KEY=123
export SECRET_BASE64_P12_CERT="cDEyCg=="

# Execute the plugin
docker run --rm \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  -e PLUGIN_TOKEN="$(cat $JSON_TOKEN_FILE)" \
  -e PLUGIN_CLUSTER \
  -e PLUGIN_ZONE \
  -e PLUGIN_NAMESPACE \
  -e PLUGIN_VARS \
  -e SECRET_APP_API_KEY \
  -e SECRET_BASE64_P12_CERT \
  nytimes/drone-gke --dry-run --verbose

# Remove --dry-run to deploy