openshift / openshift/machine-config-operator

MCD fails with empty string in source

Open
#2,705 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lifecycle/frozen
Dominant language
Go
Stars
269
Forks
529
Avg merge
3d 18h
Merged PRs (30d)
83

Description

Description

While attempting a routine update, an indentation error caused the MCD to continually fail, resulting in a similar degraded-and-unable-to-recover state as in https://github.com/openshift/machine-config-operator/issues/1443

The field in question ended up as an empty string:

       - contents:
            source: ''
          mode: 420
          overwrite: true
          path: /path/on/the/system
        - contents:
            source: ''
          mode: 420
          overwrite: true
          path: /path/on/the/system

The MCD hit Line 208 in https://github.com/openshift/machine-config-operator/blob/01f5f79da605e854d320ba2feeac093f6673cbe9/vendor/github.com/vincent-petithory/dataurl/lex.go#L195-L209 which caused it to crash loop with missing data prefix errors, go into the degraded state, and be unable to recover

The only way we found to be able to recover was to edit the rendered config the MCO was attempting to apply (fixing the error in the base MachineConfig was ineffective, since it would instead queue a new rendered MachineConfig to apply)

Steps to reproduce the issue:

  1. Create any MachineConfig object with the source field as an empty string
  2. MCO will render and attempt to apply the config
  3. MCD will crash loop

Describe the results you received:
MCD unable to apply the config, crashes with missing data prefix and degraded state. Requires non-intuitive manual intervention

Describe the results you expected:
It would be great at the very least to get a more descriptive error message, but ideally it would be better for the MCO to reject it outright, or for empty string to resolve to 'data:,' instead to avoid this error, ideally warning the user

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the empty-source reproduction in the issue and inspect vendor/github.com/vincent-petithory/dataurl/lex.go around lines 195-209, then trace how the MCD processes the rendered MachineConfig. Check how validation or errors are surfaced. Done should prevent the crash loop and degraded unrecoverable state while giving the user a descriptive outcome for an empty source.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.