abundant-airplane-93796
08/14/2020, 12:44 AMmetadata:
annotations:
<http://beta.cloud.google.com/backend-config|beta.cloud.google.com/backend-config>: '{"default": "istio-ingressgateway"}'
<http://cloud.google.com/app-protocols|cloud.google.com/app-protocols>: '{"https":"HTTP2"}'
<http://cloud.google.com/neg|cloud.google.com/neg>: '{"ingress": true}'
<http://cloud.google.com/neg-status|cloud.google.com/neg-status>: '{"network_endpoint_groups":{"443":"k8s1-5487ae62-istio-system-istio-ingressgateway-443-811432aa"},"zones":["us-east1-d"]}'
I'd like to extract the value of the <http://cloud.google.com/neg-status|cloud.google.com/neg-status>
annotation in such a way that I can use it to retrieve a gcp network endpoint group like:
const neg = gcp.compute.getNetworkEndpointGroup({
name: "k8s1-5487ae62-istio-system-istio-ingressgateway-443-811432aa",
zone: "us-east1-d"
})
I'm usually ok working with outputs, but pulling something that's in json in a property of a property has got me beat right nowk8s.core.v1.Service.get
- just trying to figure out how best to use $myservice.metadata.annotations.apply
to extract what I needgorgeous-egg-16927
08/14/2020, 8:03 PMexport const neg_status = svc.metadata.annotations.apply(x => {
const status = x['<http://cloud.google.com/neg-status|cloud.google.com/neg-status>'];
const obj = JSON.parse(status);
return obj["network_endpoint_groups"]["443"]
})
const neg = gcp.compute.getNetworkEndpointGroup({
name: neg_status,
zone: "us-east1-d"
})