Update rbd-provisioner replicas based on installed controllers

Currently the number of rbd-provisioner replicas is driven by the
stx-openstack application's 'openstack-control-plane' labels.

On systems where this label has not been applied to the controllers,
this will result in zero provisioners being installed.

Break the dependency on the stx-openstack app and set the number of
replicas based on the number of installed controllers as the
rbd-provisioner node selector will install in k8s masters (i.e.
controllers).

Also update the provisioner's storage-init pod to align with the same
node selection criteria as the rbd-provisioner pod.

Change-Id: Ida180fd12a4923c8cdd5bccf25a1a1e2af4f8a90
Closes-Bug: #1830290
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2019-05-29 02:04:35 -04:00
parent 58a302eec0
commit 12ff7c16f8
7 changed files with 27 additions and 3 deletions

View File

@ -190,6 +190,10 @@ spec:
- name: config-volume-{{- $root.Values.global.name }}
mountPath: {{ $mount }}
{{- end }}
{{- if .Values.global.nodeSelector }}
nodeSelector:
{{ .Values.global.nodeSelector | toYaml | trim | indent 8 }}
{{- end }}
---
# This ConfigMap is needed because we're not using ceph's helm chart

View File

@ -5,4 +5,4 @@ $PKG_BASE/../../../helm-charts/node-feature-discovery \
$PKG_BASE/../../../helm-charts/rbd-provisioner \
$PKG_BASE/../../../helm-charts/ceph-pools-audit"
TIS_PATCH_VER=5
TIS_PATCH_VER=6

View File

@ -1,2 +1,2 @@
SRC_DIR="sysinv"
TIS_PATCH_VER=319
TIS_PATCH_VER=320

View File

@ -192,6 +192,16 @@ class Connection(object):
returns: A server
"""
@abc.abstractmethod
def count_hosts_by_personality(self, personality):
"""Return the number of hosts for a provided personality.
:param personality: The personality of the server
e.g. controller or worker
returns: The number of hosts matching the personality
parameter.
"""
@abc.abstractmethod
def ihost_update(self, server, values):
"""Update properties of a server.

View File

@ -1279,6 +1279,12 @@ class Connection(api.Connection):
return _paginate_query(models.ihost, limit, marker,
sort_key, sort_dir, query)
def count_hosts_by_personality(self, personality):
query = model_query(models.ihost)
query = add_host_options(query)
query = query.filter_by(personality=personality, recordtype="standard")
return query.count()
@objects.objectify(objects.host)
def ihost_get_by_function(self, function,
limit=None, marker=None,

View File

@ -137,6 +137,10 @@ class BaseHelm(object):
def _num_computes(self):
return self._count_hosts_by_label(common.LABEL_COMPUTE)
def _num_controllers_by_personality(self):
return int(self.dbapi.count_hosts_by_personality(
constants.CONTROLLER))
def _get_address_by_name(self, name, networktype):
"""
Retrieve an address entry by name and scoped by network type

View File

@ -71,7 +71,7 @@ class RbdProvisionerHelm(base.BaseHelm):
classes.append(cls)
global_settings = {
"replicas": self._num_controllers(),
"replicas": self._num_controllers_by_personality(),
"defaultStorageClass": constants.K8S_RBD_PROV_STOR_CLASS_NAME
}