Comments (9)
Doesn't seem like #245 addresses this issue, which is similar to #227 but for separating each resource.
for example:
kustomize build production | csplit - --prefix='production.' --suffix-format='%03d.yaml' --elide-empty-files --keep-files /---/ '{*}'
Is one workaround to splitting the resulting output into separate files, but all context is lost. Would be nice to have something similar to helm template
where a comment is added to each resource indicating where it originated from.
from kustomize.
Hi @monopole and co., I also would like to request support to writing the kustomize output to files instead of only stdout. The reason I'd like this is for debugging the output to verify if a particular resource was correctly "kustomized". Imagine I have 10 resources (in my current use case it's already 9) managed by the same kustomization. In this case I'd like to write all the kustomized resources to a separate directory and then inspect them in one-by-one in my editor. I know I could write all of them to a single file, but when having 10 or more resources this single file becomes already gigantic and it's hard to navigate around.
So in summary I think it would be really helpful to have the ability to write the kustomized resources as seperate files to a directory.
from kustomize.
You can also use labels with kubectl to only apply certain objects
kustomize build ~/someApp | kubectl apply -l app=foo -f -
from kustomize.
kustomize in general wants to support a fork/rebase workflow in which one has a fork of someone else's repo, and occasionally does git rebase
to capture changes which then become part of your workflow. So we don't want to overwrite the base (would could be just one big YAML file with many resources).
That's why there's currently no attempt to retain any kind of mapping between objects and the file they came from (or the order in which the objects appeared in those files).
i.e. I don't want to apply a deployment and thus replacing 100% of my instances,
but have a blue/green approach.
Could you take a look at hello world example but replace (staging, production) with (blue, green), and describe why that pattern does or does not work
for your case?
from kustomize.
@monopole what if we write to a release dir instead of overwriting the base? You can add a release dir in the kustomization file where all the modified resources would be written to.
from kustomize.
Yep, apply label filtering works, but it's an imperative approach in that the label filter isn't necessary captured in version control (unless you store a script obviously).
I'd like a clearer explanation of what problem @Raffo wants to address with blue/green deployment. One can use different kustomization files to involve different sets of resources (that what overlays are).
from kustomize.
Hi, thanks for the quick and detailed answer and sorry for the short explanation in the original post.
I haven't followed myself the development of this tool so what I asked might be entirely out of the goals of the tool. If this is the case, please feel free to close this issue.
That said, you definitely deserve more details: I was not thinking of overwriting the base, more like having the possibility of having an output folder for the the templates with the replaced parts. You can think of this as a dist
or out
folder, not to be committed in the repo, but something to use for applying resources while keeping the repository setup clean and more importantly reusable between environments (staging, production).
The use case would be to have a single central repository where I would keep the kubernetes yamls, separated from the source of the applications. While this might look like an antipattern from some point of views, it would be needed in my case to allow to reuse configuration and scale the knowledge regarding Kubernetes in the organization.
For the blue/green use case, I never want to just run kubectl apply -f deployment.yaml
for an already existing deployment as this is missing the whole idea of incrementally rolling out new versions of an application, by never replacing 100% of the pods of my app.
In that case, I'd love to deploy a different deployment.yaml (i.e. by giving a deployment a different name and labels) and then do the shift gradually (i.e. by changing the number of pods of the two deployments). I understand that this is out of scope for the tool, but it'd be possible to mimic this in a deploy script/pipeline if I would possess the deployment.yaml with already the parts replaced/configured by kustomize, which should be exactly what I though this tool is for.
I hope this clarifies my initial message.
from kustomize.
We will add -o
to write the output to a file. #245
from kustomize.
To do a blue/green deployments with kustomize we can seperate bases (between deployments and other kubernetes objects) and adding 2 overlays: one for the blue step, another for the green step.
This seems to satisfy the current use case I am experiencing, but it would be nice it we could control the outputted content/files a little better.
from kustomize.
Related Issues (20)
- Add verbose and/or debug logging to kustomize command HOT 1
- git retrieval failures (such as a timeout) are not reported in certain scenarios HOT 2
- Bases deprecated - multiple resources in kustomization.yaml causes previous to be overwritten HOT 4
- Document the `fields` option for the `labels` built-in transformer HOT 4
- patches cause an error with $patch:delete in files with multiple patches HOT 1
- Documentation site not indexed by search engines HOT 2
- Buil fails when using components and strategic merge patch and null node HOT 2
- kustomize install from binaries with curl no longer working HOT 1
- `kustomize` should leave all ConfigMap values as quoted strings, since no other type is legal. HOT 6
- Allow Helm Chart Overlay Merges HOT 1
- When using ConfigMapGenerator merge as a resource. says "cannot merge or replace" HOT 3
- Installing through install_kustomize.sh is not working from v5.0.1 HOT 2
- Standardized behavior for `kustomize edit` HOT 1
- Define labels selector with crds HOT 1
- Kustomize doesn't pass namespace to helmCharts, resulting in inconsistent output HOT 4
- The latest `5.3.0` kustomize adds two new lines comparing with older `4.4.1` one HOT 10
- Multiple sources and string interpolation for targets in replacements. HOT 2
- Replacement inbetween HOT 1
- replacement in base kustomization missing custom nameSuffix HOT 1
- Failing to apply multiple patches using labelSelector/annotationSelector targeting the same files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kustomize.