Sha256: aa055dfc24b85d8a48c80d02c6618ddddd33b54702c60037701a80ea10f7074f

Contents?: true

Size: 853 Bytes

Versions: 31

Compression:

Stored size: 853 Bytes

Contents

---
title: Custom Helpers
---

Kubes ships with several built-in helpers. On top of this, you can define your own custom helpers.  This allows you to define new methods and customize Kubes further.

## Example

You define custom helpers in the `.kubes/helpers` folder.

.kubes/helpers/my_helpers.rb

```ruby
module MyHelpers
  def database_endpoint
    case Kubes.env
    when "dev"
      "dev-db.cbuqdmc3nqvb.us-west-2.rds.amazonaws.com"
    when "prod"
      "prod-db.cbuqdmc3nqvb.us-west-2.rds.amazonaws.com"
    end
  end
end
```

The `database_endpoint` will be available to use in the `.kubes/resources` YAML files. IE:

.kubes/helpers/resources/shared/config_map.yaml

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: demo
  labels:
    app: demo
data:
  DATABASE_ENDPOINT: <%= database_endpoint %>
```

{% include helpers/generator.md %}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
kubes-0.9.3 docs/_docs/helpers/custom.md
kubes-0.9.2 docs/_docs/helpers/custom.md
kubes-0.9.1 docs/_docs/helpers/custom.md
kubes-0.9.0 docs/_docs/helpers/custom.md
kubes-0.8.10 docs/_docs/helpers/custom.md
kubes-0.8.9 docs/_docs/helpers/custom.md
kubes-0.8.8 docs/_docs/helpers/custom.md
kubes-0.8.7 docs/_docs/helpers/custom.md
kubes-0.8.6 docs/_docs/helpers/custom.md
kubes-0.8.5 docs/_docs/helpers/custom.md
kubes-0.8.4 docs/_docs/helpers/custom.md
kubes-0.8.3 docs/_docs/helpers/custom.md
kubes-0.8.2 docs/_docs/helpers/custom.md
kubes-0.8.1 docs/_docs/helpers/custom.md
kubes-0.8.0 docs/_docs/helpers/custom.md
kubes-0.7.10 docs/_docs/helpers/custom.md
kubes-0.7.9 docs/_docs/helpers/custom.md
kubes-0.7.8 docs/_docs/helpers/custom.md
kubes-0.7.7 docs/_docs/helpers/custom.md
kubes-0.7.6 docs/_docs/helpers/custom.md