Is your feature request related to a problem? Please describe.
currently there is no way to get data from inside a json string defined in a cm. you can specify type: json, but that only parses the json and leaves its keys as a second class citizen.
Describe the solution you'd like
give a way to pull a single key or all the keys from a json into the top level of the returned fetchEnvs obj.
Describe alternatives you've considered
use fetchEnvs to get the json, then do post processing on the returned object to flatten accordingly
Additional context
example configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-info
namespace: kube-system
data:
cluster-config: |
{
"cluster_id": "1234",
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
a normal example of using .env in razee
env
- name: cluster-config # name of the key the fetched data will be assigned to
valueFrom:
configMapKeyRef:
key: cluster-config # key within configmap
name: cluster-info # configmap name
namespace: kube-system # configmap namespace
type: json # tells fetchEnvs to parse the fetched key
with a result of
{
"cluster-config":
{
"cluster_id": "1234",
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
}
example configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-info
namespace: kube-system
data:
cluster-config: |
{
"cluster_id": "1234",
"cluster_metadata": {
"created": "sometimelastweek"
},
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
example of using .env and being able to specify the path to a lower level json key
env:
- name: cluster_created # name of key retrieved data will be assigned to
valueFrom:
configMapKeyRef:
key: cluster-config # key within configmap
name: cluster-info # configmap name
namespace: kube-system # configmap namespace
type: json # tells fetchEnvs to parse the fetched key
pathStr: 'cluster_metadata.created' # must have type defined
with a result of
{
"cluster_created": "sometimelastweek"
}
example configmap with . in key name
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-info
namespace: kube-system
data:
cluster-config: |
{
"cluster_id": "1234",
"cluster.metadata": {
"created": "sometimelastweek"
},
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
example of using .env and being able to specify the path to a lower level json key
env:
- name: cluster_created # name of key retrieved data will be assigned to
valueFrom:
configMapKeyRef:
key: cluster-config# key within configmap
name: cluster-info # configmap name
namespace: kube-system # configmap namespace
type: json # tells fetchEnvs to parse the fetched key
path: ['cluster.metadata', 'created'] # must have type defined
with a result of
{
"cluster_created": "sometimelastweek"
}
example configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-info
namespace: kube-system
data:
cluster-config: |
{
"cluster_id": "1234",
"cluster_metadata": {
"created": "sometimelastweek"
},
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
example of using .env and being able to specify the path to get all json items
env:
- name: cluster_created # not used when path all `.` is defined
valueFrom:
configMapKeyRef:
key: cluster-config # key within configmap
name: cluster-info # configmap name
namespace: kube-system # configmap namespace
type: json # tells fetchEnvs to parse the fetched key
pathStr: '.' # must have type defined
with a result of
{
"cluster_id": "1234",
"cluster_metadata": {
"created": "sometimelastweek"
},
"cluster_name": "dev-mexico",
"cluster_type": "dev"
}
Is your feature request related to a problem? Please describe.
currently there is no way to get data from inside a json string defined in a cm. you can specify type: json, but that only parses the json and leaves its keys as a second class citizen.
Describe the solution you'd like
give a way to pull a single key or all the keys from a json into the top level of the returned fetchEnvs obj.
Describe alternatives you've considered
use fetchEnvs to get the json, then do post processing on the returned object to flatten accordingly
Additional context
example configmap
a normal example of using
.envin razeewith a result of
{ "cluster-config": { "cluster_id": "1234", "cluster_name": "dev-mexico", "cluster_type": "dev" } }example configmap
example of using
.envand being able to specify the path to a lower level json keywith a result of
{ "cluster_created": "sometimelastweek" }example configmap with
.in key nameexample of using
.envand being able to specify the path to a lower level json keywith a result of
{ "cluster_created": "sometimelastweek" }example configmap
example of using
.envand being able to specify the path to get all json itemswith a result of
{ "cluster_id": "1234", "cluster_metadata": { "created": "sometimelastweek" }, "cluster_name": "dev-mexico", "cluster_type": "dev" }