Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AChangFeng authored Aug 9, 2024
2 parents b5abeb5 + fc826e1 commit 57adffd
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 102 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Unit test
Expand All @@ -70,10 +70,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Build images locally
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
with:
path: ${{ env.GOPATH }}/src/github.com/openebs/zfs-localpv

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Helm tool installer
Expand All @@ -81,10 +81,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Unit test
Expand All @@ -109,10 +109,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Build images locally
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/bdd_coverage.txt
files: ./tests/bdd_coverage.txt,./tests/bdd_coverage_custom-node-id.txt
name: coverage-bdd_coverage-$(date +%s)
flags: bddtests

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Unit test
Expand All @@ -63,10 +63,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: 1.19.9
go-version: 1.20.14
cache: false

- name: Build images locally
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ EXTERNAL_TOOLS=\
golang.org/x/lint/golint \
github.com/axw/gocov/gocov \
gopkg.in/matm/v1/gocov-html \
github.com/onsi/ginkgo/ginkgo \
github.com/onsi/ginkgo/v2/ginkgo \
github.com/onsi/gomega/...

# The images can be pushed to any docker/image registeries
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/zfs-driver/zfs-driver.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.19.9 as build
FROM golang:1.20.14 as build

ARG BRANCH
ARG RELEASE_TAG
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/541-snapshot-nodeid-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix issue when creating volume from snapshot or snapshot clone when node id differs from node name
82 changes: 54 additions & 28 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,51 +61,77 @@ waitForZFSDriver() {
return 1
}

# wait for zfs-driver to be up
waitForZFSDriver
runTestSuite() {
local coverageFile=$1
local labelFilter="$2"

cd $TEST_DIR
# wait for zfs-driver to be up
waitForZFSDriver

kubectl get po -n openebs
cd $TEST_DIR

set +e
kubectl get po -n openebs

echo "running ginkgo test case"
set +e

if ! ginkgo -v -coverprofile=bdd_coverage.txt -covermode=atomic; then
echo "running ginkgo test case with coverage ${coverageFile}"

sudo zpool status
if ! ginkgo -v -coverprofile="${coverageFile}" --label-filter="${labelFilter}" -covermode=atomic; then

sudo zfs list -t all
sudo zpool status

sudo zfs get all
sudo zfs list -t all

echo "******************** ZFS Controller logs***************************** "
dumpControllerLogs 1000
sudo zfs get all

echo "********************* ZFS Agent logs *********************************"
dumpAgentLogs 1000
echo "******************** ZFS Controller logs***************************** "
dumpControllerLogs 1000

echo "get all the pods"
kubectl get pods -owide --all-namespaces
echo "********************* ZFS Agent logs *********************************"
dumpAgentLogs 1000

echo "get pvc and pv details"
kubectl get pvc,pv -oyaml --all-namespaces
echo "get all the pods"
kubectl get pods -owide --all-namespaces

echo "get snapshot details"
kubectl get volumesnapshot.snapshot -oyaml --all-namespaces
echo "get pvc and pv details"
kubectl get pvc,pv -oyaml --all-namespaces

echo "get sc details"
kubectl get sc --all-namespaces -oyaml
echo "get snapshot details"
kubectl get volumesnapshot.snapshot -oyaml --all-namespaces

echo "get zfs volume details"
kubectl get zfsvolumes.zfs.openebs.io -n openebs -oyaml
echo "get sc details"
kubectl get sc --all-namespaces -oyaml

echo "get zfs snapshot details"
kubectl get zfssnapshots.zfs.openebs.io -n openebs -oyaml
echo "get zfs volume details"
kubectl get zfsvolumes.zfs.openebs.io -n openebs -oyaml

exit 1
fi
echo "get zfs snapshot details"
kubectl get zfssnapshots.zfs.openebs.io -n openebs -oyaml

exit 1
fi
}

runTestSuite bdd_coverage.txt "!custom-node-id"

prepareCustomNodeIdEnv() {
for node in $(kubectl get nodes -n openebs -o jsonpath='{.items[*].metadata.name}'); do
local zfsNode=$(kubectl get zfsnode -n openebs -o jsonpath="{.items[?(@.metadata.ownerReferences[0].name=='${node}')].metadata.name}")
echo "Relabeling node ${node} with ${node}-custom-id"
kubectl label node "${node}" openebs.io/nodeid="${node}-custom-id" --overwrite

local nodeDriver=$(kubectl get pods -l name=openebs-zfs-node -o jsonpath="{.items[?(@.spec.nodeName=='${node}')].metadata.name}" -n openebs)
echo "Restarting ${nodeDriver} on ${node} to pick up the new node id"
kubectl delete pod "${nodeDriver}" -n openebs

echo "Deleting old zfsnode ${zfsNode}"
kubectl delete zfsnode "${zfsNode}" -n openebs
done
}

prepareCustomNodeIdEnv
runTestSuite bdd_coverage_custom-node-id.txt "custom-node-id"

printf "\n\n"
echo "######### All test cases passed #########"
exit 0
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module github.com/openebs/zfs-localpv

go 1.19
go 1.20

require (
github.com/container-storage-interface/spec v1.8.0
github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.7
github.com/onsi/ginkgo/v2 v2.19.1
github.com/onsi/gomega v1.34.1
github.com/openebs/google-analytics-4 v0.2.1
github.com/openebs/lib-csi v0.8.2
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.6.0
github.com/stretchr/testify v1.8.1
golang.org/x/net v0.23.0
golang.org/x/sys v0.18.0
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.27.0
golang.org/x/sys v0.22.0
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.33.0
google.golang.org/protobuf v1.34.1
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
Expand All @@ -31,17 +31,18 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
Expand All @@ -53,19 +54,18 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.1 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
Expand Down
Loading

0 comments on commit 57adffd

Please sign in to comment.