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

Commit 35c6f3a

Browse files
authored
Merge pull request #200 from obnoxxx/resurrect-deploy-heketi
Resurrect the deploy-heketi deployment scheme.
2 parents c679d66 + 1c4c74c commit 35c6f3a

File tree

5 files changed

+243
-37
lines changed

5 files changed

+243
-37
lines changed

deploy/gk-deploy

+59-8
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@ eval_output() {
131131
abort() {
132132
${CLI} delete svc heketi
133133
${CLI} delete sa heketi-service-account
134+
${CLI} delete all,service,jobs,deployment,secret --selector="deploy-heketi"
135+
${CLI} delete svc/heketi-storage-endpoints
134136
if [[ "${CLI}" == *oc\ * ]]; then
135137
${CLI} delete dc,route heketi
138+
${CLI} delete template deploy-heketi
136139
${CLI} delete template heketi
137140
else
138141
${CLI} delete deployment heketi
@@ -410,6 +413,7 @@ if [[ ${LOAD} -eq 0 ]]; then
410413
fi
411414
output "OK"
412415
if [[ "${CLI}" == *oc\ * ]]; then
416+
eval_output "${CLI} create -f ${TEMPLATES}/deploy-heketi-template.yaml 2>&1"
413417
eval_output "${CLI} create -f ${TEMPLATES}/heketi-service-account.yaml 2>&1"
414418
eval_output "${CLI} create -f ${TEMPLATES}/heketi-template.yaml 2>&1"
415419
if [[ $GLUSTER -eq 1 ]]; then
@@ -445,13 +449,13 @@ fi
445449

446450
if [[ ${LOAD} -eq 0 ]]; then
447451
if [[ "${CLI}" == *oc\ * ]]; then
448-
eval_output "${CLI} process heketi | ${CLI} create -f - 2>&1"
452+
eval_output "${CLI} process deploy-heketi | ${CLI} create -f - 2>&1"
449453
else
450-
eval_output "${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml 2>&1"
454+
eval_output "${CLI} create -f ${TEMPLATES}/deploy-heketi-deployment.yaml 2>&1"
451455
fi
452456
fi
453457

454-
output -n "Waiting for heketi pod to start ... "
458+
output -n "Waiting for deploy-heketi pod to start ... "
455459
check_pods "glusterfs=heketi-pod"
456460
if [[ $? -ne 0 ]]; then
457461
output "pods not found."
@@ -463,23 +467,21 @@ heketi_service=""
463467
debug -n "Determining heketi service URL ... "
464468
while [[ "x${heketi_service}" == "x" ]]; do
465469
if [[ "${CLI}" == *oc\ * ]]; then
466-
heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}')
470+
heketi_service=$(${CLI} describe routes/deploy-heketi | grep "Requested Host:" | awk '{print $3}')
467471
else
468-
heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}')
472+
heketi_service=$(${CLI} describe svc/deploy-heketi | grep "Endpoints:" | awk '{print $2}')
469473
fi
470474
sleep 1
471475
done
472476
debug "OK"
473477

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

485487
load_temp=$(mktemp)
@@ -498,4 +500,53 @@ else
498500
output "heketi topology loaded."
499501
fi
500502

