Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #200 from obnoxxx/resurrect-deploy-heketi
Browse files Browse the repository at this point in the history
Resurrect the deploy-heketi deployment scheme.
  • Loading branch information
obnoxxx committed Mar 15, 2017
2 parents c679d66 + 1c4c74c commit 35c6f3a
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 37 deletions.
67 changes: 59 additions & 8 deletions deploy/gk-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ eval_output() {
abort() {
${CLI} delete svc heketi
${CLI} delete sa heketi-service-account
${CLI} delete all,service,jobs,deployment,secret --selector="deploy-heketi"
${CLI} delete svc/heketi-storage-endpoints
if [[ "${CLI}" == *oc\ * ]]; then
${CLI} delete dc,route heketi
${CLI} delete template deploy-heketi
${CLI} delete template heketi
else
${CLI} delete deployment heketi
Expand Down Expand Up @@ -410,6 +413,7 @@ if [[ ${LOAD} -eq 0 ]]; then
fi
output "OK"
if [[ "${CLI}" == *oc\ * ]]; then
eval_output "${CLI} create -f ${TEMPLATES}/deploy-heketi-template.yaml 2>&1"
eval_output "${CLI} create -f ${TEMPLATES}/heketi-service-account.yaml 2>&1"
eval_output "${CLI} create -f ${TEMPLATES}/heketi-template.yaml 2>&1"
if [[ $GLUSTER -eq 1 ]]; then
Expand Down Expand Up @@ -445,13 +449,13 @@ fi

if [[ ${LOAD} -eq 0 ]]; then
if [[ "${CLI}" == *oc\ * ]]; then
eval_output "${CLI} process heketi | ${CLI} create -f - 2>&1"
eval_output "${CLI} process deploy-heketi | ${CLI} create -f - 2>&1"
else
eval_output "${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml 2>&1"
eval_output "${CLI} create -f ${TEMPLATES}/deploy-heketi-deployment.yaml 2>&1"
fi
fi

output -n "Waiting for heketi pod to start ... "
output -n "Waiting for deploy-heketi pod to start ... "
check_pods "glusterfs=heketi-pod"
if [[ $? -ne 0 ]]; then
output "pods not found."
Expand All @@ -463,23 +467,21 @@ heketi_service=""
debug -n "Determining heketi service URL ... "
while [[ "x${heketi_service}" == "x" ]]; do
if [[ "${CLI}" == *oc\ * ]]; then
heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}')
heketi_service=$(${CLI} describe routes/deploy-heketi | grep "Requested Host:" | awk '{print $3}')
else
heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}')
heketi_service=$(${CLI} describe svc/deploy-heketi | grep "Endpoints:" | awk '{print $2}')
fi
sleep 1
done
debug "OK"

hello=$(curl http://${heketi_service}/hello 2>/dev/null)
if [[ "${hello}" != "Hello from Heketi" ]]; then
output "Failed to communicate with heketi service."
output "Failed to communicate with deploy-heketi service."
if [[ "${CLI}" == *oc\ * ]]; then
output "Please verify that a router has been properly configured."
fi
abort
else
output "heketi is now running."
fi

load_temp=$(mktemp)
Expand All @@ -498,4 +500,53 @@ else
output "heketi topology loaded."
fi

eval_output "heketi-cli -s http://${heketi_service} setup-openshift-heketi-storage 2>&1"
if [[ ${?} != 0 ]]; then
output "Failed on setup openshift heketi storage"
exit 1
fi

if [[ ! -f heketi-storage.json ]]; then
output "heketi-storage.json file not found"
exit 1
fi
eval_output "${CLI} create -f heketi-storage.json 2>&1"

check_pods "job-name=heketi-storage-copy-job" "Completed"

eval_output "${CLI} delete all,service,jobs,deployment,secret --selector=\"deploy-heketi\" 2>&1"

if [[ "${CLI}" == *oc\ * ]]; then
eval_output "${CLI} process heketi | ${CLI} create -f - 2>&1"
else
eval_output "${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml 2>&1"
fi

output -n "Waiting for heketi pod to start ... "
check_pods "glusterfs=heketi-pod"
output "OK"

heketi_service=""
debug -n "Determining heketi service URL ... "
while [[ "x${heketi_service}" == "x" ]]; do
if [[ "${CLI}" == *oc\ * ]]; then
heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}')
else
heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}')
fi
sleep 1
done
debug "OK"

