Open zevisert opened 2 years ago
One way to make set-image
universal will be to change it behavior to:
It can act on any nested object at any arbitrary level in KRM object if the nested object has a shape that contains name
and image
field and one can filter on the basis of name
or image
field to set the new values.
....
....
.... - name:
image:
/cc @yuwenma @natasha41575
Thanks for the triage! I thought about making a feature request for the recursive image approach like that first, but went for what I submitted here instead.
In my example, recursively finding image
would change the image at name=instance2
, when I only wanted to change the one at instance1
. That said, I think that's also better than what set-image
does right now.
Looking at you CronJob, and your
.spec.jobTemplate.spec.template.spec.containers.*.image
which doesn't appear in the defaults...
But, as a user I'd appreciate the control of the replacement-style filters the most.
In my example, recursively finding image would change the image at name=instance2, when I only wanted to change the one at instance1. That said, I think that's also better than what set-image does right now.
Yes, being able to target specific instance will be needed.
But, as a user I'd appreciate the control of the replacement-style filters the most.
Good to know.
We are actively collecting feedback on set-image
as plan to work on version 2 of this function.
What does the workflow for updating images in your setup look like ? (Feel free to share as much as context possible, we love the details :))
I'm going beyond my actual needs a little bit just to illustrate how I'd like / expect additionalImageFields
to work (even though in my specific actual use case the recursive suggestion would work fine, I just think it'd lead to confusion in cases like the one I brought up here).
Thank you so much @zevisert for the detailed post.
:tag@sha256:digest
, that's pretty neat. I also have a use-case where I want to preserve tag
while replacing with the digest, so thank you for this detail.wasm
as function-runtime has been very promising to avoid the docker dependency. We recently got alpha support merged in kpt
and some functions also now support wasm
target as well. Don't know if you noticed, we have been also working on a new component called porch
(package orchestrator) which has a function-runner component that runs in a kubernetes cluster and that can also be leveraged to run functions in cluster.Thanks for the offer for a call. I am definitely interested and would like some feedback on some of the things that are cooking, so will reach out when I a few things more concrete.
/cc @yuwenma some interesting insights related to set-image
and functions in general.
No worries!
I didn't know that we can :tag@sha256:digest, that's pretty neat. I also have a use-case where I want to preserve tag while replacing with the digest, so thank you for this detail.
FWIW: set-image rejects the configMap in red, but accepts the one in green:
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-image:v0.1.1
configMap:
name: hello-world:latest
- newName: hello-world
- newTag: linux
+ newName: hello-world:linux
digest: sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4
Most recent ones around using wasm as function-runtime has been very promising to avoid the docker dependency. We recently got alpha support merged in kpt and some functions also now support wasm target as well.
That sounds like a great use-case. Let me know where I can follow along.
Don't know if you noticed, we have been also working on a new component called porch (package orchestrator) which has a function-runner component that runs in a kubernetes cluster and that can also be leveraged to run functions in cluster.
I noticed porch, but we haven't tried it, or backstage either. I'm curious about it, and hope to find some time to fiddle with it soon-ish
Describe your problem
A lot of the same motivation from replacements in kustomize would be useful in
set-image
'sadditionalImageFields.path
.We have
additionalImageFields
to handle CRDs, but we don't support filtering in sequences, take this made-up-resource for example:Say I want to use
kpt
to changeexample.dev/image:alpha
todocker.io/library/hello-world:latest
, my options with this resource in the kpt toolchain areapply-setters
, orsearch-replace
, but really it should be done withset-image
.Using
set-image
it seems like it's only possible to process each item in the sequence because set-image uses sigs.k8s.io/kustomize/api@v0.11.0/filters/imagetag.Filter, which only supports syntax likespec/instances[]/image
, but in cases like this I actually need the kustomize replacement-style filters, likespec.instances.[name=instance1].image
implemented here sigs.k8s.io/kustomize/api@v0.11.0/internal/utils#SmarterPathSplitter.