diff --git a/deploy/gk-deploy b/deploy/gk-deploy index 68a25932..f50a820e 100755 --- a/deploy/gk-deploy +++ b/deploy/gk-deploy @@ -117,12 +117,10 @@ debug() { } abort() { - ${CLI} delete all,service,jobs,deployment,secret --selector="deploy-heketi" ${CLI} delete dc,svc,routes heketi - ${CLI} delete svc/heketi-storage-endpoints ${CLI} delete sa heketi-service-account - if [[ "${CLI}" == *oc ]]; then - ${CLI} delete template deploy-heketi + ${CLI} delete secret heketi-db-backup + if [[ "${CLI}" == *oc\ * ]]; then ${CLI} delete template heketi fi if [[ ${GLUSTER} -eq 1 ]]; then @@ -131,7 +129,7 @@ abort() { ${CLI} label nodes ${node} storagenode- done <<< "$(echo -e "${NODES}")" ${CLI} delete all,service,jobs,ds,secret --selector="glusterfs" - if [[ "${CLI}" == *oc ]]; then + if [[ "${CLI}" == *oc\ * ]]; then ${CLI} delete template glusterfs fi fi @@ -386,8 +384,7 @@ if [[ ${ABORT} -eq 1 ]]; then fi if [[ ${LOAD} -eq 0 ]]; then - if [[ "${CLI}" == *oc ]]; then - ${CLI} create -f ${TEMPLATES}/deploy-heketi-template.yaml + if [[ "${CLI}" == *oc\ * ]]; then ${CLI} create -f ${TEMPLATES}/heketi-service-account.yaml ${CLI} create -f ${TEMPLATES}/heketi-template.yaml if [[ $GLUSTER -eq 1 ]]; then @@ -406,7 +403,7 @@ if [[ $GLUSTER -eq 1 ]] && [[ ${LOAD} -eq 0 ]]; then ${CLI} label nodes ${node} storagenode=glusterfs done <<< "$(echo -e "${NODES}")" debug "Deploying GlusterFS pods." - if [[ "${CLI}" == *oc ]]; then + if [[ "${CLI}" == *oc\ * ]]; then ${CLI} process glusterfs | ${CLI} create -f - else ${CLI} create -f ${TEMPLATES}/glusterfs-daemonset.yaml @@ -418,24 +415,24 @@ if [[ $GLUSTER -eq 1 ]] && [[ ${LOAD} -eq 0 ]]; then fi if [[ ${LOAD} -eq 0 ]]; then - if [[ "${CLI}" == *oc ]]; then - ${CLI} process deploy-heketi | ${CLI} create -f - + if [[ "${CLI}" == *oc\ * ]]; then + ${CLI} process heketi | ${CLI} create -f - else - ${CLI} create -f ${TEMPLATES}/deploy-heketi-deployment.yaml + ${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml fi fi -output -n "Waiting for deploy-heketi pod to start ... " +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/deploy-heketi | grep "Requested Host:" | awk '{print $3}') + if [[ "${CLI}" == *oc\ * ]]; then + heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}') else - heketi_service=$(${CLI} describe svc/deploy-heketi | grep "Endpoints:" | awk '{print $2}') + heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}') fi sleep 1 done @@ -443,11 +440,13 @@ debug "OK" hello=$(curl http://${heketi_service}/hello 2>/dev/null) if [[ "${hello}" != "Hello from Heketi" ]]; then - output "Failed to communicate with deploy-heketi service." - if [[ "${CLI}" == *oc ]]; 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 tload=$(heketi-cli -s http://${heketi_service} topology load --json=${TOPOLOGY} 2>&1) @@ -462,52 +461,3 @@ else exit 1 fi fi - -heketi-cli -s http://${heketi_service} setup-openshift-heketi-storage -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 -${CLI} create -f heketi-storage.json - -check_pods "job-name=heketi-storage-copy-job" "Completed" - -${CLI} delete all,service,jobs,deployment,secret --selector="deploy-heketi" - -if [[ "${CLI}" == *oc ]]; then - ${CLI} process heketi | ${CLI} create -f - -else - ${CLI} create -f ${TEMPLATES}/heketi-deployment.yaml -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 diff --git a/deploy/kube-templates/deploy-heketi-deployment.yaml b/deploy/kube-templates/deploy-heketi-deployment.yaml deleted file mode 100644 index adfeb5e1..00000000 --- a/deploy/kube-templates/deploy-heketi-deployment.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -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_KUBE_USE_SECRET - value: "y" - - 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 diff --git a/deploy/kube-templates/heketi-deployment.yaml b/deploy/kube-templates/heketi-deployment.yaml index d77a50a0..2247c941 100644 --- a/deploy/kube-templates/heketi-deployment.yaml +++ b/deploy/kube-templates/heketi-deployment.yaml @@ -1,4 +1,14 @@ --- +kind: Secret +apiVersion: v1 +metadata: + name: heketi-db-backup + labels: + glusterfs: heketi-db + data: + heketi.db: '' + type: Opaque +--- kind: Service apiVersion: v1 metadata: @@ -41,8 +51,6 @@ spec: env: - name: HEKETI_EXECUTOR value: kubernetes - - name: HEKETI_KUBE_USE_SECRET - value: "y" - name: HEKETI_FSTAB value: "/var/lib/heketi/fstab" - name: HEKETI_SNAPSHOT_LIMIT @@ -54,6 +62,8 @@ spec: volumeMounts: - name: db mountPath: "/var/lib/heketi" + - name: heketi-db-secret + mountPath: "/backupdb" readinessProbe: timeoutSeconds: 3 initialDelaySeconds: 3 @@ -68,6 +78,6 @@ spec: port: 8080 volumes: - name: db - glusterfs: - endpoints: heketi-storage-endpoints - path: heketidbstorage + - name: heketi-db-secret + secret: + secretName: heketi-db-backup diff --git a/deploy/ocp-templates/deploy-heketi-template.yaml b/deploy/ocp-templates/deploy-heketi-template.yaml deleted file mode 100644 index 46b9c256..00000000 --- a/deploy/ocp-templates/deploy-heketi-template.yaml +++ /dev/null @@ -1,116 +0,0 @@ ---- -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_KUBE_USE_SECRET - value: "y" - - name: HEKETI_FSTAB - value: /var/lib/heketi/fstab - - name: HEKETI_SNAPSHOT_LIMIT - value: '14' - - name: HEKETI_KUBE_CERTFILE - value: ${HEKETI_KUBE_CERTFILE} - - 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_ -- name: HEKETI_KUBE_CERTFILE - displayName: Certificate file - description: Container path to Kubernetes certificate file diff --git a/deploy/ocp-templates/heketi-template.yaml b/deploy/ocp-templates/heketi-template.yaml index 5275ecf3..7c8d2318 100644 --- a/deploy/ocp-templates/heketi-template.yaml +++ b/deploy/ocp-templates/heketi-template.yaml @@ -11,6 +11,15 @@ 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: @@ -71,14 +80,10 @@ objects: value: ${HEKETI_ADMIN_KEY} - name: HEKETI_EXECUTOR value: kubernetes - - name: HEKETI_KUBE_USE_SECRET - value: "y" - name: HEKETI_FSTAB value: /var/lib/heketi/fstab - name: HEKETI_SNAPSHOT_LIMIT value: '14' - - name: HEKETI_KUBE_CERTFILE - value: ${HEKETI_KUBE_CERTFILE} - name: HEKETI_KUBE_GLUSTER_DAEMONSET value: "y" ports: @@ -86,6 +91,8 @@ objects: volumeMounts: - name: db mountPath: /var/lib/heketi + - name: heketi-db-secret + mountPath: /backupdb readinessProbe: timeoutSeconds: 3 initialDelaySeconds: 3 @@ -100,9 +107,9 @@ objects: port: 8080 volumes: - name: db - glusterfs: - endpoints: heketi-storage-endpoints - path: heketidbstorage + - name: heketi-db-secret + secret: + secretName: heketi-db-backup parameters: - name: HEKETI_USER_KEY displayName: Heketi User Secret @@ -110,6 +117,3 @@ parameters: - name: HEKETI_ADMIN_KEY displayName: Heketi Administrator Secret description: Set secret for administration of the Heketi service as user _admin_ -- name: HEKETI_KUBE_CERTFILE - displayName: Certificate file - description: Container path to Kubernetes certificate file