hello=$(curl http://${heketi_service}/hello 2>/dev/null)
if [[ "${hello}" != "Hello from Heketi" ]]; then
output "Failed to communicate with heketi service."
if [[ "${CLI}" == *oc\ * ]]; then
output "Please verify that a router has been properly configured."
fi
abort
else
output "heketi is now running."
fi

output "Ready to create and provide GlusterFS volumes."
69 changes: 69 additions & 0 deletions deploy/kube-templates/deploy-heketi-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
kind: Service
apiVersion: v1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-service
deploy-heketi: support
annotations:
description: Exposes Heketi Service
spec:
selector:
name: deploy-heketi
ports:
- name: deploy-heketi
port: 8080
targetPort: 8080
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-deployment
deploy-heketi: heketi-deployment
annotations:
description: Defines how to deploy Heketi
spec:
replicas: 1
template:
metadata:
name: deploy-heketi
labels:
name: deploy-heketi
glusterfs: heketi-pod
spec:
serviceAccountName: heketi-service-account
containers:
- image: heketi/heketi:dev
imagePullPolicy: IfNotPresent
name: deploy-heketi
env:
- name: HEKETI_EXECUTOR
value: kubernetes
- name: HEKETI_FSTAB
value: "/var/lib/heketi/fstab"
- name: HEKETI_SNAPSHOT_LIMIT
value: '14'
- name: HEKETI_KUBE_GLUSTER_DAEMONSET
value: "y"
ports:
- containerPort: 8080
volumeMounts:
- name: db
mountPath: "/var/lib/heketi"
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
httpGet:
path: "/hello"
port: 8080
livenessProbe:
timeoutSeconds: 3
initialDelaySeconds: 30
httpGet:
path: "/hello"
port: 8080
volumes:
- name: db
18 changes: 3 additions & 15 deletions deploy/kube-templates/heketi-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
kind: Secret
apiVersion: v1
metadata:
name: heketi-db-backup
labels:
glusterfs: heketi-db
data:
heketi.db: ''
type: Opaque
---
kind: Service
apiVersion: v1
metadata:
Expand Down Expand Up @@ -60,8 +50,6 @@ spec:
volumeMounts:
- name: db
mountPath: "/var/lib/heketi"
- name: heketi-db-secret
mountPath: "/backupdb"
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
Expand All @@ -76,6 +64,6 @@ spec:
port: 8080
volumes:
- name: db
- name: heketi-db-secret
secret:
secretName: heketi-db-backup
glusterfs:
endpoints: heketi-storage-endpoints
path: heketidbstorage
109 changes: 109 additions & 0 deletions deploy/ocp-templates/deploy-heketi-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
kind: Template
apiVersion: v1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-template
deploy-heketi: support
annotations:
description: Bootstrap Heketi installation
tags: glusterfs,heketi,installation
labels:
template: deploy-heketi
objects:
- kind: Service
apiVersion: v1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-service
deploy-heketi: support
annotations:
description: Exposes Heketi service
spec:
ports:
- name: deploy-heketi
port: 8080
targetPort: 8080
selector:
name: deploy-heketi
- kind: Route
apiVersion: v1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-route
deploy-heketi: support
spec:
to:
kind: Service
name: deploy-heketi
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: deploy-heketi
labels:
glusterfs: heketi-dc
deploy-heketi: support
annotations:
description: Defines how to deploy Heketi
spec:
replicas: 1
selector:
name: deploy-heketi
triggers:
- type: ConfigChange
strategy:
type: Recreate
template:
metadata:
name: deploy-heketi
labels:
name: deploy-heketi
glusterfs: heketi-pod
deploy-heketi: support
spec:
serviceAccountName: heketi-service-account
containers:
- name: deploy-heketi
image: heketi/heketi:dev
env:
- name: HEKETI_USER_KEY
value: ${HEKETI_USER_KEY}
- name: HEKETI_ADMIN_KEY
value: ${HEKETI_ADMIN_KEY}
- name: HEKETI_EXECUTOR
value: kubernetes
- name: HEKETI_FSTAB
value: /var/lib/heketi/fstab
- name: HEKETI_SNAPSHOT_LIMIT
value: '14'
- name: HEKETI_KUBE_GLUSTER_DAEMONSET
value: "y"
ports:
- containerPort: 8080
volumeMounts:
- name: db
mountPath: /var/lib/heketi
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
httpGet:
path: /hello
port: 8080
livenessProbe:
timeoutSeconds: 3
initialDelaySeconds: 30
httpGet:
path: /hello
port: 8080
volumes:
- name: db
parameters:
- name: HEKETI_USER_KEY
displayName: Heketi User Secret
description: Set secret for those creating volumes as type _user_
- name: HEKETI_ADMIN_KEY
displayName: Heketi Administrator Secret
description: Set secret for administration of the Heketi service as user _admin_
17 changes: 3 additions & 14 deletions deploy/ocp-templates/heketi-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ metadata:
labels:
template: heketi
objects:
- kind: Secret
apiVersion: v1
metadata:
name: heketi-db-backup
labels:
glusterfs: heketi-db
data:
heketi.db: ''
type: Opaque
- kind: Service
apiVersion: v1
metadata:
Expand Down Expand Up @@ -90,8 +81,6 @@ objects:
volumeMounts:
- name: db
mountPath: /var/lib/heketi
- name: heketi-db-secret
mountPath: /backupdb
readinessProbe:
timeoutSeconds: 3
initialDelaySeconds: 3
Expand All @@ -106,9 +95,9 @@ objects:
port: 8080
volumes:
- name: db
- name: heketi-db-secret
secret:
secretName: heketi-db-backup
glusterfs:
endpoints: heketi-storage-endpoints
path: heketidbstorage
parameters:
- name: HEKETI_USER_KEY
displayName: Heketi User Secret
Expand Down

0 comments on commit 35c6f3a

Please sign in to comment.