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

encode file contents as base64 when the result is smaller #13

Open
wants to merge 2 commits into
base: flatcar-master
Choose a base branch
from

Commits on Nov 5, 2021

  1. config/types/files: encode file contents as base64 when the result is…

    … smaller
    
    Ignition encodes file contents in the dataurl format. Dataurl supports
    either url-escaped or base64 encoded content. CLCT always url-escapes
    content, but there are cases where base64 results in smaller text. One
    example is compressed content, which ignition should support but ours
    doesn't due to a check which can be removed (see [1]).
    
    So this is step 1 in enabling CLCT to transparently compress data. Data
    is encoded as both url-escaped and base64 and the result lengths are
    tested to see which one to use. It is possible to get CLCT to ingest
    gzipped data by manually doing 'gzip+base64', using some yaml magic and
    abusing CLCT parsing (slightly):
    
    storage:
      files:
      - path: /file/path
        mode: 0644
        contents:
          remote:
            compression: gzip
          inline: !!binary |
            H4sIAAAAAAAAA8tIzcnJ5wIAIDA6NgYAAAA=
    
    This results in spec compliant ignition configuration, that is not yet
    handled by our version of the ignition program.
    
    This is based on similar work done in butane[2].
    
    [1]: coreos/ignition@f770885
    [2]: https://github.com/coreos/butane/blob/07daeed0f1113acffbc21b47e2ecc997d44e7943/base/util/url.go#L31-L37
    jepio committed Nov 5, 2021
    Configuration menu
    Copy the full SHA
    c22588b View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2022

  1. config/types/files: add unit test for makeDataUrl function

    Signed-off-by: Jeremi Piotrowski <[email protected]>
    jepio committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    324132f View commit details
    Browse the repository at this point in the history