-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kustomization PreBuild Stage #414
Comments
I would be more than interested by this feature too. Starting dealing with more than a few different environments when provisioning infrastructure rapidly leads to a lot of duplicate declarative code, with the only variation of a few strings representing the environment. Without asking a full templating solution, being able to benefit from the substitution mechanism at the Adapting the existing Example (Synchronisation) apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
...
preBuild:
substituteFrom:
- kind: ConfigMap
name: cluster-vars Example (Kustomization) apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./base/namespace.yaml
- ./base/helmrelease.yaml
patchesStrategicMerge:
- envs/${env}/patch.yaml
nameSuffix: ""
generatorOptions:
disableNameSuffixHash: true
secretGenerator:
- name: my-certs
namespace: my-namespace
files:
- tls.crt=envs/${env}/certs/tls.crt
- tls.key=envs/${env}/certs/tls.key
type: "kubernetes.io/tls" @stefanprodan Would you be open to contribution in this direction ? Or would it break the spirit of the whole thing (flux + kustomize), in your opinion ? Regards |
The issue with |
I think there has been a misunderstanding. My point is simpler than you think. I will try to be clearer.
Example steps:
I hope I have been clearer. |
@vcariven Thanks for clarifying. I described it on purpose a bit loose, since maybe someone would have better idea. Obviously. we can't support that for the kustomize build (cascading), since we would have to change the kustomize functionality. But on the entry Kustomization we have the possibility to inject variables and that would already help me. I will try to implement it. |
Here's the structure I have used to test my version on: (Very simplified) |
Since the PR is sitting there for almost 3 years, how did you go forward with this? |
Any updates? or any alternative solutions? |
Using/Developing: https://github.com/projectsveltos Kustomize from FluxCD is just too weak, or kustomize in general. They are probably not gowing to merge this. |
I have a infrastructure use-case where I want to consider different factors (
location
,segment
andenvironment
) to deploy a cluster. Each of these factors can influence for example values with patches or whatever. For now I have implemented something like this:The only problem being, it's not super scaleable. Since I have to consider each possibility of the named factors I have to create for each outcome a dedicated folder. Which is quiet messy and if i add something new like a new environment I have have to create hundreds of folders. to be concrete, the structure would look something like this:
How would you achieve something like that? It kinda doesn't really feel right in my opinion.
I thought it might make things easier if I could use variable substitution within
kustomize.config.k8s.io
files. Then I could do something like this:Currently there is only the option to substitude after the kustomize is build. I would love to add the feature, that there is the option to enable variable substitution
preBuild
. So the above would work. I am not sure if it's even possible. But I would love to give it a try. But what do you think about it? Maybe you have different opinions on this issue.I would be more than happy to do the contribution. But only if you agree that is something you would like to see.
The text was updated successfully, but these errors were encountered: