Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing latest changes from upstream devel for ceph-csi #257

Merged
merged 9 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pull-request-commentor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
k8s: ["1.25", "1.26", "1.27", "1.28", "1.29"]
exclude:
# the next Ceph-CSI version will not be tested with old Kubernetes
- k8s: "1.26"
branch: "devel"
- k8s: "1.25"
branch: "devel"
- k8s: "1.25"
Expand Down
75 changes: 63 additions & 12 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@ queue_rules:
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
- base=release-v3.10
- "status-success=codespell"
- "status-success=multi-arch-build"
- "status-success=go-test"
- "status-success=golangci-lint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
Expand Down Expand Up @@ -72,15 +94,15 @@ queue_rules:
- "status-success=golangci-lint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
Expand Down Expand Up @@ -166,15 +188,15 @@ pull_request_rules:
- "status-success=golangci-lint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
Expand Down Expand Up @@ -211,6 +233,35 @@ pull_request_rules:
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
- label!=DNM
- base=release-v3.10
- "#approved-reviews-by>=2"
- "#changes-requested-reviews-by=0"
- "approved-reviews-by=@ceph/ceph-csi-contributors"
- "approved-reviews-by=@ceph/ceph-csi-maintainers"
- "status-success=DCO"
- "status-success=codespell"
- "status-success=commitlint"
- "status-success=go-test"
- "status-success=golangci-lint"
- "status-success=lint-extras"
- "status-success=mod-check"
- "status-success=multi-arch-build"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
Expand Down Expand Up @@ -259,15 +310,15 @@ pull_request_rules:
- "status-success=commitlint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
Expand Down Expand Up @@ -317,15 +368,15 @@ pull_request_rules:
- "status-success=mod-check"
- "status-success=lint-extras"
- "#changes-requested-reviews-by=0"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
Expand Down
2 changes: 1 addition & 1 deletion build.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GOLANGCI_VERSION=v1.54.1

# external snapshotter version
# Refer: https://github.com/kubernetes-csi/external-snapshotter/releases
SNAPSHOT_VERSION=v6.2.2
SNAPSHOT_VERSION=v7.0.1

# "go test" configuration
# set to stdout or html to enable coverage reporting, disabled by default
Expand Down
52 changes: 36 additions & 16 deletions scripts/install-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ SCRIPT_DIR="$(dirname "${0}")"
# shellcheck source=build.env
source "${SCRIPT_DIR}/../build.env"

# shellcheck disable=SC1091
[ ! -e "${SCRIPT_DIR}"/utils.sh ] || source "${SCRIPT_DIR}"/utils.sh

SNAPSHOT_VERSION=${SNAPSHOT_VERSION:-"v5.0.1"}

TEMP_DIR="$(mktemp -d)"
Expand All @@ -21,6 +24,11 @@ SNAPSHOTCLASS="${SNAPSHOTTER_URL}/client/config/crd/snapshot.storage.k8s.io_volu
VOLUME_SNAPSHOT_CONTENT="${SNAPSHOTTER_URL}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml"
VOLUME_SNAPSHOT="${SNAPSHOTTER_URL}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml"

# volumegroupsnapshot CRD
VOLUME_GROUP_SNAPSHOTCLASS="${SNAPSHOTTER_URL}/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml"
VOLUME_GROUP_SNAPSHOT_CONTENT="${SNAPSHOTTER_URL}/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml"
VOLUME_GROUP_SNAPSHOT="${SNAPSHOTTER_URL}/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml"

