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

Unknown config field only yields warning, continues boot #853

Open
dustymabe opened this issue Sep 8, 2019 · 5 comments
Open

Unknown config field only yields warning, continues boot #853

dustymabe opened this issue Sep 8, 2019 · 5 comments

Comments

@dustymabe
Copy link
Member

Bug

If I put in a key in my ignition config that is unused should my system continue to boot? In my example I was handcrafting an ignition config (shame on me) based on ignition snippets provided by another user and I placed the filsystems key at the toplevel and not under the storage key. My system booted, but my filesystems weren't set up as I would expect.

The ignition config used:

{
  "ignition": {
    "version": "3.0.0"
  },
  "systemd": {
    "units": [
      {
        "name": "example.service",
        "enabled": true,
        "contents": "[Service]\nType=oneshot\nExecStart=/usr/bin/false\n\n[Install]\nWantedBy=multi-user.target"
      }
    ]
  },
  "filesystems": [
    {
      "device": "/dev/sdc",
      "format": "ext4",
      "label": "docker",
      "path": "/var/lib/docker",
      "wipeFilesystem": true
    },
    {
      "device": "/dev/sdb",
      "format": "ext4",
      "label": "dockerdata",
      "path": "/dockerdata",
      "wipeFilesystem": true
    }
  ],
  "passwd": {
    "users": [
      {
        "name": "core",
        "groups": [
          "sudo"
        ],
        "sshAuthorizedKeys": [
          "ssh-rsa AAAAB..."
        ]
      }
    ]
  }
}

The logs do show a warning:

op(1): [finished] loading QEMU firmware config module
parsing config with SHA512: 9e8c794cc53fd4cab4ecf965cfe232f85047d5a9a77f71662ee23de3e2fb92be2731df44beab20ec7959e767871e9f4c3194eb3b7ad3c985ca1fc365b3f8316e
warning at $.filesystems, line 10 col 3: Unused key filesystems
disks: disks passed
Ignition finished successfully

Which is the same thing that ignition-validate shows:

[core@localhost run]$ sudo cat /sys/firmware/qemu_fw_cfg/by_name/opt/com.coreos/config/raw | ignition-validate - 
warning at $.filesystems, line 10 col 3: Unused key filesystems
[core@localhost run]$ echo $?
0

but it's just flagged as a warning and ignition-validate returns with a successful exit code.

Operating System Version

  • fedora/x86_64/coreos/testing at 30.20190905.0

Ignition Version

  • ignition-2.0.1-2.gite75cf24.fc30.x86_64

Environment

QEMU

Expected Behavior

Probably this should error? I guess that's what I'm here to discuss.

Actual Behavior

Warning with no erroring out.

@lucab
Copy link
Contributor

lucab commented Sep 9, 2019

In this case Ignition is spitting out warnings (and not exiting with an error) by design.

When updating the Ignition schema, we may have to add a new key at any level for any purpose. This is usually done without breaking backward compatibility (not only in Ignition, but generally in software design).
That means that older version of Ignition would not understand new features, but should not choke on them either.

The alternative behavior that you are suggesting would remove any wiggle room we have in updating the configuration schema, resulting in a semver-breaking bump for each new one.

@bgilbert
Copy link
Contributor

bgilbert commented Sep 9, 2019

@lucab New config keys are only added in new spec versions, so I'm not sure that argument applies here.

@ajeddeloh
Copy link
Contributor

Hmm. My guess is we have the current behavior for backwards compatibility. Ignition's ignored unused keys from the start and so we could never make that change without breaking users. We actually do have the opportunity now, since we're still in preview.

Does anyone know of a good reason to not fail on unused keys?

@lucab
Copy link
Contributor

lucab commented Sep 30, 2019

@cgwalters has a usecase for this here: #863 (comment)

@jlebon
Copy link
Member

jlebon commented Sep 30, 2019

See also related discussions in #696.

@bgilbert bgilbert changed the title bad ignition config only yields warning, continues boot Unknown config field only yields warning, continues boot Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants