-
Notifications
You must be signed in to change notification settings - Fork 6
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
1225 config collector elemental #32
Conversation
@@ -106,7 +95,14 @@ func ManualInstall(c string, options map[string]string, strictValidations, debug | |||
} | |||
} | |||
|
|||
return RunInstall(debug, options) | |||
// Load the installation Config from the system | |||
installConfig, err := elementalConfig.ReadConfigRun("/etc/elemental") |
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.
DRY this (and put the path to a constant)
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.
I was expecting this to be different.
i.e. the ReadConfigRun to call the collector so we merge options from elemental config <- cloud-config so we can move the options out of elemental, so they are configured during install/upgrade/reset directly? Otherwise this still reads most of stuff from elemental config which is on RO and not easily modificable and we need to get exposing things over to the agent.
Ideally IMO, one function should read both files and merge them, and we can deprecate the elemental config directly and have everything by default unless set on the cloud-config.
thoughts?
I was trying to understand the various different configs and this is what I ended up with:
I tried to clean my head from what I've seen and think about what kind of configuration we actually need. I see 2 different types:
The user should be able to change both (no hardcoded locations, but maybe default config for the cli could exist). If this is a good plan ^ I would need some help consolidating and cleaning up because I'm not sure what all those options are used for. Still, we can still move on with this PR as a fix for custom partitioning and refactor on another PR. |
This was the config from the kairos-agent only, and it used parts of that to build the args to pass to elemental. This was loaded from the cloud-config/config or interactive install inputs
This is the main config of elemental. This is what is used around in a lot of different places and exposes interfaces so they can be easily substituted by other structs that can fulfill that interface, see for example the This would be impossible to remove as its being used almost everywhere for everything. You need to log? cfg.Logger, mount stuff? cfg.Mounter. Not only that but allows for future proofing without too much hassle. Want to substitute the current mounter? Just write a new one or adapt an existing lib to fullfill the interface. Done.
Runconfig was the config that affected run stuff (install,reset,upgrade). It embeds the config on it and it was especialized for that run config with values that were only used for it. There was a BuildConfig that had different values that was dedicated to building stuff as as separation of concerns. IMO this one could go away easily as we only have one config there for install/upgrade/reset and the build stuff is somewhere else
InstallSpec/UpgradeSpec/ResetSpec is the final spec to be used for action X. Its the results of reading the config and sanitizing it. Its the guide to the action and the values that will be used. Its a byproduct of the config + sanitizing it + adding defaults + runtime stuff (like platform arch).
IMO ideally we should.
So basically, your cloud config would for example look like a merge of the elemental config and our current cloud-config:
And that would generate a Config object that had |
l.Error(out) | ||
return err | ||
} | ||
} |
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.
NOTE: Let's try an installation without custom partitions with this fix to see if this breaks something. @Itxaka has a hunch...
I run a
@Itxaka is this relevant to what you were afraid would happen? Does it ring any bells? |
Not that I can remember. That looks like the boot assessment after-install run |
hmm I tried again with the full config and I get the same error when I use custom partitions:
I don't know how this error popped up. It wasn't there on Friday, I'm pretty sure. |
Ignore it all, I thought any "recent" version of kairos core would be ok and used |
de984df
to
a53d8a0
Compare
…hooks Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
to let the user set this in the cloud-config file instead of /etc/elemental/config.yaml See also here: kairos-io/kairos#209 (comment) Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
- that "return" made it stop after creating the first partition - the expand was happening before we created the partitions thus, our partitions were never expanded Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
a53d8a0
to
83adcb7
Compare
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
d528ff4
to
74bee8f
Compare
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
which should test that this line was removed: https://github.com/kairos-io/kairos-agent/pull/32/files#diff-9bf4494bcc865684d4aeae7837925b1732855e863067c12a61f6f38e2fc16716L114 Signed-off-by: Itxaka Serrano Garcia <itxaka.garcia@spectrocloud.com>
b70e46f
to
6e7412d
Compare
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
We created most of the needed tests. The only one missing I think is the one that tests this fix: https://github.com/kairos-io/kairos-agent/pull/32/files#diff-bdceadb6b1ed909e97670e80e5251016ad0826cff05ec4cac9ed83add43cd992R338-R345 which ensures that the users cloud config is merge before we run the hooks. I started writing a test here: https://github.com/kairos-io/kairos-agent/pull/32/files#diff-f26da7c79a4ee9afdb26e2f102d65f35feea2f2d731b3d1bdd4d48349c88e0ebR118 but I find that impossible to mock enough things to get |
Create a new spec from scratch instead of using the helper method, as some fields still need to be added to the spec before the Sanitize method is called. Otherwise we will get an error as some things may be missing like the Target Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
eb83d4e
to
b4cb70a
Compare
Co-authored-by: Mauro Morales <mauro.morales@spectrocloud.com>
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.
lgtm
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #32 +/- ##
==========================================
- Coverage 57.90% 57.74% -0.16%
==========================================
Files 42 42
Lines 5093 5110 +17
==========================================
+ Hits 2949 2951 +2
- Misses 1895 1910 +15
Partials 249 249
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Fixes kairos-io/kairos#1225
and probably kairos-io/kairos#209 too
There are basically 3 fixes here:
kairos-install.pre.*
hooks