问题描述
networkPolicies:
enforced: 'true'
namespaces: ["monitoring","default"]
我正在尝试在 for 循环中读取这些命名空间。但它无法正常工作..
for ns in $(yq read test/config/values.eks.yaml "eks.controlplane.networkPolicies.namespaces"); do
echo $ns
done
结果为 ["monitoring",
但我想要 ns 作为监控 如何解决这个问题?
解决方法
它对我有用,下面的代码,
for ns in $(yq read test/config/values.eks.yaml "eks.controlplane.networkPolicies.namespaces[*]"); do