On runtime, kube-sriov-device-plugin needs to be restarted

The previous correction for bug 1918139 removed the sriov plugin
restart necessary during runtime, done during the interface sriov
assign to a datanetwork (allowed on an unlocked AIO-SX). Without
it, the pod creation will not be able to use a datanetwork created
on runtime.

The correction bring back the platform::kubernetes::worker::sriovdp
class to be used only on runtime

Closes-Bug: 1918139

Signed-off-by: Andre Fernando Zanella Kantek <AndreFernandoZanella.Kantek@windriver.com>
Change-Id: Ied19bf3138b58b279b350d067ae0c1080e220f31
This commit is contained in:
Andre Fernando Zanella Kantek 2021-04-28 14:50:21 -04:00
parent bca819777c
commit 736199af41

View File

@ -428,6 +428,23 @@ class platform::kubernetes::worker::pci
class platform::kubernetes::worker::pci::runtime {
include ::platform::kubernetes::worker::pci
include ::platform::kubernetes::worker::sriovdp
}
class platform::kubernetes::worker::sriovdp {
include ::platform::kubernetes::params
include ::platform::params
$host_labels = $::platform::kubernetes::params::host_labels
if ($::personality == 'controller') and
str2bool($::is_worker_subfunction)
and ('sriovdp' in $host_labels) {
exec { 'Delete sriov device plugin pod if present':
path => '/usr/bin:/usr/sbin:/bin',
command => 'kubectl --kubeconfig=/etc/kubernetes/admin.conf delete pod -n kube-system --selector=app=sriovdp --field-selector spec.nodeName=$(hostname) --timeout=360s', # lint:ignore:140chars
onlyif => 'kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system --selector=app=sriovdp --field-selector spec.nodeName=$(hostname) | grep kube-sriov-device-plugin', # lint:ignore:140chars
logoutput => true,
}
}
}
class platform::kubernetes::worker