Enable helm repository and chart upload tool

There's a lot going on here but conceptually we're just enabling a
local helm repo along with a helper script to install helm charts into
the repo.

The first item is to configure lighttpd to serve up helm charts as
static information (so no proxying) at http://127.0.0.1/helm_charts".
This is fairly straightforward, but the files are served out of
/www which isn't a replicated filesystem and which is owned by the www
user.

The helm puppet manifest is modified to create the "helm_charts"
directory for the webserver, to generate the initial index file,
and to tell helm to add the new repo for the "wrsroot" user.  The
various commands are run as specific users with specific environment
variables, this is key to making everything work as planned.

To allow the wrsroot user to upload charts into /www the helm-upload
script will re-run itself as the www user.  /etc/sudoers.d is modified
to allow this without asking for a password.  The upload script will
copy the specified charts in to /www/pages/helm_charts, and will then
regenerate the index.yaml file. The upload script will then try to
sync the files over to the other node.  To enable this without
prompting for a password we modify /etc/rsyncd.conf to allow
passwordless syncing into /www/helm_charts.

In a future commit we'll need to sync charts with the other
controller when booting up, and also configure the local starlingx
helm repo on the second controller.

Change-Id: I37755ab7eedd070c27218862f936877949e378e8
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
Story: 2002876
Task: 22831
This commit is contained in:
Chris Friesen 2018-06-28 14:27:25 -06:00 committed by David Sullivan
parent fcad15cd5f
commit 5d84b0e119
2 changed files with 37 additions and 2 deletions

View File

@ -108,6 +108,7 @@ mimetype.assign = (
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
".rpm" => "application/x-rpm",
".yaml" => "text/yaml",
".cfg" => "text/plain"
)
@ -217,7 +218,7 @@ server.max-keep-alive-idle = 0
## read proxy.txt for more info
# Proxy all non-static content to the local horizon dashboard
$HTTP["url"] !~ "^/(rel-[^/]*|feed|updates|static)/" {
$HTTP["url"] !~ "^/(rel-[^/]*|feed|updates|static|helm_charts)/" {
proxy.server = ( "" =>
( "localhost" =>
(

View File

@ -24,9 +24,43 @@ class platform::helm
} ->
exec { 'initialize helm':
environment => [ "KUBECONFIG=/etc/kubernetes/admin.conf" ],
environment => [ "KUBECONFIG=/etc/kubernetes/admin.conf", "HOME=/home/wrsroot" ],
command => "helm init --skip-refresh --service-account tiller",
logoutput => true,
user => 'wrsroot',
group => 'wrs',
require => User['wrsroot']
} ->
file {"/www/pages/helm_charts":
path => "/www/pages/helm_charts",
ensure => directory,
owner => "www",
require => User['www']
} ->
exec { "restart lighttpd for helm":
require => File["/etc/lighttpd/lighttpd.conf"],
command => "systemctl restart lighttpd.service",
logoutput => true,
} ->
exec { "generate helm repo index":
command => "helm repo index /www/pages/helm_charts",
logoutput => true,
user => 'www',
group => 'www',
require => User['www']
} ->
exec { "add local starlingx helm repo":
before => Exec['Stop lighttpd'],
environment => [ "KUBECONFIG=/etc/kubernetes/admin.conf" , "HOME=/home/wrsroot"],
command => "helm repo add starlingx http://127.0.0.1/helm_charts",
logoutput => true,
user => 'wrsroot',
group => 'wrs',
require => User['wrsroot']
}
}
}