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
When defining the files as the above structure, the component is ignored, and runnin kubectl kustomize simply produces the same yaml as the base yaml, without replacing the image.
As a workaround, I define a partial function yaml in each env, with only the image replaced, and add a patchesStrategicMerge section to apply the changes.
In my project the are only 2 variants: prod & non-prod, and for each env (local/dev/staging/prod), I would like to use one of the variants. Without image replacement, this requires redundant code, and updating the tag in each env, instead of update the tag in a single location and have it impact all the relevant envs.
In addition to patches, Kustomize also offers customizing container images or injecting field values from other objects into containers without creating patches. For example, you can change the image used inside containers by specifying the new image in images field in kustomization.yaml.
As function CRDs are eventually translated to a deployment CRD with a container & image, I believe the same replacement logic can apply to function images.
Steps to Reproduce (for bugs)
Create the files in the description above, and run kubectl kustomize
Context
Your Environment
FaaS-CLI version ( Full output from: faas-cli version ):
___ _____ ____
/ _ \ _ __ ___ _ __ | ___|_ _ __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) | __/ | | | _| (_| | (_| |___) |
\___/| .__/ \___|_| |_|_| \__,_|\__,_|____/
|_|
CLI:
commit: addf6bb9866689e0f5a862caf49c60dac06152fb
version: 0.15.2
Gateway
uri: http://127.0.0.1:8080
version: 0.25.2
sha: bc2eeff4678407583faec982c1c7d1da915dd60c
Provider
name: openfaas-operator
orchestration: kubernetes
version: 0.15.4
sha: 330ac2a6d2e0db392a673b7fac97320d3e788139
Your faas-cli version (0.15.2) may be out of date. Version: 0.15.4 is now available on GitHub.
Docker version docker version (e.g. Docker 17.0.05 ):
20.10.17
Are you using OpenFaaS on Kubernetes or faasd?
Kubernetes
Operating System and version (e.g. Linux, Windows, MacOS):
Linux/WSL
Code example or link to GitHub repo or gist to reproduce problem:
My actions before raising this issue
Why do you need this?
I want to use different images for the same function, based on the environment in which the function runs (dev/staging/prod)
Who is this for?
Private usage.
What company is this for? Are you listed in the ADOPTERS.md file?
Expected Behaviour
I would like the ability to define a Kustomization Component with image replacement, like this:
And have it impact my base function definition:
And within each env I will have the following kustomization.yaml:
Such that when I run
kubectl kustomize envs/dev/tasks
The resulting yaml for the function would be:
and when I run
kubectl kustomize envs/prod/tasks
The resulting yaml for the function would be:
Current Behaviour
When defining the files as the above structure, the component is ignored, and runnin kubectl kustomize simply produces the same yaml as the base yaml, without replacing the image.
Are you a GitHub Sponsor (Yes/No?)
Check at: https://github.com/sponsors/openfaas
List All Possible Solutions and Workarounds
As a workaround, I define a partial function yaml in each env, with only the image replaced, and add a patchesStrategicMerge section to apply the changes.
In my project the are only 2 variants: prod & non-prod, and for each env (local/dev/staging/prod), I would like to use one of the variants. Without image replacement, this requires redundant code, and updating the tag in each env, instead of update the tag in a single location and have it impact all the relevant envs.
Which Solution Do You Recommend?
As per the official documentation:
As function CRDs are eventually translated to a deployment CRD with a container & image, I believe the same replacement logic can apply to function images.
Steps to Reproduce (for bugs)
Context
Your Environment
faas-cli version
):docker version
(e.g. Docker 17.0.05 ):Are you using OpenFaaS on Kubernetes or faasd?
Kubernetes
Operating System and version (e.g. Linux, Windows, MacOS):
Linux/WSL
Code example or link to GitHub repo or gist to reproduce problem:
Other diagnostic information / logs from troubleshooting guide
The text was updated successfully, but these errors were encountered: