(eks): Support go-template in KubernetesObjectValue
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
The `eks.KubernetesObjectValue` custom resource currently takes a `jsonPath` which is used in the [kubectl get](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) command's `-o` flag.
`-o` can use other formats, and the `go-template` is pretty popular, and provides more power than the json path.
The `KubernetesObjectValue` could be extended to take a `jsonPath` or `goTemplate`.
### Use Case
I'm trying to pull a base64 encoded secret out of a k8s stack and put it into an SSM secret so it can be used as a secret env var in ECS.
I can get this in `kubectl` like
```
kubectl get secret my-secret -o go-template="{{.data.connectionString | base64decode}}"
```
### Proposed Solution
A new prop to `KubernetesObjectValue` which the [handler](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-eks/lib/kubectl-handler/get/__init__.py#L46) could just switch on to use whichever one is provided.
### Other Information
I think this'd be straightforward to do, I'll aim to give it a go in the coming days unless there's resistance to adding it.
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.49.1 (build be5fcf4)
### Environment details (OS name and version, etc.)
Windows 10
Contributor guide
Assessment
This issue has not been assessed yet.