Sha256: 9747fb084ff8806ff89b3c4ae53eed38cf20ea1dfb46f2bef126c79575030aa6

Contents?: true

Size: 1.88 KB

Versions: 15

Compression:

Stored size: 1.88 KB

Contents

---
title: Skip Option
---

You can tell Kubes to skip resources to deploy. This can useful if you want to still resources with Kubes and have it compile `.kubes/output` files, but wish to deploy them outside of Kubes manually.

## Example

Here's an example with a Job.

.kubes/resources/cleanup/job.yaml:

```yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: cleanup
spec:
  template:
    spec:
      containers:
      - name: cleanup
        image: <%= docker_image %>
        command: ["bin/cleanup.sh"]
      restartPolicy: Never
```

To skip the cleanup job, use the `config.skip` option:

```ruby
Kubes.configure do |config|
  config.skip = ["cleanup/job"]
end
```

Now when you deploy, the `cleanup/job` resource will not be deployed:

    kubes deploy # deploys everything except cleanup/job

## Deploy Outside of Kubes

Then to deploy outside of kubes.

    $ kubes compile # not necessary if already ran: kubes deploy
    Compiled  .kubes/resources files to .kubes/output
    $ kubectl apply -f .kubes/output/cleanup/job.yaml
    job.batch/cleanup created
    $ kubectl delete -f .kubes/output/cleanup/job.yaml
    job.batch "cleanup" deleted
    $

## Env Var KUBES_SKIP

You can also us ethe `KUBES_SKIP` env var. It takes list of strings separated by a space. It adds onto the `config.skip` option. Example:

    KUBES_SKIP="cleanup/job" kubes delete

This can be useful for one-off use cases.

## Skip With kubes skip metdata

You can also skip a resource from being written by using `kubes.skip = true`. This is useful if you want to conditionally not create a resource with a variable. Example:

.kubes/resources/config_map.yaml

```yaml
<% if @skip %>
kubes:
  skip: true
<% end %>
metadata:
  namespace: demo-dev
  labels:
    app: demo-dev
  name: demo-dev-configmap-495c18844b
apiVersion: v1
kind: ConfigMap
```

If the variable is set to `@skip = true`, then the config_map.yaml will not get created.

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kubes-0.9.3 docs/_docs/config/skip.md
kubes-0.9.2 docs/_docs/config/skip.md
kubes-0.9.1 docs/_docs/config/skip.md
kubes-0.9.0 docs/_docs/config/skip.md
kubes-0.8.10 docs/_docs/config/skip.md
kubes-0.8.9 docs/_docs/config/skip.md
kubes-0.8.8 docs/_docs/config/skip.md
kubes-0.8.7 docs/_docs/config/skip.md
kubes-0.8.6 docs/_docs/config/skip.md
kubes-0.8.5 docs/_docs/config/skip.md
kubes-0.8.4 docs/_docs/config/skip.md
kubes-0.8.3 docs/_docs/config/skip.md
kubes-0.8.2 docs/_docs/config/skip.md
kubes-0.8.1 docs/_docs/config/skip.md
kubes-0.8.0 docs/_docs/config/skip.md