mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
Helm3: update scripts to install helm3
Updated scripts to install helm3 fixes #920 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
f696567517
commit
86500c06c3
@ -73,7 +73,7 @@ jobs:
|
||||
| sh -s -- -b $GOPATH/bin "${GOSEC_VERSION}"
|
||||
# install helm for helm lint
|
||||
- curl -L https://git.io/get_helm.sh
|
||||
| sh -s -- --version "${HELM_VERSION}"
|
||||
| bash -s -- -v "${HELM_VERSION}"
|
||||
script:
|
||||
- make go-lint
|
||||
- make go-lint-text
|
||||
|
@ -5,7 +5,7 @@
|
||||
TEMP="/tmp/cephcsi-helm-test"
|
||||
|
||||
HELM="helm"
|
||||
HELM_VERSION=${HELM_VERSION:-"v2.16.5"}
|
||||
HELM_VERSION=${HELM_VERSION:-"v3.1.2"}
|
||||
arch="${ARCH:-}"
|
||||
CEPHFS_CHART_NAME="ceph-csi-cephfs"
|
||||
RBD_CHART_NAME="ceph-csi-rbd"
|
||||
@ -95,40 +95,10 @@ install() {
|
||||
mkdir -p ${TEMP}
|
||||
# shellcheck disable=SC2021
|
||||
dist=$(echo "${dist}" | tr "[A-Z]" "[a-z]")
|
||||
wget "https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-${dist}-${arch}.tar.gz" -O "${TEMP}/helm.tar.gz"
|
||||
wget "https://get.helm.sh/helm-${HELM_VERSION}-${dist}-${arch}.tar.gz" -O "${TEMP}/helm.tar.gz"
|
||||
tar -C "${TEMP}" -zxvf "${TEMP}/helm.tar.gz"
|
||||
fi
|
||||
|
||||
# set up RBAC for helm
|
||||
kubectl --namespace kube-system create sa tiller
|
||||
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
|
||||
|
||||
# Init helm
|
||||
"${HELM}" init --service-account tiller --output yaml |
|
||||
sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' |
|
||||
sed 's@strategy: {}@selector: {"matchLabels": {"app": "helm", "name": "tiller"}}@' | kubectl apply -f -
|
||||
|
||||
kubectl -n kube-system patch deploy/tiller-deploy -p '{"spec": {"template": {"spec": {"serviceAccountName": "tiller"}}}}'
|
||||
|
||||
sleep 5
|
||||
|
||||
helm_ready=$(kubectl get pods -l app=helm -n kube-system -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
|
||||
INC=0
|
||||
until [[ "${helm_ready}" == "true" || $INC -gt 20 ]]; do
|
||||
sleep 10
|
||||
((++INC))
|
||||
helm_ready=$(kubectl get pods -l app=helm -n kube-system -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
|
||||
echo "helm pod status: ${helm_ready}"
|
||||
done
|
||||
|
||||
if [ "${helm_ready}" != "true" ]; then
|
||||
echo "Helm init not successful"
|
||||
kubectl get pods -l app=helm -n kube-system
|
||||
kubectl logs -lapp=helm --all-containers=true -nkube-system
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Helm init successful"
|
||||
echo "Helm install successful"
|
||||
}
|
||||
|
||||
install_cephcsi_helm_charts() {
|
||||
@ -144,7 +114,7 @@ install_cephcsi_helm_charts() {
|
||||
done
|
||||
|
||||
# install ceph-csi-cephfs and ceph-csi-rbd charts
|
||||
"${HELM}" install "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs --name ${CEPHFS_CHART_NAME} --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true
|
||||
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true ${CEPHFS_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs
|
||||
|
||||
check_deployment_status app=ceph-csi-cephfs ${NAMESPACE}
|
||||
check_daemonset_status app=ceph-csi-cephfs ${NAMESPACE}
|
||||
@ -152,7 +122,7 @@ install_cephcsi_helm_charts() {
|
||||
# deleting configmap as a workaround to avoid configmap already present
|
||||
# issue when installing ceph-csi-rbd
|
||||
kubectl delete cm ceph-csi-config --namespace ${NAMESPACE}
|
||||
"${HELM}" install "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --name ${RBD_CHART_NAME} --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}"
|
||||
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true ${RBD_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}"
|
||||
|
||||
check_deployment_status app=ceph-csi-rbd ${NAMESPACE}
|
||||
check_daemonset_status app=ceph-csi-rbd ${NAMESPACE}
|
||||
@ -160,23 +130,23 @@ install_cephcsi_helm_charts() {
|
||||
}
|
||||
|
||||
cleanup_cephcsi_helm_charts() {
|
||||
"${HELM}" del --purge ${CEPHFS_CHART_NAME}
|
||||
"${HELM}" del --purge ${RBD_CHART_NAME}
|
||||
|
||||
# remove set labels
|
||||
for node in $(kubectl get node --no-headers | cut -f 1 -d ' '); do
|
||||
kubectl label node/"$node" test.failure-domain/region-
|
||||
kubectl label node/"$node" test.failure-domain/zone-
|
||||
done
|
||||
# TODO/LATER we could remove the CSI labels that would have been set as well
|
||||
NAMESPACE=$1
|
||||
if [ -z "$NAMESPACE" ]; then
|
||||
NAMESPACE="default"
|
||||
fi
|
||||
"${HELM}" uninstall ${CEPHFS_CHART_NAME} --namespace ${NAMESPACE}
|
||||
"${HELM}" uninstall ${RBD_CHART_NAME} --namespace ${NAMESPACE}
|
||||
}
|
||||
|
||||
helm_reset() {
|
||||
"${HELM}" reset
|
||||
# shellcheck disable=SC2021
|
||||
rm -rf "${TEMP}"
|
||||
kubectl --namespace kube-system delete sa tiller
|
||||
kubectl delete clusterrolebinding tiller
|
||||
}
|
||||
|
||||
if [ -z "${arch}" ]; then
|
||||
@ -201,7 +171,7 @@ install-cephcsi)
|
||||
install_cephcsi_helm_charts "$2"
|
||||
;;
|
||||
cleanup-cephcsi)
|
||||
cleanup_cephcsi_helm_charts
|
||||
cleanup_cephcsi_helm_charts "$2"
|
||||
;;
|
||||
*)
|
||||
echo "usage:" >&2
|
||||
|
@ -21,6 +21,6 @@ scripts/install-helm.sh install-cephcsi ${NAMESPACE}
|
||||
go test github.com/ceph/ceph-csi/e2e -mod=vendor --deploy-timeout=10 -timeout=30m --cephcsi-namespace=${NAMESPACE} --deploy-cephfs=false --deploy-rbd=false -v
|
||||
|
||||
#cleanup
|
||||
scripts/install-helm.sh cleanup-cephcsi
|
||||
scripts/install-helm.sh cleanup-cephcsi ${NAMESPACE}
|
||||
scripts/install-helm.sh clean
|
||||
sudo scripts/minikube.sh clean
|
||||
|
Loading…
Reference in New Issue
Block a user