function install_snapshot_controller() {
local namespace=$1
if [ -z "${namespace}" ]; then
Expand All @@ -29,19 +37,19 @@ function install_snapshot_controller() {

create_or_delete_resource "create" "${namespace}"

pod_ready=$(kubectl get pods -l app=snapshot-controller -n "${namespace}" -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
pod_ready=$(kubectl_retry get pods -l app.kubernetes.io/name=snapshot-controller -n "${namespace}" -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
INC=0
until [[ "${pod_ready}" == "true" || $INC -gt 20 ]]; do
sleep 10
((++INC))
pod_ready=$(kubectl get pods -l app=snapshot-controller -n "${namespace}" -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
pod_ready=$(kubectl_retry get pods -l app.kubernetes.io/name=snapshot-controller -n "${namespace}" -o jsonpath='{.items[0].status.containerStatuses[0].ready}')
echo "snapshotter pod status: ${pod_ready}"
done

if [ "${pod_ready}" != "true" ]; then
echo "snapshotter controller creation failed"
kubectl get pods -l app=snapshot-controller -n "${namespace}"
kubectl describe po -l app=snapshot-controller -n "${namespace}"
kubectl_retry get pods -l app.kubernetes.io/name=snapshot-controller -n "${namespace}"
kubectl_retry describe po -l app.kubernetes.io/name=snapshot-controller -n "${namespace}"
exit 1
fi

Expand All @@ -66,19 +74,31 @@ function create_or_delete_resource() {
curl -o "${temp_snap_controller}" "${SNAPSHOT_CONTROLLER}"
sed -i "s/namespace: kube-system/namespace: ${namespace}/g" "${temp_rbac}"
sed -i "s/namespace: kube-system/namespace: ${namespace}/g" "${temp_snap_controller}"
sed -i "s/canary/${SNAPSHOT_VERSION}/g" "${temp_snap_controller}"

kubectl "${operation}" -f "${temp_rbac}"
kubectl "${operation}" -f "${temp_snap_controller}" -n "${namespace}"
kubectl "${operation}" -f "${SNAPSHOTCLASS}"
kubectl "${operation}" -f "${VOLUME_SNAPSHOT_CONTENT}"
kubectl "${operation}" -f "${VOLUME_SNAPSHOT}"
}
sed -i -E "s/(image: registry\.k8s\.io\/sig-storage\/snapshot-controller:).*$/\1$SNAPSHOT_VERSION/g" "${temp_snap_controller}"

if [ "${operation}" == "create" ]; then
# Argument to add/update
ARGUMENT="--enable-volume-group-snapshots=true"
# Check if the argument is already present and set to false
if grep -q -E "^\s+-\s+--enable-volume-group-snapshots=false" "${temp_snap_controller}"; then
sed -i -E "s/^\s+-\s+--enable-volume-group-snapshots=false$/ - $ARGUMENT/" "${temp_snap_controller}"
# Check if the argument is already present and set to true
elif grep -q -E "^\s+-\s+--enable-volume-group-snapshots=true" "${temp_snap_controller}"; then
echo "Argument already present and matching."
else
# Add the argument if it's not present
sed -i -E "/^(\s+)args:/a\ \ - $ARGUMENT" "${temp_snap_controller}"
fi
fi

function delete_snapshot_crd() {
kubectl delete -f "${SNAPSHOTCLASS}" --ignore-not-found
kubectl delete -f "${VOLUME_SNAPSHOT_CONTENT}" --ignore-not-found
kubectl delete -f "${VOLUME_SNAPSHOT}" --ignore-not-found
kubectl_retry "${operation}" -f "${VOLUME_GROUP_SNAPSHOTCLASS}"
kubectl_retry "${operation}" -f "${VOLUME_GROUP_SNAPSHOT_CONTENT}"
kubectl_retry "${operation}" -f "${VOLUME_GROUP_SNAPSHOT}"
kubectl_retry "${operation}" -f "${temp_rbac}"
kubectl_retry "${operation}" -f "${temp_snap_controller}" -n "${namespace}"
kubectl_retry "${operation}" -f "${SNAPSHOTCLASS}"
kubectl_retry "${operation}" -f "${VOLUME_SNAPSHOT_CONTENT}"
kubectl_retry "${operation}" -f "${VOLUME_SNAPSHOT}"
}

case "${1:-}" in
Expand Down