Sha256: 86b59077725fdbec762ba7b50dc96b5beac42f3d17bdadc45a1fd058360d2ed9

Contents?: true

Size: 1.3 KB

Versions: 58

Compression:

Stored size: 1.3 KB

Contents

---
title: ConfigMap
categories: dsl
---

## Example

Here's an example of a ConfigMap.

.kubes/resources/shared/config_map.rb

```ruby
name "demo-config-map"
data(
  database: "mongodb",
  database_uri: "mongodb://localhost:27017",
)
```

Produces:

.kubes/output/shared/config_map.yaml

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: demo-config-map-cfbd534f91
  labels:
    app: demo
  namespace: default
data:
  database: mongodb
  database_uri: mongodb://localhost:27017
```

## Suffix Hash

{% include dsl/rolling_deployment.md kind="ConfigMap" %}

.kubes/output/web/deployment.yaml:

```yaml
# ..
spec:
  template:
    spec:
      containers:
      - name: demo-web
        image: nginx
        envFrom:
        - configMapRef:
            name: demo-config-map-cfbd534f91
```

{% include dsl/suffix_hash.md %}

## Files Helper

You can use a `files` helper to load ConfigMap values from one or more files.


.kubes/resources/shared/config_map.rb

```ruby
name "demo-secret"
files("files/configs.txt")
```

The `files/configs.txt` should be in the same folder as the `config_map.rb` definition.  Example:

.kubes/resources/shared/files/configs.txt

    CONFIG1=value1
    CONFIG2=value2

## DSL Methods

Here's a list of more common methods:

* data
* binaryData

{% include dsl/methods.md name="config_map" %}

Version data entries

58 entries across 58 versions & 1 rubygems

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