Fix CLI behavior change for Helm v > 3.3.1
Helm introduced changes in the CLI behavior for the command 'helm repo add' in versions superior to 3.3.1. For reference: https://github.com/helm/helm/issues/8771 . This caused the code inside platform::helm::repository to return an error when repos are updated, which in turn makes the puppet manifest fail. The previous behavior can be achieved by using the flag 'force-update' introduced by Helm. However, this is not backwards compatible, so it's usage is conditioned to the software version to decrease the chance of issues during upgrades from stx 8.0. Test plan: PASS: Bootstrap DC + SX subcloud. PASS: Switch http_port to 80 (default is 8080). Verified that the puppet manifest executed successfully. Verified that helm repos were updated. PASS: Switch https_enabled to false. Verified that Horizon is accessible using the port 80. Story: 2011266 Task: 51407 Change-Id: I5dd0a5ac1914073a6e500cd9dde602aa63b874eb Signed-off-by: Marcelo de Castro Loebens <Marcelo.DeCastroLoebens@windriver.com>
This commit is contained in:
parent
f5b83fe391
commit
c863d68029
@ -8,6 +8,7 @@ define platform::helm::repository (
|
||||
$repo_base = undef,
|
||||
$repo_port = undef,
|
||||
$create = false,
|
||||
$sw_version = undef,
|
||||
) {
|
||||
|
||||
$repo_path = "${repo_base}/${name}"
|
||||
@ -35,10 +36,20 @@ define platform::helm::repository (
|
||||
$require_relationship = User['sysadmin']
|
||||
}
|
||||
|
||||
# Helm versions above 3.3.1 have a breaking change, where 'helm repo add' now returns an
|
||||
# error if the repo already exists (reference: https://github.com/helm/helm/issues/8771).
|
||||
# The 'force-update' flag is enough to overcome this, but it isn't backward compatible.
|
||||
# TODO(mdecastr): Cleanup once upgrade from 22.12 isn't possible (keep 'force-update')
|
||||
if $sw_version == '22.12'{
|
||||
$base_cmd = 'helm repo add'
|
||||
} else {
|
||||
$base_cmd = 'helm repo add --force-update'
|
||||
}
|
||||
|
||||
exec { "Adding StarlingX helm repo: ${name}":
|
||||
before => $before_relationship,
|
||||
environment => [ 'KUBECONFIG=/etc/kubernetes/admin.conf' , 'HOME=/home/sysadmin'],
|
||||
command => "helm repo add ${name} http://127.0.0.1:${repo_port}/helm_charts/${name}",
|
||||
command => "${base_cmd} ${name} http://127.0.0.1:${repo_port}/helm_charts/${name}",
|
||||
logoutput => true,
|
||||
user => 'sysadmin',
|
||||
group => 'sys_protected',
|
||||
@ -49,6 +60,7 @@ define platform::helm::repository (
|
||||
class platform::helm::repositories
|
||||
inherits ::platform::helm::repositories::params {
|
||||
include ::openstack::horizon::params
|
||||
include ::platform::params
|
||||
include ::platform::users
|
||||
|
||||
Anchor['platform::services']
|
||||
@ -57,6 +69,7 @@ class platform::helm::repositories
|
||||
repo_base => $target_helm_repos_base_dir,
|
||||
repo_port => $::openstack::horizon::params::http_port,
|
||||
create => $::is_initial_config,
|
||||
sw_version => $::platform::params::software_version,
|
||||
}
|
||||
|
||||
-> exec { 'Updating info of available charts locally from chart repo':
|
||||
|
Loading…
Reference in New Issue
Block a user