From 4005411facbc015331d16902ab93cb1c6992fc33 Mon Sep 17 00:00:00 2001 From: Jim Gauld Date: Wed, 8 Apr 2020 15:21:27 -0400 Subject: [PATCH] Add support for Helm v3 and containerized armada This removes helm initialization that works with v2 only. This adds an armada manifest to configure node labels on controllers. Change-Id: I7547fb1184352cc7ab6d4c001bac21f73e429de7 Story: 2007000 Task: 39323 Depends-On: https://review.opendev.org/719962 Signed-off-by: Jim Gauld --- puppet-manifests/src/manifests/controller.pp | 1 + .../src/modules/platform/manifests/armada.pp | 25 +++++++++++++++++++ .../src/modules/platform/manifests/helm.pp | 11 +------- 3 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 puppet-manifests/src/modules/platform/manifests/armada.pp diff --git a/puppet-manifests/src/manifests/controller.pp b/puppet-manifests/src/manifests/controller.pp index 398e4004d..d239c1744 100644 --- a/puppet-manifests/src/manifests/controller.pp +++ b/puppet-manifests/src/manifests/controller.pp @@ -45,6 +45,7 @@ include ::platform::dockerdistribution include ::platform::containerd::controller include ::platform::kubernetes::master include ::platform::helm +include ::platform::armada include ::platform::patching include ::platform::patching::api diff --git a/puppet-manifests/src/modules/platform/manifests/armada.pp b/puppet-manifests/src/modules/platform/manifests/armada.pp new file mode 100644 index 000000000..28e60fd35 --- /dev/null +++ b/puppet-manifests/src/modules/platform/manifests/armada.pp @@ -0,0 +1,25 @@ +class platform::armada::params( + $node_selector_label = 'armada=enabled' +) {} + +class platform::armada + inherits ::platform::armada::params { + include ::platform::params + + if (str2bool($::is_initial_config) and $::personality == 'controller') { + + Class['::platform::kubernetes::master'] + + # Configure sane node label values that work with armada node selector. + # This is a workaround for helm v3 increased chart validation of values. + # We cannot override armada .Values.labels.node_selector_value with null + # or "" since it produces: + # error validating "": error validating data: unknown object type "nil". + # We can override with "" if the chart is modified to quote the value. + -> exec { 'label for armada node selector': + path => '/usr/bin:/usr/sbin:/bin', + command => "kubectl --kubeconfig=/etc/kubernetes/admin.conf label node ${::platform::params::hostname} armada=enabled || true", # lint:ignore:140chars + logoutput => true, + } + } +} diff --git a/puppet-manifests/src/modules/platform/manifests/helm.pp b/puppet-manifests/src/modules/platform/manifests/helm.pp index e512a90fc..45cbd81f9 100644 --- a/puppet-manifests/src/modules/platform/manifests/helm.pp +++ b/puppet-manifests/src/modules/platform/manifests/helm.pp @@ -24,7 +24,7 @@ define platform::helm::repository ( command => "helm repo index ${repo_path}", logoutput => true, user => 'www', - group => 'www', + group => 'root', require => User['www'], } @@ -95,15 +95,6 @@ class platform::helm Class['::platform::kubernetes::master'] - -> exec { 'initialize helm': - environment => [ 'KUBECONFIG=/etc/kubernetes/admin.conf', 'HOME=/home/sysadmin' ], - command => 'helm init --skip-refresh --client-only', - logoutput => true, - user => 'sysadmin', - group => 'sys_protected', - require => User['sysadmin'] - } - -> exec { 'restart lighttpd for helm': require => [File['/etc/lighttpd/lighttpd.conf', $target_helm_repos_base_dir, $source_helm_repos_base_dir]], command => 'systemctl restart lighttpd.service',