This adds the CLI command 'system kube-config-kubelet'. This invokes puppet runtime manifests to reconfigure kubelet-config ConfigMap with new parameters, and to upgrade kubernetes nodes with new parameters, and restart kubelet. This gives the ability to update kubelet parameters with a software patch. The specific kubelet-config parameters are provided within the puppet manifests and its supporting parameters script. The specific settings values and engineering are described in the puppet component. Identical settings are also configured at install time in ansible-playbooks. TESTING: PASS - manually fill /var/lib/docker to exceed imageGC and verify GC operates PASS - AIO-DX fresh install gets updated kubelet config PASS - AIO-DX apply/remove designer patch with updated kubelet config PASS - 'system kube-config-kubelet' updates K8S nodes kubelet config PASS - AIO-DX reinstall controller-1 has updated kubelet config PASS - AIO-DX install new worker node gets updated kubelet config PASS - build and view REST documentation Partial-Bug: 1977754 Depends-On: https://review.opendev.org/c/starlingx/stx-puppet/+/844298 Depends-On: https://review.opendev.org/c/starlingx/ansible-playbooks/+/844305 Signed-off-by: Jim Gauld <james.gauld@windriver.com> Change-Id: Iad32a724d3f681bc9854fa663299f8539f70fd2achanges/17/844317/7
parent
15bb4dc070
commit
d57d3a07b8
@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from cgtsclient.common import base
|
||||
|
||||
|
||||
class KubeConfigKubelet(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<kube_config_kubelet %s>" % self._info
|
||||
|
||||
|
||||
class KubeConfigKubeletManager(base.Manager):
|
||||
resource_class = KubeConfigKubelet
|
||||
|
||||
@staticmethod
|
||||
def _path(id=None):
|
||||
return '/v1/kube_config_kubelet/%s' % id if id \
|
||||
else '/v1/kube_config_kubelet'
|
||||
|
||||
def apply(self):
|
||||
path = self._path("apply")
|
||||
_, body = self.api.json_request('POST', path)
|
||||
return body
|
@ -0,0 +1,29 @@
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
||||
from cgtsclient import exc
|
||||
|
||||
|
||||
def do_kube_config_kubelet(cc, args):
|
||||
"""Apply the kubelet config."""
|
||||
|
||||
try:
|
||||
response = cc.kube_config_kubelet.apply()
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError('Failed to apply kubelet config. No response.')
|
||||
except Exception as e:
|
||||
raise exc.CommandError('Failed to apply kubelet config: %s' % (e))
|
||||
else:
|
||||
success = response.get('success')
|
||||
error = response.get('error')
|
||||
if success:
|
||||
print("Success: " + success)
|
||||
if error:
|
||||
print("Error: " + error)
|
@ -0,0 +1,36 @@
|
||||
########################################################################
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
########################################################################
|
||||
|
||||
import pecan
|
||||
from pecan import expose
|
||||
from pecan import rest
|
||||
|
||||
from sysinv.common import utils as cutils
|
||||
from sysinv.openstack.common.rpc.common import RemoteError
|
||||
|
||||
LOCK_NAME = 'KubeConfigKubeletController'
|
||||
|
||||
|
||||
class KubeConfigKubeletController(rest.RestController):
|
||||
"""REST controller for kube_config_kubelet."""
|
||||
|
||||
_custom_actions = {
|
||||
'apply': ['POST'],
|
||||
}
|
||||
|
||||
@expose('json')
|
||||
@cutils.synchronized(LOCK_NAME)
|
||||
def apply(self):
|
||||
try:
|
||||
pecan.request.rpcapi.kube_config_kubelet(pecan.request.context)
|
||||
except RemoteError as e:
|
||||
return dict(success="", error=e.value)
|
||||
except Exception as ex:
|
||||
return dict(success="", error=str(ex))
|
||||
|
||||
return dict(success="kube-config-kubelet applied.", error="")
|
Loading…
Reference in new issue