From c9862e5749986a671c274bbfad4366cb4609fa89 Mon Sep 17 00:00:00 2001 From: Phil Sphicas Date: Wed, 10 Feb 2021 01:22:23 +0000 Subject: [PATCH] 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 --- doc/source/configuration/host-system.rst | 7 +++++-- promenade/builder.py | 2 ++ promenade/schemas/Genesis.yaml | 5 +++++ promenade/schemas/HostSystem.yaml | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/source/configuration/host-system.rst b/doc/source/configuration/host-system.rst index e568ee69..ac480818 100644 --- a/doc/source/configuration/host-system.rst +++ b/doc/source/configuration/host-system.rst @@ -138,7 +138,8 @@ Sample Document to run containers in Containerd runtime 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 @@ -148,8 +149,10 @@ A list of files to be written to the host. Files can be given as precise conten exact text - path: /etc/from-tar - tar_url: http://example.com/file + tar_url: http://example.com/file.tgz tar_source: dir/file.txt + - path: /etc/from-url + url: http://example.com/file Images ------ diff --git a/promenade/builder.py b/promenade/builder.py index ec4b082b..5ca7eeea 100644 --- a/promenade/builder.py +++ b/promenade/builder.py @@ -54,6 +54,8 @@ class Builder: elif 'symlink' in file_spec: data = file_spec['symlink'] islink = True + elif 'url' in file_spec: + data = _fetch_tar_url(file_spec['url']) elif 'tar_url' in file_spec: data = _fetch_tar_content(file_spec['tar_url'], file_spec['tar_path']) diff --git a/promenade/schemas/Genesis.yaml b/promenade/schemas/Genesis.yaml index ea8d7623..22a38d10 100644 --- a/promenade/schemas/Genesis.yaml +++ b/promenade/schemas/Genesis.yaml @@ -23,6 +23,8 @@ data: mode: type: integer minimum: 0 + url: + $ref: '#/definitions/url' tar_url: $ref: '#/definitions/url' tar_path: @@ -35,6 +37,9 @@ data: - type: object required: - content + - type: object + required: + - url - type: object allOf: - type: object diff --git a/promenade/schemas/HostSystem.yaml b/promenade/schemas/HostSystem.yaml index 47b5183b..4fb15cd6 100644 --- a/promenade/schemas/HostSystem.yaml +++ b/promenade/schemas/HostSystem.yaml @@ -37,6 +37,8 @@ data: mode: type: integer minimum: 0 + url: + $ref: '#/definitions/url' tar_url: $ref: '#/definitions/url' tar_path: @@ -57,6 +59,9 @@ data: - type: object required: - symlink + - type: object + required: + - url - type: object allOf: - type: object