I have the following json
{
"namespace": "monitoring",
"name": "alok",
"spec": {
"replicas": 1,
"template": {
"metadata": "aaa",
"spec": {
"containers": [
{
"image": "practodev/test:test",
"env": [
{
"name":"GF_SERVER_HTTP_PORT",
"value":"3000"
},
{
"name":"GF_SERVER_HTTPS_PORT",
"value":"443"
},
]
}
]
}
}
}
}
How do I add deployment_env.json
using jsonnet?
{
"env": [
{
"name":"GF_AUTH_DISABLE_LOGIN_FORM",
"value":"false"
},
{
"name":"GF_AUTH_BASIC_ENABLED",
"value":"false"
},
]
}
I need to add it under spec.template.containers[0].env = deployment_env.json
I wrote the below jsonnet to do that. It appends a new element. But i need to change the existing 0th container element in the json. Please suggest how to do it.
local grafana_envs = (import 'custom_grafana/deployment_env.json');
local grafanaDeployment = (import 'nested.json') + {
spec+: {
template+: {
spec+: {
containers+: [{
envs: grafana_envs.env,
}]
}
}
},
};
grafanaDeployment