Add new kubelet filesystem to host_fs

Add a new filesystem called "kubelet" to all hosts with a default
size of 10G. This new fs will be managed by the host_fs API.

Also made the scratch filesystem resizable on all hosts.

Tested with install of hardware Standard and AIO-DX labs. Also
tested install of a vbox AIO-SX lab.

Partial-Bug: 1830142
Depends-On: https://review.opendev.org/671120

Change-Id: I968f84b8ba7a069ec3d7027d4eb4a7355a06d9d3
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
Kristine Bujold 2019-07-17 10:16:05 -04:00
parent a3538d7377
commit e74ef5f7c4
9 changed files with 92 additions and 33 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="src"
TIS_PATCH_VER=90
TIS_PATCH_VER=91

View File

@ -27,5 +27,6 @@ include ::platform::etcd::bootstrap
# Puppet classes to enable initial controller unlock
include ::platform::drbd::dockerdistribution::bootstrap
include ::platform::filesystem::backup
include ::platform::filesystem::kubelet
include ::platform::mtce::bootstrap
include ::platform::fm::bootstrap

View File

@ -144,6 +144,26 @@ class platform::filesystem::scratch
}
}
class platform::filesystem::kubelet::params (
$lv_size = '10',
$lv_name = 'kubelet-lv',
$mountpoint = '/var/lib/kubelet',
$devmapper = '/dev/mapper/cgts--vg-kubelet--lv',
$fs_type = 'ext4',
$fs_options = ' '
) { }
class platform::filesystem::kubelet
inherits ::platform::filesystem::kubelet::params {
platform::filesystem { $lv_name:
lv_name => $lv_name,
lv_size => $lv_size,
mountpoint => $mountpoint,
fs_type => $fs_type,
fs_options => $fs_options
}
}
class platform::filesystem::docker::params (
$lv_size = '1',
@ -169,8 +189,8 @@ class platform::filesystem::docker
}
}
class platform::filesystem::storage {
include ::platform::filesystem::kubelet
class {'platform::filesystem::docker::params' :
lv_size => 30
@ -178,25 +198,26 @@ class platform::filesystem::storage {
-> class {'platform::filesystem::docker' :
}
Class['::platform::lvm::vg::cgts_vg'] -> Class['::platform::filesystem::docker']
Class['::platform::lvm::vg::cgts_vg'] -> Class[$name]
}
class platform::filesystem::compute {
include ::platform::filesystem::kubelet
class {'platform::filesystem::docker::params' :
lv_size => 30
}
-> class {'platform::filesystem::docker' :
}
Class['::platform::lvm::vg::cgts_vg'] -> Class['::platform::filesystem::docker']
Class['::platform::lvm::vg::cgts_vg'] -> Class[$name]
}
class platform::filesystem::controller {
include ::platform::filesystem::backup
include ::platform::filesystem::scratch
include ::platform::filesystem::docker
include ::platform::filesystem::kubelet
}
@ -229,6 +250,20 @@ class platform::filesystem::scratch::runtime {
}
}
class platform::filesystem::kubelet::runtime {
include ::platform::filesystem::kubelet::params
$lv_name = $::platform::filesystem::kubelet::params::lv_name
$lv_size = $::platform::filesystem::kubelet::params::lv_size
$devmapper = $::platform::filesystem::kubelet::params::devmapper
platform::filesystem::resize { $lv_name:
lv_name => $lv_name,
lv_size => $lv_size,
devmapper => $devmapper,
}
}
class platform::filesystem::docker::runtime {

View File

@ -1,2 +1,2 @@
SRC_DIR="sysinv"
TIS_PATCH_VER=327
TIS_PATCH_VER=328

View File

@ -1298,6 +1298,17 @@ class AgentManager(service.PeriodicService):
}
filesystems.append(data)
# check if the kubelet fs is supported for current host
if utils.is_filesystem_supported(constants.FILESYSTEM_NAME_KUBELET,
self._ihost_personality):
data = {
'name': constants.FILESYSTEM_NAME_KUBELET,
'size': constants.KUBELET_STOR_SIZE,
'logical_volume': constants.FILESYSTEM_LV_DICT[
constants.FILESYSTEM_NAME_KUBELET]
}
filesystems.append(data)
if filesystems:
# Create the filesystems if they do not already exist.
# This audit does not check if the fs size has changed.

View File

@ -274,6 +274,10 @@ class HostFsController(rest.RestController):
modified_fs += [fs_name]
if not modified_fs:
msg = _("HostFs update failed: no filesystems to update")
raise wsme.exc.ClientSideError(msg)
host_fs_list_new = []
for fs in current_host_fs_list:
replaced = False
@ -298,28 +302,30 @@ class HostFsController(rest.RestController):
LOG.info("Requested growth in GiB: %s" % requested_growth_gib)
if utils.is_host_state_valid_for_fs_resize(host):
cgtsvg_free_space_gib = utils.get_node_cgtsvg_limit(host)
cgtsvg_free_space_gib = utils.get_node_cgtsvg_limit(host)
if requested_growth_gib > cgtsvg_free_space_gib:
msg = _("HostFs update failed: Not enough free space on %s. "
"Current free space %s GiB, "
"requested total increase %s GiB" %
(constants.LVG_CGTS_VG, cgtsvg_free_space_gib, requested_growth_gib))
LOG.warning(msg)
raise wsme.exc.ClientSideError(msg)
if requested_growth_gib > cgtsvg_free_space_gib:
msg = _("HostFs update failed: Not enough free space on %s. "
"Current free space %s GiB, "
"requested total increase %s GiB" %
(constants.LVG_CGTS_VG, cgtsvg_free_space_gib, requested_growth_gib))
LOG.warning(msg)
raise wsme.exc.ClientSideError(msg)
for fs in host_fs_list_new:
if fs.name in modified_fs:
value = {'size': fs.size}
pecan.request.dbapi.host_fs_update(fs.uuid, value)
for fs in host_fs_list_new:
if fs.name in modified_fs:
value = {'size': fs.size}
pecan.request.dbapi.host_fs_update(fs.uuid, value)
try:
# perform rpc to conductor to perform config apply
pecan.request.rpcapi.update_host_filesystem_config(
pecan.request.context,
host=host,
filesystem_list=modified_fs,)
if (host.invprovision in [constants.PROVISIONED,
constants.PROVISIONING]):
# perform rpc to conductor to perform config apply
pecan.request.rpcapi.update_host_filesystem_config(
pecan.request.context,
host=host,
filesystem_list=modified_fs,)
except Exception as e:
msg = _("Failed to update filesystem size for %s" % host.name)

View File

@ -319,10 +319,10 @@ DEFAULT_SMALL_DISK_SIZE = 240
# 186
MINIMUM_DISK_SIZE = 186
# Docker lv size when Kubernetes is configured
KUBERNETES_DOCKER_STOR_SIZE = 30
DOCKER_DISTRIBUTION_STOR_SIZE = 16
ETCD_STOR_SIZE = 5
KUBELET_STOR_SIZE = 10
# Openstack Interface names
OS_INTERFACE_PUBLIC = 'public'
@ -506,6 +506,7 @@ FILESYSTEM_NAME_DOCKER_DISTRIBUTION = 'docker-distribution'
FILESYSTEM_NAME_EXTENSION = 'extension'
FILESYSTEM_NAME_ETCD = 'etcd'
FILESYSTEM_NAME_PATCH_VAULT = 'patch-vault'
FILESYSTEM_NAME_KUBELET = 'kubelet'
FILESYSTEM_LV_DICT = {
FILESYSTEM_NAME_CGCS: 'cgcs-lv',
@ -517,20 +518,26 @@ FILESYSTEM_LV_DICT = {
FILESYSTEM_NAME_EXTENSION: 'extension-lv',
FILESYSTEM_NAME_ETCD: 'etcd-lv',
FILESYSTEM_NAME_PATCH_VAULT: 'patch-vault-lv',
FILESYSTEM_NAME_KUBELET: 'kubelet-lv',
}
FILESYSTEM_CONTROLLER_SUPPORTED_LIST = [
FILESYSTEM_NAME_SCRATCH,
FILESYSTEM_NAME_BACKUP,
FILESYSTEM_NAME_DOCKER,
FILESYSTEM_NAME_KUBELET,
]
FILESYSTEM_WORKER_SUPPORTED_LIST = [
FILESYSTEM_NAME_DOCKER,
FILESYSTEM_NAME_KUBELET,
FILESYSTEM_NAME_SCRATCH,
]
FILESYSTEM_STORAGE_SUPPORTED_LIST = [
FILESYSTEM_NAME_DOCKER,
FILESYSTEM_NAME_KUBELET,
FILESYSTEM_NAME_SCRATCH,
]
FILESYSTEM_HOSTS_SUPPORTED_LIST_DICT = {

View File

@ -5504,10 +5504,6 @@ class ConductorManager(service.PeriodicService):
LOG.info("update_host_filesystem_config config_uuid=%s" % config_uuid)
if filesystem_list:
# apply the manifest at runtime, otherwise a reboot is required
if os.path.isfile(CONFIG_CONTROLLER_FINI_FLAG):
os.remove(CONFIG_CONTROLLER_FINI_FLAG)
# map the updated file system to the runtime puppet class
classmap = {
constants.FILESYSTEM_NAME_BACKUP:
@ -5516,11 +5512,11 @@ class ConductorManager(service.PeriodicService):
'platform::filesystem::scratch::runtime',
constants.FILESYSTEM_NAME_DOCKER:
'platform::filesystem::docker::runtime',
constants.FILESYSTEM_NAME_KUBELET:
'platform::filesystem::kubelet::runtime',
}
puppet_class = None
if filesystem_list:
puppet_class = [classmap.get(fs) for fs in filesystem_list]
puppet_class = [classmap.get(fs) for fs in filesystem_list]
config_dict = {
"personalities": host.personality,
"classes": puppet_class,

View File

@ -248,5 +248,8 @@ class StoragePuppet(base.BasePuppet):
config.update({
'platform::filesystem::docker::params::lv_size': fs.size
})
elif fs.name == constants.FILESYSTEM_NAME_KUBELET:
config.update({
'platform::filesystem::kubelet::params::lv_size': fs.size
})
return config