我们有从 libsonnet 导入的数组
{
"volumes": [
{
"emptyDir": {},
"name": "grafana-storage"
},
{
"configMap": {
"name": "grafana-dashboard-apiserver"
},
"name": " grafana-dashboard-apiserver"
}
]
}
我想替换这个元素:
{
"emptyDir": {},
"name": "grafana-storage"
},
与这个(相同name
):
{
"name": "grafana-storage",
"persistentVolumeClaim": {
"claimName": "product-nfs"
}
预期输出:
{
"volumes": [
{
"configMap": {
"name": "grafana-dashboard-apiserver"
},
"name": " grafana-dashboard-apiserver"
},
{
"name": "grafana-storage",
"persistentVolumeClaim": {
"claimName": "product-nfs"
}
}
]
}
“附加”很容易,但是如何删除现有的
例子:
local x = {volumes: [
{emptyDir: {}, name: 'grafana-storage' },
{configMap: {name: 'grafana-dashboard-apiserver'
}, name: ' grafana-dashboard-apiserver'},]};
x
+ {volumes+: [{name: 'grafana-storage',persistentVolumeClaim: {claimName:'product-nfs'}}]}
先谢谢了~