Skip to content
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

Canonicalize the fetch stage as the only stage during which Ignition fetches configs #950

Closed
jlebon opened this issue Mar 27, 2020 · 13 comments · Fixed by #1002
Closed

Canonicalize the fetch stage as the only stage during which Ignition fetches configs #950

jlebon opened this issue Mar 27, 2020 · 13 comments · Fixed by #1002
Assignees
Labels
jira for syncing to jira

Comments

@jlebon
Copy link
Member

jlebon commented Mar 27, 2020

Noticed this while examining the logs for a different reason. It looks like Ignition doesn't cache the fact that an Ignition config wasn't provided when it gets HTTP 200 with an empty body. So it ends up trying to refetch the config on each stage.

We should cache it instead (e.g. as just {} in /run/ignition.json?) and avoid spamming the metadata server.

@jlebon
Copy link
Member Author

jlebon commented Mar 27, 2020

Related: coreos/fedora-coreos-tracker#436

@jlebon
Copy link
Member Author

jlebon commented Mar 27, 2020

Also related: #903

dustymabe added a commit to dustymabe/ignition-dracut that referenced this issue Mar 30, 2020
…n units

Since we are tearing down the networking using an ExecStop
we need to make sure we run the ExecStop *after* any other
ignition*.service unit's ExecStop. The only other one right
now is ignition-mount that has an ExecStop for doing an unmount.
Since the ordering for ExecStop is the opposite of ExecStart we
need to use `Before=ignition-mount.service`.

Partial fix for coreos/fedora-coreos-tracker#440

This would most likely not be necessary if Ignition cached an
empty result: coreos/ignition#950
@dustymabe dustymabe added the jira for syncing to jira label Mar 30, 2020
@dustymabe
Copy link
Member

though another question to ask is should ignition try to fetch configs in multiple stages at all? It seems like there should only be one stage that ever tries to fetch and condense an ignition config for the system. All other stages use that initial stage's output (let's say it's a written local file) as their input.

@dustymabe
Copy link
Member

i.e. instead of solving this problem of "Ignition shouldn't try to refetch empty configs" we restate it to "Ignition should only ever try to fetch configs in one stage".

@bgilbert
Copy link
Contributor

@dustymabe I think that's fair. The current stage structure evolved over time, and now that we have a distinct fetch stage, we don't need to think of ignition.json as a cache anymore.

@jlebon
Copy link
Member Author

jlebon commented Mar 30, 2020

Yup, agreed with the above. Keeping it to the fetch stage helps with solving the conditional networking issue as well.

dustymabe added a commit to dustymabe/ignition-dracut that referenced this issue Mar 30, 2020
…n units

We want to run the teardown after all other Ignition stages
have run because some platforms (like Packet) do remote status
reporting for each Ignition stage. Since we are tearing down
the networking using an ExecStop we need to make sure we run
the ExecStop *after* any other ignition*.service unit's ExecStop.
The only other one right now is ignition-mount that has an ExecStop
for doing an unmount. Since the ordering for ExecStop is the
of ExecStart we # need to use `Before=ignition-mount.service`.

Partial fix for coreos/fedora-coreos-tracker#440

This would most likely not be necessary if Ignition cached an
empty result: coreos/ignition#950
dustymabe added a commit to dustymabe/ignition-dracut that referenced this issue Mar 30, 2020
…n units

We want to run the teardown after all other Ignition stages
have run because some platforms (like Packet) do remote status
reporting for each Ignition stage. Since we are tearing down
the networking using an ExecStop we need to make sure we run
the ExecStop *after* any other ignition*.service unit's ExecStop.
The only other one right now is ignition-mount that has an ExecStop
for doing an unmount. Since the ordering for ExecStop is the
opposite of ExecStart we # need to use `Before=ignition-mount.service`.

Partial fix for coreos/fedora-coreos-tracker#440

This would most likely not be necessary if Ignition cached an
empty result: coreos/ignition#950
dustymabe added a commit to dustymabe/ignition-dracut that referenced this issue Mar 30, 2020
…n units

We want to run the teardown after all other Ignition stages
have run because some platforms (like Packet) do remote status
reporting for each Ignition stage. Since we are tearing down
the networking using an ExecStop we need to make sure we run
the ExecStop *after* any other ignition*.service unit's ExecStop.
The only other one right now is ignition-mount that has an ExecStop
for doing an unmount. Since the ordering for ExecStop is the
opposite of ExecStart we need to use `Before=ignition-mount.service`.

Partial fix for coreos/fedora-coreos-tracker#440

This would most likely not be necessary if Ignition cached an
empty result: coreos/ignition#950
@jlebon jlebon changed the title Ignition shouldn't try to refetch empty configs Canonicalize the fetch stage as the only stage during which Ignition fetches configs Mar 30, 2020
@dustymabe
Copy link
Member

Nice - it seems like we're mostly in agreement and I see @jlebon changed the title of this issue to denote the change in scope. @jlebon as part of this we should probably be able to make "detecting if a config was provided to the machine (either fetched or embedded)" easier (#903) ?

@jlebon
Copy link
Member Author

jlebon commented Apr 1, 2020

@jlebon as part of this we should probably be able to make "detecting if a config was provided to the machine (either fetched or embedded)" easier (#903) ?

Yeah, I think you're right in that it simplifies the "only emit a message once" bit. Though I expect this issue will mostly be about moving code around, so I told @sohankunkerkar to keep working with what he has and we can rebase changes needed for this issue on top of his work.

@lucab
Copy link
Contributor

lucab commented Jul 29, 2020

This ticket got closed, so are we now guaranteeing that "Ignition fetches the configuration only once in the fetch stage"?

@bgilbert
Copy link
Contributor

Yes, 88013e5 changed the acquire logic to ensure that.

@arithx
Copy link
Contributor

arithx commented Jul 30, 2020

Sorry about that @lucab, in hindsight I should have updated the commit message for that commit to make it more obvious that it was now doing more than just always writing the cache config.

@LorbusChris
Copy link
Contributor

@jlebon
Copy link
Member Author

jlebon commented Aug 21, 2020

this issue is referenced here: https://github.com/coreos/ignition/pull/958/files#diff-e3491b7c0e160811ce6761d5a1117558R95

Follow-up in #1075.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira for syncing to jira
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants