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

fix(ci): add openebs namespace in ci #580

Merged
merged 1 commit into from
Aug 30, 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
3 changes: 2 additions & 1 deletion .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ jobs:
- name: Setting environment variables
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
echo "OPENEBS_NAMESPACE=openebs" >> $GITHUB_ENV
- name: bootstrap
run: make bootstrap

- name: Running tests
env:
OPENEBS_NAMESPACE: "openebs"
run: |
make ci
make sanity
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ jobs:
- name: Setting environment variables
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
echo "OPENEBS_NAMESPACE=openebs" >> $GITHUB_ENV

- name: bootstrap
run: make bootstrap

- name: Running tests
env:
OPENEBS_NAMESPACE: "openebs"
run: |
make ci
make sanity
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ jobs:
- name: Setting environment variables
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
echo "OPENEBS_NAMESPACE=openebs" >> $GITHUB_ENV

- name: bootstrap
run: make bootstrap

- name: Running tests
env:
OPENEBS_NAMESPACE: "openebs"
run: |
make ci
make sanity
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
# Tools required for different make
# targets or for development purposes
EXTERNAL_TOOLS=\
golang.org/x/tools/cmd/cover \
golang.org/x/lint/golint \
github.com/axw/gocov/gocov \
gopkg.in/matm/v1/gocov-html \
github.com/onsi/ginkgo/v2/ginkgo \
github.com/onsi/gomega/...
golang.org/x/tools/cmd/cover@latest \
golang.org/x/lint/golint@latest \
github.com/axw/gocov/gocov@latest \
gopkg.in/matm/v1/gocov-html@latest \
github.com/onsi/ginkgo/v2/[email protected]

# The images can be pushed to any docker/image registeries
# like docker hub, quay. The registries are specified in
Expand Down Expand Up @@ -120,7 +119,7 @@ verify-deps: deps
bootstrap: controller-gen
@for tool in $(EXTERNAL_TOOLS) ; do \
echo "+ Installing $$tool" ; \
cd && GO111MODULE=on go install -mod=mod $$tool@latest; \
cd && GO111MODULE=on go install -mod=mod $$tool; \
done

.PHONY: controller-gen
Expand Down
35 changes: 17 additions & 18 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ TEST_DIR="tests"

# Prepare env for running BDD tests
# Minikube is already running
helm install zfs-localpv ./deploy/helm/charts -n "$OPENEBS_NAMESPACE" --create-namespace --set zfsPlugin.pullPolicy=Never --set analytics.enabled=false
helm install zfs-localpv ./deploy/helm/charts -n $OPENEBS_NAMESPACE --create-namespace --set zfsPlugin.pullPolicy=Never --set analytics.enabled=false
kubectl apply -f "$SNAP_CLASS"

dumpAgentLogs() {
NR=$1
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po "$AgentPOD" -n openebs
AgentPOD=$(kubectl get pods -l app=openebs-zfs-node -o jsonpath='{.items[0].metadata.name}' -n $OPENEBS_NAMESPACE)
kubectl describe po "$AgentPOD" -n $OPENEBS_NAMESPACE
printf "\n\n"
kubectl logs --tail="${NR}" "$AgentPOD" -n openebs -c openebs-zfs-plugin
kubectl logs --tail="${NR}" "$AgentPOD" -n $OPENEBS_NAMESPACE -c openebs-zfs-plugin
printf "\n\n"
}

dumpControllerLogs() {
NR=$1
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n openebs)
kubectl describe po "$ControllerPOD" -n openebs
ControllerPOD=$(kubectl get pods -l app=openebs-zfs-controller -o jsonpath='{.items[0].metadata.name}' -n $OPENEBS_NAMESPACE)
kubectl describe po "$ControllerPOD" -n $OPENEBS_NAMESPACE
printf "\n\n"
kubectl logs --tail="${NR}" "$ControllerPOD" -n openebs -c openebs-zfs-plugin
kubectl logs --tail="${NR}" "$ControllerPOD" -n $OPENEBS_NAMESPACE -c openebs-zfs-plugin
printf "\n\n"
}


isPodReady(){
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n openebs)" = 'True' ]
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n $OPENEBS_NAMESPACE)" = 'True' ]
}


Expand All @@ -44,10 +44,9 @@ isDriverReady(){
waitForZFSDriver() {
period=120
interval=1

i=0
while [ "$i" -le "$period" ]; do
zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n openebs)"
zfsDriver="$(kubectl get pods -l role=openebs-zfs -o 'jsonpath={.items[*].metadata.name}' -n $OPENEBS_NAMESPACE)"
if isDriverReady "$zfsDriver"; then
return 0
fi
Expand All @@ -70,7 +69,7 @@ runTestSuite() {

cd $TEST_DIR

kubectl get po -n openebs
kubectl get po -n $OPENEBS_NAMESPACE

set +e

Expand Down Expand Up @@ -103,10 +102,10 @@ runTestSuite() {
kubectl get sc --all-namespaces -oyaml

echo "get zfs volume details"
kubectl get zfsvolumes.zfs.openebs.io -n openebs -oyaml
kubectl get zfsvolumes.zfs.openebs.io -n $OPENEBS_NAMESPACE -oyaml

echo "get zfs snapshot details"
kubectl get zfssnapshots.zfs.openebs.io -n openebs -oyaml
kubectl get zfssnapshots.zfs.openebs.io -n $OPENEBS_NAMESPACE -oyaml

exit 1
fi
Expand All @@ -115,17 +114,17 @@ runTestSuite() {
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}")
for node in $(kubectl get nodes -n $OPENEBS_NAMESPACE -o jsonpath='{.items[*].metadata.name}'); do
local zfsNode=$(kubectl get zfsnode -n $OPENEBS_NAMESPACE -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)
local nodeDriver=$(kubectl get pods -l name=openebs-zfs-node -o jsonpath="{.items[?(@.spec.nodeName=='${node}')].metadata.name}" -n $OPENEBS_NAMESPACE)
echo "Restarting ${nodeDriver} on ${node} to pick up the new node id"
kubectl delete pod "${nodeDriver}" -n openebs
kubectl delete pod "${nodeDriver}" -n $OPENEBS_NAMESPACE

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

Expand Down
1 change: 1 addition & 0 deletions deploy/helm/charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Create labels for openebs zfs-localpv controller
Create match labels for openebs zfs-localpv node daemon
*/}}
{{- define "zfslocalpv.zfsNode.matchLabels" -}}
app: {{ .Values.zfsNode.componentName | quote }}
name: {{ .Values.zfsNode.componentName | quote }}{{ if or (not (hasKey .Values "enableHelmMetaLabels")) .Values.enableHelmMetaLabels }}
release: {{ .Release.Name }}
{{- end -}}
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ 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/v2 v2.19.1
github.com/onsi/ginkgo/v2 v2.20.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.4
golang.org/x/net v0.27.0
golang.org/x/sys v0.22.0
golang.org/x/net v0.28.0
golang.org/x/sys v0.23.0
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.34.1
k8s.io/api v0.27.2
Expand Down Expand Up @@ -57,12 +57,12 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/tools v0.24.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
Expand Down
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0=
github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA=
github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo=
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
Expand Down Expand Up @@ -454,6 +456,7 @@ golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -507,6 +510,8 @@ golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -587,6 +592,8 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -599,6 +606,8 @@ golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -617,6 +626,8 @@ golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -681,6 +692,8 @@ golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
Loading