-
Notifications
You must be signed in to change notification settings - Fork 170
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
Detect rhcos for Ignition spec 2, add start of 3to2 converter #537
Conversation
I often just want to run rhcos, this would help. |
Lets just have two ignition configs and switch between them, rather than using bash substitution inside them. |
Mmm...I think it'd be more generally useful to write |
I'd advocate against this.
Outside of specifically this case, what other uses would it have? |
We're about to ship OpenShift 4 which will use Ignition spec 2. A whole lot of people are writing spec 2; I deal with it every day. |
ign-3to2
, detect rhcos for ignition spec 2
OK, updated and now working! I only quickly hacked the |
src/cmd-kola
Outdated
echo "WARNING: Failed to detect distro, use -b to specify" | ||
echo "WARNING: Failed to detect args, use -b to specify" | ||
fi | ||
if [ $(disk_ignition_version "${latest_qcow}") = "2.2.0" ]; then |
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.
Notably with this change --ignition-version v2
will only be specified in the basename matches rhcos-410.8*
instead of just rhcos-*
. Is that intentional?
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.
Yes
Wouldn't you want a 2to3 not a 3to2 in that case? I'm incredibly wary of tools that don't know their limits in terms of what they can and cannot do correctly. This is something I think would better writing a proper tool that knows what it can do, what it can't do, and when to report that it doesn't know if it did something right. |
If we productized this as a real library, I think it'd be nicer to maintain our Ignition as spec 3 and just downconvert it where we need to, the same way (Of course, making this a library gets into the language issue...) |
87cd3dc
to
fddaa41
Compare
ign-3to2
, detect rhcos for ignition spec 2
Updated, lifting WIP. I demoted the We talked about this on IRC I have trouble overstating just how useful it'd be for me to have |
@@ -161,12 +164,19 @@ EOF | |||
} | |||
} | |||
EOF | |||
if [ "${ignition_version}" = "2.2.0" ]; then | |||
ign_validate="true" |
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.
Could still validate the config before downgrading it to v2 though, no?
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.
Oh yeah, but we'd have to put a build up of ignition
spec 2 somewhere. And in this case we know it's valid; what we really want to do is validate in the converter I think.
That's because the converter doesn't cover the whole spec or handle a lot of the weird "gotcha" behavior of Ignition spec 2.x (actually it's impossible to catch everything but we ought to catch what we can). I'm still opposed to this. It's a hack right now. I'd like to avoid hacks as much as possible. If we fully implemented a 3->2 converter where it can detect things that it can't do and covered the whole spec I'd be ok with it, but that's a pretty large undertaking. If it's really beneficial for the short term, it should at least scream about how it's limited every time it's invoked. The file should have a giant warning banner that yells that it is incomplete and isn't a general purpose converter. We could even make it print a warning to stderr when run. I really don't want this to be a long term solution. |
We're only scoping this right now to an internal implementation detail of |
FWIW: #538 (comment)
|
Sure, but that's not documented in it anywhere. The file is called |
Added a comment at the top of the file.
It's now called |
It would be really extremely convenient for me if I could at least `cosa run -d /path/to/rhcos.qcow2` when using cosa git master. This prototypes out the start of a `ign-3to2` helper which will also be extremely useful for people working on OpenShift/RHCOS today. If this works out we can elevate it to a toplevel command. I reworked the `abspath` bits as it turns out my use of `git annex` didn't work with this as the symlink ended up being canonicalized to the object name.
Going to merge this to unblock further work now that it clearly specifies that it's not a general purpose translator. |
It would be really extremely convenient for me if I could at least
cosa run -d /path/to/rhcos.qcow2
when using cosa git master.This prototypes out the start of a
ign-3to2
helper whichwill also be extremely useful for people working on OpenShift/RHCOS
today. If this works out we can elevate it to a toplevel command.