maopuppets
maopuppets

Reputation: 470

Can a configMap of type array be created in Kubernetes

Does the following configuration for configMap create the test.json file of type empty array or string []

kind: ConfigMap
apiVersion: v1
metadata:
  name: myconfigmap
data:
  test.json: |-
    []

The convertor to JSON suggests string:

{
    "kind": "ConfigMap",
    "apiVersion": "v1",
    "metadata": {
        "name": "myconfigmap"
    },
    "data": {
        "test.json": "[]"
    }
}

My goal is to create configMap file with empty array.

Upvotes: 0

Views: 4609

Answers (1)

coderanger
coderanger

Reputation: 54249

Sure, you can make it whatever string you want, it just has to be a string. The thing you can't do is test.json: [] since that's an array. The fact that your string happens to be valid JSON is not something K8s knows or cares about.

Upvotes: 2

Related Questions