-
-
Notifications
You must be signed in to change notification settings - Fork 464
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
feat: support config embedded and external files #1417
feat: support config embedded and external files #1417
Conversation
OK, I've found an issue in my implementation, and now I know no one worked on that feature since 2021 😄 (and the whole topic of needing to use the absolute part rather than the relative path). So using tmp files doesn't work because if the files are deleted the cluster will not be able to start. |
bf92876
to
e229304
Compare
After some thinking, I've found a better way to utilize the tools node to copy the manifests to a volume instead of relying on the files on the host. I'd consider this the final implementation and if we agree on it, then I will add the CLI args if needed (tbh, I don't see much value of having it in the CLI). |
@iwilltry42 it would be great if you could take a look at this PR 🙌 (please ignore the first 2 commits, I just left them to show what I tried and didn't work). |
Hi @aabouzaid ! files:
- path: k3s-manifests/foo/bar.yaml # k3s-manifests as magic word that gets expanded like we have it in volume mounts
content: |
File contents What do you think? |
@iwilltry42 sounds like a pretty good idea 👌 Just to ensure that I got it right before heading to the implementation 😁 The |
Yeah, sorry, I'm on my phone only - k3s-manifests is like a shortcut to the manifests directory. We have a few of those "magic paths" for volume mounts. I can't find the respective issue/release right now though. Edit: #916 |
@iwilltry42 When I started working on this feature I tried to make it as tiny as possible. If you are in favor of making it a bit generic, what do you think about making it for any kind of manifest (embedded or in an external file)? That will fix the issue no. #1065 completely in addition to #536 I will think of it like this: 1. Embedded Manifest
2. External Manifest - Relative path
The
The
And What do you think? 🤔 (I hope I didn't scratch it too much 😅 but that way we cover more use cases). |
@aabouzaid yes, that's what I envisioned 👍 files:
- source: ./relative/path/bar.yaml
destination: k3s-manifests/magic/path/bar.yaml
- source: /absolute/path/foo.yaml
destination: /some/path/in/container/foo.yaml
- destination: /some/dest/path/baz.yaml
source: |
# some yaml file
abc:
def:
- a
- b
I'd rather not do this, since I think magic paths (shortcuts) are good enough and not too much to type - it may be confusing for the more generic We've got to make it clear (docs and help texts) that the source is always copied into the container at start time, not mounted like volumes. I agree, that relative paths should always be considered relative to the config file - for everything that should be relative to the current workdir, one can use Are you ok with this? |
adc077c
to
471f121
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iwilltry42 I'm done with the main part.
But there are a couple of places I still need your opinion about them 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd be nice to have (optional) nodeFilters here as well to scope the files to specific nodes only (i.e., it would be fine if manifests are only deployed to server nodes).
Overall, I like the implementation, good job :)
521316a
to
c1fd768
Compare
@iwilltry42 Please give it a shot, now both embedded and referenced files read from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice and clean, awesome! :)
c1fd768
to
1e4c076
Compare
@aabouzaid thanks for this! |
1e4c076
to
bc47c84
Compare
bc47c84
to
6ab5fc7
Compare
@iwilltry42 Sure, let's do it 🙌 |
@iwilltry42 BTW, any docs should be updated at this stage? Like this page: https://k3d.io/v5.6.0/usage/configfile/#all-options-example |
Signed-off-by: Ahmed AbouZaid <[email protected]>
6ab5fc7
to
b4333cc
Compare
Docs can be added any time before the next release 👍 |
What
This PR introduces embedded manifests in the k3d config file which boosts the portability of the config and makes it easier to share.
So adding an embedded manifest could be as easy as:
This will be mounted under:
/var/lib/rancher/k3s/server/manifests/embedded/my-app-ns.yaml
.Why
In addition to the portability, the goal is to make it easy to seed k3d resources, and given that k3s already supports HelmChart it will be even easier to pre-install any custom packages when the cluster is created.
Fixes #536
Also partially fixes #1065 since no need to be in the same dir to mount some seed manifests.
Implications
No expected change in the behavior.
Note
The CLI part is not done yet, I will do it once we agree on the implementation.
Thank you 🙌