You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a Memcached Instance and a DNS Entry for that instance in a single package
I'm trying to use apply-time-mutation which will get the discoveryEndpoint of the memcached and create a DNS record for it in DNS.
The problem is the result includes the port:
kubectl get MemcacheInstance memcached-kpt-test -o jsonpath='{.status.discoveryEndpoint}'
10.19.208.3:11211
And I can't find a way to split it as jsonPath doesnt let me index strings (strings aren't arrays I suppose?)
> kubectl get MemcacheInstance memcached-kpt-test -o jsonpath='{.status.discoveryEndpoint[0:-6]}' -n waze-platform-codelabs
error: error executing jsonpath "{.status.discoveryEndpoint[0:-6]}": Error executing template: string is not array or slice. Printing more information for debugging the template:
template was:
{.status.discoveryEndpoint[0:-6]}
Sounds like it’s working as intended. The error message is even pretty clear. ;)
I don’t think there’s really any way to do what you’re trying to do with the current design.
Ironically, I initially proposed yq as a parser, which would have allowed this. The jsonPath code can’t easily be modified to add this kind of thing.
We could hypothetically add another field to describe how to process the value, but it’d probably need to support more than just substring operations by index. Regex might work.
Describe your problem
I am trying to create a Memcached Instance and a DNS Entry for that instance in a single package
I'm trying to use apply-time-mutation which will get the discoveryEndpoint of the memcached and create a DNS record for it in DNS.
The problem is the result includes the port:
And I can't find a way to split it as jsonPath doesnt let me index strings (strings aren't arrays I suppose?)
The whole object we tried as reference
This is not a massive blocker for us as Apply Time Mutations aren't supported yet in Config Sync which is the eventual consumer of this output.
Let us know if you need more information or want us to test something out. Or, if there is a more kpt native way to do this.
Thanks in advance!
The text was updated successfully, but these errors were encountered: