Skip to content
Permalink
Browse files

Add documentation for using deployment-cli templating

  • Loading branch information...
TheUnnamedDude committed Jun 13, 2019
1 parent a6703c4 commit 84f1949927669b6117af2c09ac79d87c1ff5e417
Showing with 53 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +52 −1 content/deploy/README.md
@@ -1 +1,2 @@
.idea
*.iml
@@ -76,11 +76,62 @@ deployment-cli create \
--appid=1234 \
--key=/path/to/private-key.pem \
--resources=nais.yaml \
--config=placeholders.json
--vars=placeholders.json
```

If for any reason you are unable to use _deployment-cli_, please read the section on [NAIS deploy with cURL](#nais-deploy-with-curl).

### Handling multiple deployments using deployment-cli built in templating
deployment-cli has built in templating using [Handlebars](https://handlebarsjs.com/), this makes it possible to create
multiple deployments using the same nais.yaml as a template and different configuration files for placeholders. By
default deployment-cli will also inject a few of the flags passed to it:

* ref: git reference. Specified by the --ref flag. Default: master
* cluster: which cluster the deploy is for. Specified by the --cluster/-c flag. Default: dev-fss
* team: the team this deployment is for. Specified by the --team/t flag.
* version: the version, this is strictly for templating and should be used to specify which version of the Docker file should be pulled. Specified using the --version flag

```yaml
apiVersion: "nais.io/v1alpha1"
kind: "Application"
metadata:
name: {{application_name}}
namespace: default
labels:
team: {{team}}
spec:
image: "docker.pkg.github.com/navikt/{{version}}"
port: 8080
replicas:
min: 1
max: 4
cpuThresholdPercentage: 70
liveness:
path: /is_alive
readiness:
path: /is_alive
prometheus:
enabled: true
path: /prometheus
env:
{{#each env}}
name: '{{@key}}'
value: '{{this}}'
{{/each}}
```

Here the version number and team name will be injected by the flags passed to deployment-cli, application_name will come
from the configuration file. For each pair in the env tag it will inject the key as the env var name and value as is.
```javascript
{
"application_name": "example_app",
"env": {
"MY_ENV_VAR": "cluster specific value",
"SECOND_ENV_VAR": "another one"
}
}
```

### Deployment request spec

| Key | Description | Version added |

0 comments on commit 84f1949

Please sign in to comment.
You can’t perform that action at this time.