Skip to content

oliver-nyt/drone-gke

 
 

Repository files navigation

drone-gke

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 x.X releases for stable use cases (eg 0.8). Breaking changes may occur between x.X releases (eg 0.7 and 0.8), and will be documented in the release notes.

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.

Container

  • Pushes to the develop branch will update the image tagged develop.
  • Pushes to the master branch will update the image tagged latest.
  • Tags to the master branch will create the images with the patch and minor tag values (eg 0.7.1 and 0.7).

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 TOKEN=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 \
  -e PLUGIN_CLUSTER \
  -e PLUGIN_NAMESPACE \
  -e PLUGIN_VARS \
  -e PLUGIN_ZONE  \
  -e SECRET_APP_API_KEY \
  -e SECRET_BASE64_P12_CERT \
  -e TOKEN="$(cat $TOKEN)" \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  nytimes/drone-gke --dry-run --verbose

# Remove --dry-run to deploy

Packages

No packages published

Languages

  • Go 77.9%
  • Makefile 17.5%
  • HCL 2.7%
  • Other 1.9%