Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Merge pull request #15 from storageos/remove-dbupgrade
Browse files Browse the repository at this point in the history
Remove DBUpgrade, not needed for v2
  • Loading branch information
croomes authored Aug 18, 2020
2 parents 8f3f2c9 + e371b25 commit 18be8b5
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 196 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ sudo: required
language: go

go:
- "1.12.9"
- "1.15"

env:
global:
- IMAGE_NAME=storageos/init
- IMAGE_TAG=test
- K8S_VERSION="v1.14.2"
- K8S_VERSION="v1.18.6"

before_install:
- |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13.5 AS build
FROM golang:1.15.0 AS build

WORKDIR /go/src/github.com/storageos/init/
COPY . /go/src/github.com/storageos/init/
Expand All @@ -8,7 +8,7 @@ FROM registry.access.redhat.com/ubi8/ubi
LABEL name="StorageOS Init" \
maintainer="[email protected]" \
vendor="StorageOS" \
version="1.0.1" \
version="v2.0.0" \
release="1" \
distribution-scope="public" \
architecture="x86_64" \
Expand Down
52 changes: 3 additions & 49 deletions daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,57 +90,11 @@ spec:
- SYS_ADMIN
containers:
- name: storageos
image: storageos/node:1.3.0
image: busybox
imagePullPolicy: IfNotPresent
args:
- server
ports:
- containerPort: 5705
name: api
livenessProbe:
initialDelaySeconds: 65
timeoutSeconds: 10
failureThreshold: 5
httpGet:
path: /v1/health
port: api
readinessProbe:
initialDelaySeconds: 65
timeoutSeconds: 10
failureThreshold: 5
httpGet:
path: /v1/health
port: api
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: JOIN
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: ADVERTISE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DISABLE_TELEMETRY
value: "true"
volumeMounts:
- name: sys
mountPath: /sys
- name: state
mountPath: /var/lib/storageos
mountPropagation: Bidirectional
securityContext:
privileged: true
capabilities:
add:
- SYS_ADMIN
- sleep
- "600"
volumes:
- name: kernel-modules
hostPath:
Expand Down
130 changes: 13 additions & 117 deletions e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ prepare_host() {
sudo mount --make-shared /sys
sudo mount --make-shared /
sudo mount --make-shared /dev
docker run --name enable_lio --privileged --rm --cap-add=SYS_ADMIN -v /lib/modules:/lib/modules -v /sys:/sys:rshared storageos/init:0.2
}

