diff --git a/deploy/gk-deploy b/deploy/gk-deploy index e3735e14..796cb6c7 100755 --- a/deploy/gk-deploy +++ b/deploy/gk-deploy @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # Copyright (c) 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -PROG="$(basename "${0}")" -SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)" +PROG="$(/usr/bin/basename "${0}")" +SCRIPT_DIR="$(cd "$(/usr/bin/dirname "${0}")" && pwd)" TOPOLOGY='topology.json' LOG_FILE='' VERBOSE=0 @@ -574,7 +574,7 @@ if [[ ! -f ${TOPOLOGY} ]]; then echo "Topology File not found!" exit 1 else - NODES=$(python - </dev/null | awk '{print $3}') - oc=$(type oc 2>/dev/null | awk '{print $3}') + kubectl=$(type kubectl 2>/dev/null | /usr/bin/awk '{print $3}') + oc=$(type oc 2>/dev/null | /usr/bin/awk '{print $3}') if [[ "x${oc}" != "x" ]]; then CLI="${oc}" elif [[ "x${kubectl}" != "x" ]]; then @@ -921,7 +921,7 @@ while [[ "x${heketi_service}" == "x" ]] || [[ "${heketi_service}" == "" ]] heketi_service=$(${CLI} describe svc/heketi | grep "Endpoints:" | awk '{print $2}') done -heketi_pod=$(${CLI} get pod --no-headers --show-all --selector="heketi" | awk '{print $1}') +heketi_pod=$(${CLI} get pod --no-headers --selector="heketi" | awk '{print $1}') if [[ "${CLI}" == *oc\ * ]]; then heketi_service=$(${CLI} describe routes/heketi | grep "Requested Host:" | awk '{print $3}') @@ -938,21 +938,22 @@ if [[ "${hello}" != "Hello from Heketi" ]]; then exit 1 else debug "OK" + clear output " heketi is now running and accessible via http://${heketi_service} . To run administrative commands you can install 'heketi-cli' and use it as follows: - # heketi-cli -s http://${heketi_service} --user admin --secret '' cluster list + # heketi-cli -s http://${heketi_service} --user admin --secret '${ADMIN_KEY}' cluster list You can find it at https://github.com/heketi/heketi/releases . Alternatively, use it from within the heketi pod: - # ${CLI} exec -i ${heketi_pod} -- heketi-cli -s http://localhost:8080 --user admin --secret '' cluster list + # ${CLI} exec -i ${heketi_pod} -- heketi-cli -s http://localhost:8080 --user admin --secret '${ADMIN_KEY}' cluster list For dynamic provisioning, create a StorageClass similar to this: --- -apiVersion: storage.k8s.io/v1beta1 +apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: glusterfs-storage diff --git a/deploy/kube-templates/deploy-heketi-deployment.yaml b/deploy/kube-templates/deploy-heketi-deployment.yaml index 94f2cf7d..e8a7938b 100644 --- a/deploy/kube-templates/deploy-heketi-deployment.yaml +++ b/deploy/kube-templates/deploy-heketi-deployment.yaml @@ -17,7 +17,7 @@ spec: targetPort: 8080 --- kind: Deployment -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 metadata: name: deploy-heketi labels: @@ -26,6 +26,10 @@ metadata: annotations: description: Defines how to deploy Heketi spec: + selector: + matchLabels: + glusterfs: heketi-pod + deploy-heketi: pod replicas: 1 template: metadata: diff --git a/deploy/kube-templates/gluster-s3-template.yaml b/deploy/kube-templates/gluster-s3-template.yaml index 60045bc1..17bb941c 100644 --- a/deploy/kube-templates/gluster-s3-template.yaml +++ b/deploy/kube-templates/gluster-s3-template.yaml @@ -21,7 +21,7 @@ items: status: loadBalancer: {} - kind: Deployment - apiVersion: extensions/v1beta1 + apiVersion: apps/v1 metadata: name: gluster-s3-deployment labels: @@ -30,6 +30,9 @@ items: annotations: description: Defines how to deploy gluster s3 object storage spec: + selector: + matchLabels: + glusterfs: s3-pod replicas: 1 template: metadata: diff --git a/deploy/kube-templates/glusterfs-daemonset.yaml b/deploy/kube-templates/glusterfs-daemonset.yaml index c37a5f41..5f37d67a 100644 --- a/deploy/kube-templates/glusterfs-daemonset.yaml +++ b/deploy/kube-templates/glusterfs-daemonset.yaml @@ -1,6 +1,6 @@ --- kind: DaemonSet -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 metadata: name: glusterfs labels: @@ -9,6 +9,10 @@ metadata: description: GlusterFS DaemonSet tags: glusterfs spec: + selector: + matchLabels: + glusterfs: pod + glusterfs-node: pod template: metadata: name: glusterfs diff --git a/deploy/kube-templates/heketi-deployment.yaml b/deploy/kube-templates/heketi-deployment.yaml index ecc6cefa..9d252141 100644 --- a/deploy/kube-templates/heketi-deployment.yaml +++ b/deploy/kube-templates/heketi-deployment.yaml @@ -17,7 +17,7 @@ spec: targetPort: 8080 --- kind: Deployment -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 metadata: name: heketi labels: @@ -26,6 +26,9 @@ metadata: annotations: description: Defines how to deploy Heketi spec: + selector: + matchLabels: + glusterfs: heketi-pod replicas: 1 template: metadata: diff --git a/tests/simple/gk-deploy/test_gk_deploy_basic.sh b/tests/simple/gk-deploy/test_gk_deploy_basic.sh index e359176b..b7a668df 100755 --- a/tests/simple/gk-deploy/test_gk_deploy_basic.sh +++ b/tests/simple/gk-deploy/test_gk_deploy_basic.sh @@ -8,6 +8,7 @@ BASE_DIR="${SCRIPT_DIR}/../../.." DEPLOY_DIR="${BASE_DIR}/deploy" GK_DEPLOY="${DEPLOY_DIR}/gk-deploy" +MANDATORY_OPTS="--admin-key 'key' --user-key 'key'" TOPOLOGY="${DEPLOY_DIR}/topology.json.sample" PATH="${STUBS_DIR}:$PATH" @@ -18,10 +19,10 @@ source "${INC_DIR}/shell_tests.sh" test_missing_topology () { local args=( -y ) - OUT=$("${GK_DEPLOY}" "${args[@]}") + OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}") local rc=${?} - echo "cmd: '${GK_DEPLOY} ${args[*]}'" + echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]}'" echo "output:" echo "${OUT}" @@ -37,10 +38,10 @@ test_cli_not_found () { local args=( -y ) local expected_out="Container platform CLI (e.g. kubectl, oc) not found." - OUT=$(PATH='/doesnotexist' "${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}") + OUT=$(PATH='/doesnotexist' "${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}") local rc=${?} - echo "cmd: 'PATH='/doesnotexist' ${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'" + echo "cmd: 'PATH='/doesnotexist' ${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'" echo "output:" echo "${OUT}" @@ -68,10 +69,10 @@ test_cli_unknown () { local args=( -y -c "${cli}" ) local expected_out="Unknown CLI '${cli}'." - OUT=$("${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}") + OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}") local rc=${?} - echo "cmd: '${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'" + echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'" echo "output:" echo "${OUT}" @@ -99,10 +100,10 @@ test_namespace_invalid () { local expected_out="Namespace 'invalid' not found" # shellcheck disable=SC2086 - OUT=$("${GK_DEPLOY}" "${args[@]}" "${TOPOLOGY}") + OUT=$("${GK_DEPLOY}" "${MANDATORY_OPTS}" "${args[@]}" "${TOPOLOGY}") local rc=${?} - echo "cmd: '${GK_DEPLOY} ${args[*]} ${TOPOLOGY}'" + echo "cmd: '${GK_DEPLOY} ${MANDATORY_OPTS} ${args[*]} ${TOPOLOGY}'" echo "output:" echo "${OUT}"