-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
travis(ci): adding ci for velero-plugin (#40)
Signed-off-by: mayank <[email protected]>
- Loading branch information
1 parent
71e64c7
commit e59b9c1
Showing
757 changed files
with
242,415 additions
and
2,605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The OpenEBS Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if [ -z $VELERO_RELEASE ] || [ -z $OPENEBS_RELEASE ]; then | ||
exit | ||
fi | ||
|
||
echo "Installing iscsi packages" | ||
sudo apt-get install --yes -qq open-iscsi | ||
sudo service iscsid start | ||
sudo systemctl status iscsid --no-pager | ||
echo "Installation complete" | ||
|
||
#TODO add openebs release | ||
kubectl apply -f https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-operator.yaml | ||
|
||
function waitForDeployment() { | ||
DEPLOY=$1 | ||
NS=$2 | ||
CREATE=true | ||
|
||
if [ $# -eq 3 ] && ! $3 ; then | ||
CREATE=false | ||
fi | ||
|
||
for i in $(seq 1 50) ; do | ||
kubectl get deployment -n ${NS} ${DEPLOY} | ||
kstat=$? | ||
if [ $kstat -ne 0 ] && ! $CREATE ; then | ||
return | ||
elif [ $kstat -eq 0 ] && ! $CREATE; then | ||
sleep 3 | ||
continue | ||
fi | ||
|
||
replicas=$(kubectl get deployment -n ${NS} ${DEPLOY} -o json | jq ".status.readyReplicas") | ||
if [ "$replicas" == "1" ]; then | ||
break | ||
else | ||
echo "Waiting for ${DEPLOY} to be ready" | ||
if [ ${DEPLOY} != "maya-apiserver" ] && [ ${DEPLOY} != "openebs-provisioner" ]; then | ||
dumpMayaAPIServerLogs 10 | ||
fi | ||
sleep 10 | ||
fi | ||
done | ||
} | ||
|
||
function dumpMayaAPIServerLogs() { | ||
LC=$1 | ||
MAPIPOD=$(kubectl get pods -o jsonpath='{.items[?(@.spec.containers[0].name=="maya-apiserver")].metadata.name}' -n openebs) | ||
kubectl logs --tail=${LC} $MAPIPOD -n openebs | ||
printf "\n\n" | ||
} | ||
|
||
waitForDeployment maya-apiserver openebs | ||
waitForDeployment openebs-provisioner openebs | ||
waitForDeployment openebs-ndm-operator openebs | ||
|
||
kubectl get pods --all-namespaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The OpenEBS Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if [ -z $VELERO_RELEASE ] || [ -z $OPENEBS_RELEASE ]; then | ||
exit | ||
fi | ||
|
||
function waitForDeployment() { | ||
DEPLOY=$1 | ||
NS=$2 | ||
CREATE=true | ||
|
||
if [ $# -eq 3 ] && ! $3 ; then | ||
CREATE=false | ||
fi | ||
|
||
for i in $(seq 1 50) ; do | ||
kubectl get deployment -n ${NS} ${DEPLOY} | ||
kstat=$? | ||
if [ $kstat -ne 0 ] && ! $CREATE ; then | ||
return | ||
elif [ $kstat -eq 0 ] && ! $CREATE; then | ||
sleep 3 | ||
continue | ||
fi | ||
|
||
replicas=$(kubectl get deployment -n ${NS} ${DEPLOY} -o json | jq ".status.readyReplicas") | ||
if [ "$replicas" == "1" ]; then | ||
break | ||
else | ||
echo "Waiting for ${DEPLOY} to be ready" | ||
if [ ${DEPLOY} != "maya-apiserver" ] && [ ${DEPLOY} != "openebs-provisioner" ]; then | ||
dumpMayaAPIServerLogs 10 | ||
fi | ||
sleep 10 | ||
fi | ||
done | ||
} | ||
|
||
MAPI_SVC_ADDR=`kubectl get service -n openebs maya-apiserver-service -o json | grep clusterIP | awk -F\" '{print $4}'` | ||
export MAPI_ADDR="http://${MAPI_SVC_ADDR}:5656" | ||
export KUBERNETES_SERVICE_HOST="127.0.0.1" | ||
export KUBECONFIG=$HOME/.kube/config | ||
|
||
wget -O velero.tar.gz https://github.com/heptio/velero/releases/download/${VELERO_RELEASE}/velero-${VELERO_RELEASE}-linux-amd64.tar.gz | ||
mkdir velero | ||
tar xf velero.tar.gz -C velero | ||
velero=$PWD/velero/velero-${VELERO_RELEASE}-linux-amd64/velero | ||
if [ ! -f ${velero} ]; then | ||
echo "${velero} file does not exist" | ||
exit | ||
fi | ||
|
||
if [ ! -f minio ]; then | ||
wget https://dl.min.io/server/minio/release/linux-amd64/minio | ||
fi | ||
|
||
if [ ! -f mc ]; then | ||
wget https://dl.min.io/client/mc/release/linux-amd64/mc | ||
fi | ||
chmod +x minio | ||
chmod +x mc | ||
|
||
BACKUP_DIR=$PWD/data | ||
|
||
export MINIO_ACCESS_KEY=minio | ||
export MINIO_SECRET_KEY=minio123 | ||
|
||
ip addr show docker0 >> /dev/null | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
MINIO_SERVER_IP=`ip addr show docker0 |grep docker0 |grep inet |awk -F ' ' '{print $2}' |awk -F '/' '{print $1}'` | ||
if [ $? -ne 0 ] || [ -z ${MINIO_SERVER_IP} ]; then | ||
exit 1 | ||
fi | ||
|
||
./minio server --address ${MINIO_SERVER_IP}:9000 ${BACKUP_DIR} & | ||
MINIO_PID=$! | ||
sleep 5 | ||
|
||
BUCKET=velero | ||
REGION=minio | ||
./mc config host add velero http://${MINIO_SERVER_IP}:9000 minio minio123 | ||
./mc mb -p velero/velero | ||
|
||
${velero} install \ | ||
--provider aws \ | ||
--bucket $BUCKET \ | ||
--secret-file ./script/minio-credentials \ | ||
--backup-location-config region=${REGION},s3ForcePathStyle="true",s3Url=http://${MINIO_SERVER_IP}:9000 \ | ||
--wait | ||
|
||
sed "s/MINIO_ENDPOINT/http:\/\/$MINIO_SERVER_IP\:9000/" script/volumesnapshotlocation.yaml > /tmp/s.yaml | ||
kubectl apply -f /tmp/s.yaml | ||
${velero} plugin add openebs/velero-plugin:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[default] | ||
aws_access_key_id=minio | ||
aws_secret_access_key=minio123 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
namespace: velero | ||
name: minio | ||
labels: | ||
component: minio | ||
spec: | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
component: minio | ||
spec: | ||
volumes: | ||
- name: storage | ||
emptyDir: {} | ||
- name: config | ||
emptyDir: {} | ||
containers: | ||
- name: minio | ||
image: minio/minio:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- server | ||
- /storage | ||
- --config-dir=/config | ||
env: | ||
- name: MINIO_ACCESS_KEY | ||
value: "minio" | ||
- name: MINIO_SECRET_KEY | ||
value: "minio123" | ||
ports: | ||
- containerPort: 9000 | ||
volumeMounts: | ||
- name: storage | ||
mountPath: "/storage" | ||
- name: config | ||
mountPath: "/config" | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
namespace: velero | ||
name: minio | ||
labels: | ||
component: minio | ||
spec: | ||
# ClusterIP is recommended for production environments. | ||
# Change to NodePort if needed per documentation, | ||
# but only if you run Minio in a test/trial environment, for example with Minikube. | ||
type: ClusterIP | ||
ports: | ||
- port: 9000 | ||
targetPort: 9000 | ||
protocol: TCP | ||
selector: | ||
component: minio | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
namespace: velero | ||
name: cloud-credentials | ||
labels: | ||
component: minio | ||
stringData: | ||
cloud: | | ||
[default] | ||
aws_access_key_id = minio | ||
aws_secret_access_key = minio123 | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
namespace: velero | ||
name: minio-setup | ||
labels: | ||
component: minio | ||
spec: | ||
template: | ||
metadata: | ||
name: minio-setup | ||
spec: | ||
restartPolicy: OnFailure | ||
volumes: | ||
- name: config | ||
emptyDir: {} | ||
containers: | ||
- name: mc | ||
image: minio/mc:latest | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- "mc --debug --config-dir=/config config host add velero http://minio:9000 minio minio123 && mc --config-dir=/config mb -p velero/velero" | ||
volumeMounts: | ||
- name: config | ||
mountPath: "/config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2018 the Heptio Ark contributors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
apiVersion: velero.io/v1 | ||
kind: VolumeSnapshotLocation | ||
metadata: | ||
name: default | ||
namespace: velero | ||
spec: | ||
provider: openebs.io/cstor-blockstore | ||
config: | ||
bucket: velero | ||
provider: aws | ||
region: minio | ||
s3Url: MINIO_ENDPOINT | ||
s3ForcePathStyle: "true" |
Oops, something went wrong.