UPdated doc

This commit is contained in:
vallard
2016-12-20 16:41:50 -08:00
parent 8633fba8bc
commit 518a13d83a
+105 -3
View File
@@ -1,15 +1,117 @@
# DRONE Kubernetes
# Drone Kubernetes
This drone kubernetes plugin does the equivalent of:
```
kubectl set image deploy/nginx-deployment nginx=nginx:sometag
kubectl apply -f deployment.yaml
```
It is assumed the deployment is already created as it simply runs an update. No error checking is there to see if it exists yet, so make sure it already exists!
The advantages of this plugin is that the ```deployment.yaml``` file can be a template file. We are able to substitute values like ```{{ build.number }}``` inside the file so you can update docker image names.
Basic example:
```yaml
pipeline:
kube:
template: deployment.yaml
```
Example configuration with non-default namespace:
```diff
pipeline:
kube:
template: deployment.yaml
+ namespace: mynamespace
```
## Secrets
The kube
The kube plugin supports reading credentials from the Drone secret store. This is strongly recommended instead of storing credentials in the pipeline configuration in plain text.
The following secrets should be set:
__KUBE_TOKEN__ This plugin has one authentication method and that is to use the token to authorize the user.
__KUBE_CA__ This should be the base64 encoding of your certificate authority. You can get this string by running the command:
```
export KUBE_CA=$(cat ca.pem | base64)
```
__KUBE_SERVER__ This is the server url for your kubernetes cluster. e.g: https://10.99.2.1:6443
## Template Reference
You can substitute the following values between ```{{ }}``` in your deployment template
repo.owner
: repository owner
repo.name
: repository name
build.status
: build status type enumeration, either `success` or `failure`
build.event
: build event type enumeration, one of `push`, `pull_request`, `tag`, `deployment`
build.number
: build number
build.commit
: git sha for current commit
build.branch
: git branch for current commit
build.tag
: git tag for current commit
build.ref
: git ref for current commit
build.author
: git author for current commit
build.link
: link the the build results in drone
build.created
: unix timestamp for build creation
build.started
: unix timestamp for build started
# Template Function Reference
uppercasefirst
: converts the first letter of a string to uppercase
uppercase
: converts a string to uppercase
lowercase
: converts a string to lowercase. Example `{{lowercase build.author}}`
datetime
: converts a unix timestamp to a date time string. Example `{{datetime build.started}}`
success
: returns true if the build is successful
failure
: returns true if the build is failed
truncate
: returns a truncated string to n characters. Example `{{truncate build.sha 8}}`
urlencode
: returns a url encoded string
since
: returns a duration string between now and the given timestamp. Example `{{since build.started}}`