503+
eval_output "heketi-cli -s http://${heketi_service} setup-openshift-heketi-storage 2>&1"
504+
if [[ ${?} != 0 ]]; then
505+
output "Failed on setup openshift heketi storage"
506+
exit 1
507+
fi
508+
509+
if [[ ! -f heketi-storage.json ]]; then
510+
output "heketi-storage.json file not found"
511+
exit 1
512+
fi
513+
eval_output "${CLI} create -f heketi-storage.json 2>&1"
514+
515+
check_pods "job-name=heketi-storage-copy-job" "Completed"
516+
517+
eval_output "${CLI} delete all,service,jobs,deployment,secret --selector=\"deploy-heketi\" 2>&1"
518+
519+
if [[ "${CLI}" == *oc\ * ]]; then
520+
eval_output "${CLI} process heketi | ${CLI} create -f - 2>&1"
521+
else
522+
eval_output "${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml 2>&1"
523+
fi
524+
525+
output -n "Waiting for heketi pod to start ... "
526+
check_pods "glusterfs=heketi-pod"
527+
output "OK"
528+
529+
heketi_service=""
530+
debug -n "Determining heketi service URL ... "
531+
while [[ "x${heketi_service}" == "x" ]]; do
532+
if [[ "${CLI}" == *oc\ * ]]; then
533+
heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}')
534+
else
535+
heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}')
536+
fi
537+
sleep 1
538+
done
539+
debug "OK"
540+
541+
hello=$(curl http://${heketi_service}/hello 2>/dev/null)
542+
if [[ "${hello}" != "Hello from Heketi" ]]; then
543+
output "Failed to communicate with heketi service."
544+
if [[ "${CLI}" == *oc\ * ]]; then
545+
output "Please verify that a router has been properly configured."
546+
fi
547+
abort
548+
else
549+
output "heketi is now running."
550+
fi
551+
501552
output "Ready to create and provide GlusterFS volumes."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
kind: Service
3+
apiVersion: v1
4+
metadata:
5+
name: deploy-heketi
6+
labels:
7+
glusterfs: heketi-service
8+
deploy-heketi: support
9+
annotations:
10+
description: Exposes Heketi Service
11+
spec:
12+
selector:
13+
name: deploy-heketi
14+
ports:
15+
- name: deploy-heketi
16+
port: 8080
17+
targetPort: 8080
18+
---
19+
kind: Deployment
20+
apiVersion: extensions/v1beta1
21+
metadata:
22+
name: deploy-heketi
23+
labels:
24+
glusterfs: heketi-deployment
25+
deploy-heketi: heketi-deployment
26+
annotations:
27+
description: Defines how to deploy Heketi
28+
spec:
29+
replicas: 1
30+
template:
31+
metadata:
32+
name: deploy-heketi
33+
labels:
34+
name: deploy-heketi
35+
glusterfs: heketi-pod
36+
spec:
37+
serviceAccountName: heketi-service-account
38+
containers:
39+
- image: heketi/heketi:dev
40+
imagePullPolicy: IfNotPresent
41+
name: deploy-heketi
42+
env:
43+
- name: HEKETI_EXECUTOR
44+
value: kubernetes
45+
- name: HEKETI_FSTAB
46+
value: "/var/lib/heketi/fstab"
47+
- name: HEKETI_SNAPSHOT_LIMIT
48+
value: '14'
49+
- name: HEKETI_KUBE_GLUSTER_DAEMONSET
50+
value: "y"
51+
ports:
52+
- containerPort: 8080
53+
volumeMounts:
54+
- name: db
55+
mountPath: "/var/lib/heketi"
56+
readinessProbe:
57+
timeoutSeconds: 3
58+
initialDelaySeconds: 3
59+
httpGet:
60+
path: "/hello"
61+
port: 8080
62+
livenessProbe:
63+
timeoutSeconds: 3
64+
initialDelaySeconds: 30
65+
httpGet:
66+
path: "/hello"
67+
port: 8080
68+
volumes:
69+
- name: db

deploy/kube-templates/heketi-deployment.yaml

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
---
2-
kind: Secret
3-
apiVersion: v1
4-
metadata:
5-
name: heketi-db-backup
6-
labels:
7-
glusterfs: heketi-db
8-
data:
9-
heketi.db: ''
10-
type: Opaque
11-
---
122
kind: Service
133
apiVersion: v1
144
metadata:
@@ -60,8 +50,6 @@ spec:
6050
volumeMounts:
6151
- name: db
6252
mountPath: "/var/lib/heketi"
63-
- name: heketi-db-secret
64-
mountPath: "/backupdb"
6553
readinessProbe:
6654
timeoutSeconds: 3
6755
initialDelaySeconds: 3
@@ -76,6 +64,6 @@ spec:
7664
port: 8080
7765
volumes:
7866
- name: db
79-
- name: heketi-db-secret
80-
secret:
81-
secretName: heketi-db-backup
67+
glusterfs:
68+
endpoints: heketi-storage-endpoints
69+
path: heketidbstorage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
kind: Template
3+
apiVersion: v1
4+
metadata:
5+
name: deploy-heketi
6+
labels:
7+
glusterfs: heketi-template
8+
deploy-heketi: support
9+
annotations:
10+
description: Bootstrap Heketi installation
11+
tags: glusterfs,heketi,installation
12+
labels:
13+
template: deploy-heketi
14+
objects:
15+
- kind: Service
16+
apiVersion: v1
17+
metadata:
18+
name: deploy-heketi
19+
labels:
20+
glusterfs: heketi-service
21+
deploy-heketi: support
22+
annotations:
23+
description: Exposes Heketi service
24+
spec:
25+
ports:
26+
- name: deploy-heketi
27+
port: 8080
28+
targetPort: 8080
29+
selector:
30+
name: deploy-heketi
31+
- kind: Route
32+
apiVersion: v1
33+
metadata:
34+
name: deploy-heketi
35+
labels:
36+
glusterfs: heketi-route
37+
deploy-heketi: support
38+
spec:
39+
to:
40+
kind: Service
41+
name: deploy-heketi
42+
- kind: DeploymentConfig
43+
apiVersion: v1
44+
metadata:
45+
name: deploy-heketi
46+
labels:
47+
glusterfs: heketi-dc
48+
deploy-heketi: support
49+
annotations:
50+
description: Defines how to deploy Heketi
51+
spec:
52+
replicas: 1
53+
selector:
54+
name: deploy-heketi
55+
triggers:
56+
- type: ConfigChange
57+
strategy:
58+
type: Recreate
59+
template:
60+
metadata:
61+
name: deploy-heketi
62+
labels:
63+
name: deploy-heketi
64+
glusterfs: heketi-pod
65+
deploy-heketi: support
66+
spec:
67+
serviceAccountName: heketi-service-account
68+
containers:
69+
- name: deploy-heketi
70+
image: heketi/heketi:dev
71+
env:
72+
- name: HEKETI_USER_KEY
73+
value: ${HEKETI_USER_KEY}
74+
- name: HEKETI_ADMIN_KEY
75+
value: ${HEKETI_ADMIN_KEY}
76+
- name: HEKETI_EXECUTOR
77+
value: kubernetes
78+
- name: HEKETI_FSTAB
79+
value: /var/lib/heketi/fstab
80+
- name: HEKETI_SNAPSHOT_LIMIT
81+
value: '14'
82+
- name: HEKETI_KUBE_GLUSTER_DAEMONSET
83+
value: "y"
84+
ports:
85+
- containerPort: 8080
86+
volumeMounts:
87+
- name: db
88+
mountPath: /var/lib/heketi
89+
readinessProbe:
90+
timeoutSeconds: 3
91+
initialDelaySeconds: 3
92+
httpGet:
93+
path: /hello
94+
port: 8080
95+
livenessProbe:
96+
timeoutSeconds: 3
97+
initialDelaySeconds: 30
98+
httpGet:
99+
path: /hello
100+
port: 8080
101+
volumes:
102+
- name: db
103+
parameters:
104+
- name: HEKETI_USER_KEY
105+
displayName: Heketi User Secret
106+
description: Set secret for those creating volumes as type _user_
107+
- name: HEKETI_ADMIN_KEY
108+
displayName: Heketi Administrator Secret
109+
description: Set secret for administration of the Heketi service as user _admin_

deploy/ocp-templates/heketi-template.yaml

+3-14
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ metadata:
1111
labels:
1212
template: heketi
1313
objects:
14-
- kind: Secret
15-
apiVersion: v1
16-
metadata:
17-
name: heketi-db-backup
18-
labels:
19-
glusterfs: heketi-db
20-
data:
21-
heketi.db: ''
22-
type: Opaque
2314
- kind: Service
2415
apiVersion: v1
2516
metadata:
@@ -90,8 +81,6 @@ objects:
9081
volumeMounts:
9182
- name: db
9283
mountPath: /var/lib/heketi
93-
- name: heketi-db-secret
94-
mountPath: /backupdb
9584
readinessProbe:
9685
timeoutSeconds: 3
9786
initialDelaySeconds: 3
@@ -106,9 +95,9 @@ objects:
10695
port: 8080
10796
volumes:
10897
- name: db
109-
- name: heketi-db-secret
110-
secret:
111-
secretName: heketi-db-backup
98+
glusterfs:
99+
endpoints: heketi-storage-endpoints
100+
path: heketidbstorage
112101
parameters:
113102
- name: HEKETI_USER_KEY
114103
displayName: Heketi User Secret

0 commit comments

Comments
 (0)