This repository was archived by the owner on Sep 18, 2020. It is now read-only.
Commit e2730b5
committed
Support for Compressed, Base64-Enc, Inline Content
This patch adds support for local, inline content as compressed, base64
encoded values. For example, the string "Hello, world." can be
compressed with gzip and base64 encoded with the following command:
$ echo Hello, world. | gzip | base64
H4sIAG/kFlsAA/NIzcnJ11Eozy/KSdHjAgDXu838DgAAAA==
A Container Linux Config could use the above contents and write them to
the file "/etc/helloworld.txt":
storage:
files:
- path: /etc/helloworld.txt
filesystem: root
mode: 0644
contents:
base64: true
compression: gzip
inline: |
H4sIAB/jFlsAA/NIzcnJ11Eozy/KSdHjAgDXu838DgAAAA==
The CT transpiler would transform the above configuration snippet into
the JSON below:
{
"filesystem": "root",
"path": "/etc/srv/kubernetes/pki/apiserver.key",
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAB/jFlsAA/NIzcnJ11Eozy/KSdHjAgDXu838DgAAAA==",
"verification": {}
},
"mode": 420
},
Please note the value of the "source" field -- it uses the data URL
scheme (https://tools.ietf.org/html/rfc2397) to indicate the content
is base64 encoded. The "compression" field indicates the content is
also compressed using gzip. In fact, the following command may be used
to verify the data matches the original "Hello, world." string:
$ echo H4sIAB/jFlsAA/NIzcnJ11Eozy/KSdHjAgDXu838DgAAAA== | \
base64 -D | \
gzip -d
Hello, world.1 parent 5b24575 commit e2730b5
1 file changed
+23
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
166 | 177 | | |
167 | 178 | | |
168 | 179 | | |
| |||
237 | 248 | | |
238 | 249 | | |
239 | 250 | | |
240 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
241 | 255 | | |
242 | 256 | | |
243 | 257 | | |
| |||
0 commit comments