translate: convert deprecated networkd to files#6
Merged
Conversation
136c276 to
7127448
Compare
krnowak
reviewed
May 19, 2022
translate/v23tov30/v23tov30.go
Outdated
| }, | ||
| } | ||
|
|
||
| file.Node.Path = path.Join(m["root"], filepath.Join("/etc/systemd/network", string(u.Name)+".d", d.Name)) |
Member
There was a problem hiding this comment.
What is the reason for mixing path.Join and filepath.Join? Maybe it could be also:
Suggested change
| file.Node.Path = path.Join(m["root"], filepath.Join("/etc/systemd/network", string(u.Name)+".d", d.Name)) | |
| file.Node.Path = filepath.Join(m["root"], "/etc/systemd/network", string(u.Name)+".d", d.Name) |
Collaborator
Author
There was a problem hiding this comment.
aha - it seems I was not really awake this morning. Thanks for the heads-up.
translate/v23tov30/v23tov30.go
Outdated
| } | ||
| // path /etc/systemd/network is hardcoded in Ignition2.x codebase. | ||
| // TODO: customize this path at compilation time. | ||
| file.Node.Path = path.Join(m["root"], filepath.Join("/etc/systemd/network", u.Name)) |
Member
There was a problem hiding this comment.
Here too - mixing of path.Join and filepath.Join.
translate/v24tov31/v24tov31.go
Outdated
| } | ||
| // path /etc/systemd/network is hardcoded in Ignition2.x codebase. | ||
| // TODO: customize this path at compilation time. | ||
| file.Node.Path = path.Join(m["root"], filepath.Join("/etc/systemd/network", u.Name)) |
Member
There was a problem hiding this comment.
Same. Also, lovely copy-pasta. But I see that there is no package for common functionality.
translate/v24tov31/v24tov31.go
Outdated
| }, | ||
| } | ||
|
|
||
| file.Node.Path = path.Join(m["root"], filepath.Join("/etc/systemd/network", string(u.Name)+".d", d.Name)) |
krnowak
approved these changes
May 19, 2022
with Ignition3, `networkd` section does not exist anymore. As best effort, we try to convert `networkd` section to `files` section. Files will be located in `/etc/systemd/network` as it was currently done with Ignition2. Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
1d14282 to
db80126
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR, we convert this config:
{ "ignition": { "version": "2.3.0" }, "networkd": { "units": [ { "name": "00-eth.network", "dropins": [ { "name": "my-conf.conf", "contents": "[Match]\nName=eth*\n\n[Network]\nBond=bond0" } ], "contents": "[NetDev]\nName=bond0\nKind=bond" } ] } }to this config:
{ "ignition": { "version": "3.1.0" }, "storage": { "files": [ { "overwrite": true, "path": "/etc/systemd/network/00-eth.network", "contents": { "source": "data:,%5BNetDev%5D%0AName%3Dbond0%0AKind%3Dbond" }, "mode": 420 }, { "overwrite": true, "path": "/etc/systemd/network/00-eth.network.d/my-conf.conf", "contents": { "source": "data:,%5BMatch%5D%0AName%3Deth%2A%0A%0A%5BNetwork%5D%0ABond%3Dbond0" }, "mode": 420 } ] } }How to use
Locally:
Testing done
About to add some network ignition tests and to kick-off a CI.
Note for reviewers