run_kind() {
echo "Download kind binary..."
wget -O kind 'https://docs.google.com/uc?export=download&id=1-oy-ui0ZE_T3Fglz1c8ZgnW8U-A4yS8u' --no-check-certificate && chmod +x kind && sudo mv kind /usr/local/bin/
wget -O kind 'https://kind.sigs.k8s.io/dl/v0.8.1/kind-linux-amd64' --no-check-certificate && chmod +x kind && sudo mv kind /usr/local/bin/

echo "Download kubectl..."
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/"${K8S_VERSION}"/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
Expand All @@ -24,7 +23,8 @@ run_kind() {
kind create cluster --image storageos/kind-node:"$K8S_VERSION" --name kind-1

echo "Export kubeconfig..."
export KUBECONFIG="$(kind get kubeconfig-path --name="kind-1")"
kind get kubeconfig --name="kind-1" > kubeconfig.yaml
export KUBECONFIG="kubeconfig.yaml"
echo

echo "Get cluster info..."
Expand All @@ -36,98 +36,6 @@ run_kind() {
echo
}

# This tests the dataplane upgrade on the host, independent of any k8s cluster.
nok8s_dpupgrade() {
# Run StorageOS and create old dp database.
docker pull storageos/node:1.3.0
NODE_IMAGE=storageos/node:1.3.0 bash run-stos.sh
sleep 10

# Wait until storageos node is healthy.
health=$(docker inspect storageos --type container | jq '.[0] | .State.Health.Status')
until [ $health == '"healthy"' ]
do
health=$(docker inspect storageos --type container | jq '.[0] | .State.Health.Status')
echo "storageos status $health"
echo "waiting for storageos node to be healthy..."
sleep 3
done

echo
echo "storageos node is healthy"

# Stop storageos.
docker rm storageos -f

# Run dp upgrade on old database.
echo
echo "Attempting dp upgrade"
UPGRADELOGS=/tmp/dpupgrade.log
make run > $UPGRADELOGS
if ! grep "successfully upgraded database" $UPGRADELOGS; then
echo "dpupgrade failed!"
echo
echo "init logs:"
cat $UPGRADELOGS
exit 1
fi
echo "upgrade successful"
}

# This tests the dataplane upgrade in a k8s cluster by updating node 1.3.0
# storageos node to 1.4.0.
k8s_dpupgrade() {
# Get KinD container id.
x=$(docker ps -f name=kind-1-control-plane -q)

# Re-tag node 1.3.0 as storageos/node:1.4.0 and copy into KinD.
# This is temporary until storageos/node:1.4.0 is released.
docker tag storageos/node:1.3.0 storageos/node:1.4.0
docker save storageos/node:1.4.0 > stos140.tar
docker cp stos140.tar $x:/stos140.tar
docker exec $x bash -c "ctr -n k8s.io images import --base-name docker.io/storageos/node:1.4.0 /stos140.tar"

# Get storageos pod.
stospod=$(kubectl get pods --template='{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep storageos)

echo "Waiting for the storageos container to be ready"
# First and only container in this pod is the storageos container.
until kubectl get pod $stospod --template='{{ (index .status.containerStatuses 0).ready }}' | grep -q true; do sleep 5; done
echo "storageos pod found ready"

sleep 5

# Patch DaemonSet with new storageos version.
kubectl set image ds/storageos-daemonset storageos=storageos/node:1.4.0

# kill the pod for the update to apply.
kubectl delete pod $stospod

sleep 5

# Get new pod name.
stospod=$(kubectl get pods --template='{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep storageos)

echo "Waiting for the storageos pod to be ready"
until kubectl get pod $stospod --template='{{ (index .status.containerStatuses 0).ready }}' | grep -q true; do sleep 5; done
echo "storageos pod found ready"

echo "checking init container logs"
UPGRADELOGS=/tmp/dpupgrade-k8s.log
kubectl logs $stospod -c storageos-init > $UPGRADELOGS
echo

if ! grep "successfully upgraded database" $UPGRADELOGS; then
echo "dpupgrade failed!"
echo
echo "init logs:"
cat $UPGRADELOGS
exit 1
fi
echo "upgrade successful"
echo
}

main() {
make unittest
make image
Expand All @@ -137,12 +45,6 @@ main() {

echo "Ready for e2e testing"

# Run out of k8s dpupgrade test.
echo
echo "No k8s dp upgrade test"
echo
nok8s_dpupgrade

echo
echo "Prepare for k8s test"
echo
Expand All @@ -155,29 +57,23 @@ main() {
# containerd load image from tar archive (KinD with containerd).
docker exec $x bash -c "ctr -n k8s.io images import --base-name docker.io/storageos/init:test /init.tar"

# Load storageos node 1.3.0 container image into KinD.
docker pull storageos/node:1.3.0
docker save storageos/node:1.3.0 > stos130.tar
docker cp stos130.tar $x:/stos130.tar
docker exec $x bash -c "ctr -n k8s.io images import --base-name docker.io/storageos/node:1.3.0 /stos130.tar"
# Use busybox in place of the node container.
docker pull busybox:1.32
docker save busybox:1.32 > busybox.tar
docker cp busybox.tar $x:/busybox.tar
docker exec $x bash -c "ctr -n k8s.io images import --base-name docker.io/busybox:1.32 /busybox.tar"

# Create storageos daemonset with node 1.3.0
# Create storageos daemonset with node v1.5.3
kubectl apply -f daemonset.yaml
sleep 5

# Run dp upgrade test.
k8s_dpupgrade

# Get pod name.
stospod=$(kubectl get pods --template='{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | grep storageos)

# NOTE: Once dataplane upgrade test is no longer needed, remove the
# k8s_dpupgrade call above and uncomment the following wait code.

# echo "Waiting for the storageos pod to be ready"
# until kubectl get pod $stospod --template='{{ (index .status.containerStatuses 0).ready }}' | grep -q true; do sleep 5; done
# # until kubectl get pod $stospod --no-headers -o go-template='{{.status.phase}}' | grep -q Running; do sleep 5; done
# echo "storageos pod found ready"
echo "Waiting for the storageos pod to be ready"
until kubectl get pod $stospod --template='{{ (index .status.containerStatuses 0).ready }}' | grep -q true; do sleep 5; done
# until kubectl get pod $stospod --no-headers -o go-template='{{.status.phase}}' | grep -q Running; do sleep 5; done
echo "storageos pod found ready"

echo
echo "init container logs:"
Expand Down
15 changes: 8 additions & 7 deletions mocks/mock_runner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions scripts/10-dbupgrade-v1v2/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/10-dbupgrade-v1v2/storageos_dbupgrade_v1v2

This file was deleted.

0 comments on commit 18be8b5

Please sign in to comment.