Allow url as source of file to be deployed to host

This change allows the HostSystem and Genesis document to specify direct
URLs to files (for example, kubelet and kubectl) that are to be written
to the deployed hosts.

Change-Id: I1828d4a9e654537448631434b26b5becc4d2d717
This commit is contained in:
Phil Sphicas 2021-02-10 01:22:23 +00:00
parent d161528ae8
commit c9862e5749
4 changed files with 17 additions and 2 deletions

View File

@ -138,7 +138,8 @@ Sample Document to run containers in Containerd runtime
Files Files
----- -----
A list of files to be written to the host. Files can be given as precise content or extracted from a tarball specified by url: A list of files to be written to the host. Files can be given as precise
content, extracted from a tarball specified by url, or downloaded from a url:
.. code-block:: yaml .. code-block:: yaml
@ -148,8 +149,10 @@ A list of files to be written to the host. Files can be given as precise conten
exact exact
text text
- path: /etc/from-tar - path: /etc/from-tar
tar_url: http://example.com/file tar_url: http://example.com/file.tgz
tar_source: dir/file.txt tar_source: dir/file.txt
- path: /etc/from-url
url: http://example.com/file
Images Images
------ ------

View File

@ -54,6 +54,8 @@ class Builder:
elif 'symlink' in file_spec: elif 'symlink' in file_spec:
data = file_spec['symlink'] data = file_spec['symlink']
islink = True islink = True
elif 'url' in file_spec:
data = _fetch_tar_url(file_spec['url'])
elif 'tar_url' in file_spec: elif 'tar_url' in file_spec:
data = _fetch_tar_content(file_spec['tar_url'], data = _fetch_tar_content(file_spec['tar_url'],
file_spec['tar_path']) file_spec['tar_path'])

View File

@ -23,6 +23,8 @@ data:
mode: mode:
type: integer type: integer
minimum: 0 minimum: 0
url:
$ref: '#/definitions/url'
tar_url: tar_url:
$ref: '#/definitions/url' $ref: '#/definitions/url'
tar_path: tar_path:
@ -35,6 +37,9 @@ data:
- type: object - type: object
required: required:
- content - content
- type: object
required:
- url
- type: object - type: object
allOf: allOf:
- type: object - type: object

View File

@ -37,6 +37,8 @@ data:
mode: mode:
type: integer type: integer
minimum: 0 minimum: 0
url:
$ref: '#/definitions/url'
tar_url: tar_url:
$ref: '#/definitions/url' $ref: '#/definitions/url'
tar_path: tar_path:
@ -57,6 +59,9 @@ data:
- type: object - type: object
required: required:
- symlink - symlink
- type: object
required:
- url
- type: object - type: object
allOf: allOf:
- type: object - type: object