jinyuanliu 03c22c3c76 Get resource_type of kubernetes cgroup
Cgroup name of Kubernetes is determined by the
cgroup driver of Docker. If cgroup driver of Docker
is systemd, there will be an error in deploying HugePages.

https: //github.com/kubernetes/kubernetes/blob/release-1.26/pkg/kubelet/cm/cgroup_manager_linux.go#L77-L81
Change-Id: If709a968dde24d01e17fef63f09ebf9d7a23fc62
2023-03-31 01:36:49 +00:00

47 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -xe
export OS_CLOUD=openstack_helm
CEPH_ENABLED=false
if openstack service list -f value -c Type | grep -q "^volume" && \
openstack volume type list -f value -c Name | grep -q "rbd"; then
CEPH_ENABLED=true
fi
#NOTE: Get the over-rides to use
: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
: ${OSH_EXTRA_HELM_ARGS_LIBVIRT:="$(./tools/deployment/common/get-values-overrides.sh libvirt)"}
#NOTE: Lint and package chart
make -C ${OSH_INFRA_PATH} libvirt
#NOTE: Get resource_type of kubernetes cgroup
KUBERNETES_CGROUP=$(sudo docker info | grep "Cgroup Driver" | awk -F': ' '{print $2}' | grep -q systemd && echo kubepods.slice || echo kubepods)
#NOTE: Deploy libvirt
tee /tmp/libvirt.yaml << EOF
conf:
kubernetes:
cgroup: ${KUBERNETES_CGROUP}
EOF
#NOTE: Deploy libvirt
helm upgrade --install libvirt ${OSH_INFRA_PATH}/libvirt \
--namespace=openstack \
--values=/tmp/libvirt.yaml \
--set conf.ceph.enabled=${CEPH_ENABLED} \
${OSH_EXTRA_HELM_ARGS} \
${OSH_EXTRA_HELM_ARGS_LIBVIRT}