-
Notifications
You must be signed in to change notification settings - Fork 5
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
Create an easy way to define images inline in manifests #8
Comments
Thanks for your interest in the project :) I have been briefly thinking about how this could be implemented and I think it would need to be a separate attribute set passed to the modules. Similarly how in nixos You could then build and push all images recursively like is done with all packages in nixpkgs and in nixidy it would be used something like: {registry, ...}: {
applications.test = {
namespace = "test";
createNamespace = true;
resources."apps/v1".Deployment.test = {
# ...
image = registry.test;
};
};
} If you want to have the What are your thoughts on that? |
I like your idea better, I think. I'll get to it eventually. I have to get a better feel of how I would like this to be used. I'm really excited for it. So far nixidy is perfect for my needs. |
I'm glad to hear that. What does your ideal usage of nixidy look like? I found it a bit clunky to define whole manifests in nix because many manifests use lists that don't merge well in nix. This is nicer in kubenix as it knows the schemas for resources and can therefore transform attributesets into lists as a final step. I have just been using helm charts and kustomize for most things and nixidy as a final patching tool but I'd like to make this nicer. |
What do you mean by:
|
For example ports on various resources is always a list/array in kubernetes manifests. This is clunky to write in nix: ports = [
{
name = "http";
containerPort = 8080;
protocol = "TCP";
}
]; While this would be nicer: ports.http = {
containerPort = 8080;
protocol = "TCP";
}; As the port can be set with In Essence nixidy just merges the manifests the best it can and then passes it to |
I'll keep this in mind. As I move more of stuff over maybe I'll recognize some patterns and suggest APIs or at least communicate pain-points. I can see this already exists 😄 in some form. I'll keep in mind what you said. If kubenix has a perfect API for declaring common manifests (I don't know about that) then we could probably add a |
@wokalski I finally had some time again to give this project any love and I'm using it now for my own "homelab" cluster. Is there still interest from your side to use this? I have not progressed on the topic of this issue but I have managed to use kubenix' generated resource options in nixidy. I have an example of an application that is defined entirely in nix: https://github.com/arnarg/cluster/blob/03c73e87407c3b4895503483d0b9378ec75650f9/modules/miniflux/default.nix I plan on creating re-usable generators to generate resource options from CRDs and then add common ones like |
I am still using it indeed! I don't know of a better option for nix k8s manifests. It's just that I'm only using it for my test cluster (for now anyway). |
Problem
Defining images separately from the gitops configuration just introduces extra cruft in typical setups where you don't share your image publicly. We have a monorepo to which we're adding nix-based kubernetes manifest definition and thus would like to have two simple commands:
Solution
Im thinking of adding an opinionated
lib.mkImage
that would expect identical input tonix2container.buildImage
. Now, when environmentPackages are evaluated, the injected version of this function would simply take the image name and tag and concatenate them to form a string.However, I would also provide a target analogous to
copyToRegistry
innix2container
that would recursively go through the definition and run a build of the image for every invocation oflib.mkImage
. Now - to be frank I'm not entirely sure how to implement the latter yet since my nix foo is weak but I believe in principle it can be implemented.Let me know what you think, I believe this can make the DX and overall devops story remarkable.
The text was updated successfully, but these errors were encountered: