Skip to content

MC* should use Ignition's validation logic to validate Ignition types #479

Closed

Description

@ajeddeloh

Description

MCO/MCD can currently use MCs that contain Ignition types that are invalid according to Ignition. It should check that the configs are valid using Ignition's validation logic.

Steps to reproduce the issue:

  1. Create a machine config that should be invalid (e.g. use a relative path for a file)
  2. Have that work instead of failing

Describe the results you received:
MCD applied the change

Describe the results you expected:
MCO/D/something should fail when presented with an invalid config

cc @kikisdeliveryservice since I was talking about this with her
cc @abhinavdahiya since he had some ideas on using admission plugins for this

Activity

  1. kikisdeliveryservice commented on Feb 22, 2019

    @kikisdeliveryservice
    Contributor

    I can confirm through testing on my cluster that I am able to create and apply a machineconfig with what should be invalid ignition config fields.
    For example, I am able to write a file to a relative path home/user and a mc is generated and applied successfully without error via the MCD:

    I0222 20:22:33.625759    7347 update.go:517] Writing file "home/user"
    

    We are simply applying the machineconfigs without ignition validation, just checking whether or not the section is supported or not by mcd (though ssh goes thru a few more checks).

  2. added
    kind/bug
    on Feb 22, 2019
  3. runcom commented on Feb 22, 2019

    @runcom
    Member

    I would add that we don't need to Degrade in such a case, just (sort of) rejecting the MC if possible

  4. ajeddeloh commented on Feb 22, 2019

    @ajeddeloh
    Author

    Ideally whatever is generating it should fail instead of whatever is consuming it. Invalid MCs should probably be disallowed everywhere if that's possible.

    Literally after parsing you should be able to call config.ValidateWithoutSource(reflect.ValueOf(mcObject)) wherever its being generated. It's using reflection and will walk structs/slices so you can even call it on the top level MC instead of the Ignition bits. Hell, you can even define your own Validation functions on the other bits of the MCs if you want.

  5. kikisdeliveryservice commented on Feb 22, 2019

    @kikisdeliveryservice
    Contributor

    /assign

  6. kikisdeliveryservice commented on Feb 22, 2019

    @kikisdeliveryservice
    Contributor

    as per convo with @runcom We'll have to go Degraded on bad MCs for now and then iterate once the Unreconcilable epic is done switch to that.

  7. kikisdeliveryservice commented on Feb 23, 2019

    @kikisdeliveryservice
    Contributor

    Started on this, will pick it up on Monday.

  8. runcom commented on Feb 24, 2019

    @runcom
    Member

    just noticed that we're not setting the ignition version to:

    • SSH MCs (00-*-ssh)
    • registries MCs (99-*-registries)

    we should be doing that afaict.

    That's because the above are not generated from templates in /templates and do not call "ign.Convert` which is setting the correct version. We should be doing something similar to avoid 1) setting version strings manually 2) always ensure ignition drives the versioning (right now we create tmp ignition configs from the above w/o validation at all)

  9. added a commit that references this issue on May 15, 2026
    0429d3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions