Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Merge branch 'integration' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
john-a-fletcher committed Oct 20, 2021
2 parents 203e79d + 4bc9b17 commit 747096d
Show file tree
Hide file tree
Showing 12 changed files with 922 additions and 27 deletions.
7 changes: 6 additions & 1 deletion k8_cortx_cloud/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ solution:
cortxcontrol: centos:7
cortxdataprov: centos:7
cortxdata: centos:7
cortxsupport: centos:7
openldap: ghcr.io/seagate/symas-openldap:standalone
consul: hashicorp/consul:1.10.2
kafka: bitnami/kafka
zookeeper: bitnami/zookeeper
gluster: docker.io/gluster/gluster-centos
rancher: rancher/local-path-provisioner:v0.0.20
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
name: openldap-connect
containers:
- name: openldap
image: ghcr.io/seagate/symas-openldap:standalone
image: {{ .Values.openldap.image }}
imagePullPolicy: IfNotPresent
volumeMounts:
- name: etc-3rd-party
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ openldap:
storagesize: 5Gi
nodelistinfo: node-list-info.txt
numreplicas: 3
password: seagate1
password: seagate1
image: ghcr.io/seagate/symas-openldap:standalone
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
app: {{ .Values.cortxgluster.name }}
spec:
containers:
- image: docker.io/gluster/gluster-centos
- image: {{ .Values.cortxgluster.image }}
imagePullPolicy: IfNotPresent
name: {{ .Values.cortxgluster.name }}
livenessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cortxgluster:
nodename: node-1
storagesize: 1Gi
storageclass: cortx-gluster-storage
image: docker.io/gluster/gluster-centos
service:
name: cortx-gluster-svc
pv:
Expand Down
32 changes: 26 additions & 6 deletions k8_cortx_cloud/deploy-cortx-cloud.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
#!/bin/bash

solution_yaml=${1:-'solution.yaml'}
storage_class='local-path'

# Check if the file exists
if [ ! -f $solution_yaml ]
then
echo "ERROR: $solution_yaml does not exist"
exit 1
fi


# Delete old "node-list-info.txt" file
find $(pwd)/cortx-cloud-3rd-party-pkg/openldap -name "node-list-info*" -delete

Expand Down Expand Up @@ -33,12 +42,12 @@ printf "Number of worker nodes detected: $num_worker_nodes\n"

function parseSolution()
{
echo "$(./parse_scripts/parse_yaml.sh solution.yaml $1)"
echo "$(./parse_scripts/parse_yaml.sh $solution_yaml $1)"
}

function extractBlock()
{
echo "$(./parse_scripts/yaml_extract_block.sh solution.yaml $1)"
echo "$(./parse_scripts/yaml_extract_block.sh $solution_yaml $1)"
}

namespace=$(parseSolution 'solution.namespace')
Expand Down Expand Up @@ -120,7 +129,7 @@ do
if [[ "${#parsed_dev_array[@]}" != "${#parsed_size_array[@]}" ]]
then
printf "\nStorage sizes are not defined for all of the storage devices\n"
printf "in the 'solution.yaml' file\n"
printf "in the $solution_yaml file\n"
exit 1
fi

Expand Down Expand Up @@ -181,8 +190,12 @@ then
kubectl create -f cortx-cloud-3rd-party-pkg/local-path-storage.yaml
fi

image=$(parseSolution 'solution.images.consul')
image=$(echo $image | cut -f2 -d'>')

helm install "consul" hashicorp/consul \
--set global.name="consul" \
--set global.image=$image \
--set server.storageClass=$storage_class \
--set server.replicas=$num_consul_replicas

Expand All @@ -192,14 +205,17 @@ printf "######################################################\n"

openldap_password=$(parseSolution 'solution.3rdparty.openldap.password')
openldap_password=$(echo $openldap_password | cut -f2 -d'>')
image=$(parseSolution 'solution.images.openldap')
image=$(echo $image | cut -f2 -d'>')

helm install "openldap" cortx-cloud-3rd-party-pkg/openldap \
--set openldap.servicename="openldap-svc" \
--set openldap.storageclass="openldap-local-storage" \
--set openldap.storagesize="5Gi" \
--set openldap.nodelistinfo="node-list-info.txt" \
--set openldap.numreplicas=$num_openldap_replicas \
--set openldap.password=$openldap_password
--set openldap.password=$openldap_password \
--set openldap.image=$image

# Wait for all openLDAP pods to be ready
printf "\nWait for openLDAP PODs to be ready"
Expand Down Expand Up @@ -349,10 +365,14 @@ printf "########################################################\n"
first_node_name=${node_name_list[0]}
first_node_selector=${node_selector_list[0]}

image=$(parseSolution 'solution.images.gluster')
image=$(echo $image | cut -f2 -d'>')

helm install "cortx-gluster-$first_node_name" cortx-cloud-helm-pkg/cortx-gluster \
--set cortxgluster.name="gluster-$first_node_name" \
--set cortxgluster.nodename=$first_node_selector \
--set cortxgluster.service.name="cortx-gluster-svc-$first_node_name" \
--set cortxgluster.image=$image \
--set cortxgluster.storagesize="1Gi" \
--set cortxgluster.storageclass="cortx-gluster-storage" \
--set cortxgluster.pv.path=$gluster_vol \
Expand Down Expand Up @@ -663,14 +683,14 @@ printf "########################################################\n"
# in the "auto-gen-secret" folder
secret_auto_gen_path="$cfgmap_path/auto-gen-secret"
mkdir -p $secret_auto_gen_path
output=$(./parse_scripts/parse_yaml.sh solution.yaml "solution.secrets.name")
output=$(./parse_scripts/parse_yaml.sh $solution_yaml "solution.secrets.name")
IFS=';' read -r -a parsed_secret_name_array <<< "$output"
for secret_name in "${parsed_secret_name_array[@]}"
do
secret_fname=$(echo $secret_name | cut -f2 -d'>')
yaml_content_path=$(echo $secret_name | cut -f1 -d'>')
yaml_content_path=${yaml_content_path/.name/".content"}
secrets="$(./parse_scripts/yaml_extract_block.sh solution.yaml $yaml_content_path 2)"
secrets="$(./parse_scripts/yaml_extract_block.sh $solution_yaml $yaml_content_path 2)"

new_secret_gen_file="$secret_auto_gen_path/$secret_fname.yaml"
cp "$cfgmap_path/templates/secret-template.yaml" $new_secret_gen_file
Expand Down
19 changes: 13 additions & 6 deletions k8_cortx_cloud/destroy-cortx-cloud.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/bin/bash

solution_yaml=${1:-'solution.yaml'}

# Check if the file exists
if [ ! -f $solution_yaml ]
then
echo "ERROR: $solution_yaml does not exist"
exit 1
fi

pvc_consul_filter="data-default-consul"
pvc_kafka_filter="kafka"
pvc_zookeeper_filter="zookeeper"
pv_filter="pvc"
openldap_pvc="openldap-data"

#################################################################
# Create files that contain disk partitions on the worker nodes
#################################################################
function parseSolution()
{
echo "$(./parse_scripts/parse_yaml.sh solution.yaml $1)"
echo "$(./parse_scripts/parse_yaml.sh $solution_yaml $1)"
}

namespace=$(parseSolution 'solution.namespace')
Expand Down Expand Up @@ -133,7 +139,8 @@ do
printf "=================================================================================\n"
printf "Stop and delete GlusterFS volume: $gluster_node_name \n"
printf "=================================================================================\n"

kubectl exec --namespace=$namespace -i $gluster_node_name -- bash -c \
'rm -rf /etc/gluster/* /etc/gluster/.glusterfs/'
if [[ "$count" == 0 ]]; then
first_gluster_node_name=$gluster_node_name
echo y | kubectl exec --namespace=$namespace -i $gluster_node_name -- gluster volume stop $gluster_vol
Expand Down Expand Up @@ -238,7 +245,7 @@ helm uninstall "openldap"
printf "########################################################\n"
printf "# Delete Secrets #\n"
printf "########################################################\n"
output=$(./parse_scripts/parse_yaml.sh solution.yaml "solution.secrets*.name")
output=$(./parse_scripts/parse_yaml.sh $solution_yaml "solution.secrets*.name")
IFS=';' read -r -a parsed_secret_name_array <<< "$output"
for secret_name in "${parsed_secret_name_array[@]}"
do
Expand Down
94 changes: 84 additions & 10 deletions k8_cortx_cloud/prereq-deploy-cortx-cloud.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/bin/bash

disk_partition=$1
solution_yaml=${2:-'solution.yaml'}

# Check if the file exists
if [ ! -f $solution_yaml ]
then
echo "ERROR: $solution_yaml does not exist"
exit 1
fi

function parseSolution()
{
echo "$(./parse_scripts/parse_yaml.sh $solution_yaml $1)"
}

fs_mount_path="/mnt/fs-local-volume"

if [[ "$disk_partition" == "" ]]
Expand All @@ -21,15 +35,69 @@ printf "####################################################\n"
printf "# Pull required docker images \n"
printf "####################################################\n"
# pull docker 3rd party images
docker pull bitnami/kafka
docker pull docker.io/gluster/gluster-centos
docker pull rancher/local-path-provisioner:v0.0.20
docker pull bitnami/zookeeper
docker pull hashicorp/consul:1.10.2
docker pull busybox

#Pull cortx-all docker image
docker pull ghcr.io/seagate/cortx-all:2.0.0-latest-custom-ci
image=$(parseSolution 'solution.images.cortxcontrolprov')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.cortxcontrol')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.cortxdataprov')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.cortxdata')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.openldap')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.consul')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.kafka')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.zookeeper')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.gluster')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

image=$(parseSolution 'solution.images.rancher')
image=$(echo $image | cut -f2 -d'>')
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
docker pull $image
fi

# Pull the latest busybox image
docker pull busybox

printf "####################################################\n"
printf "# Clean up \n"
Expand All @@ -47,12 +115,18 @@ printf "# Prep for CORTX deployment \n"
printf "####################################################\n"
# Prep for Rancher Local Path Provisioner deployment
mkdir -p $fs_mount_path/local-path-provisioner
echo y | mkfs.ext4 $disk_partition
mount -t ext4 $disk_partition $fs_mount_path

if [[ $(findmnt -m $fs_mount_path) ]];then
echo "$fs_mount_path already mounted..."
else
echo y | mkfs.ext4 $disk_partition
mount -t ext4 $disk_partition $fs_mount_path
fi

# Prep for GlusterFS deployment
yum install glusterfs-fuse -y
mkdir -p $fs_mount_path/etc/gluster
mkdir -p $fs_mount_path/etc/gluster/var/log/cortx
mkdir -p $fs_mount_path/var/log/glusterfs
mkdir -p $fs_mount_path/var/lib/glusterd

Expand Down
64 changes: 64 additions & 0 deletions k8_cortx_cloud/shutdown-cortx-cloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

solution_yaml=${1:-'solution.yaml'}

# Check if the file exists
if [ ! -f $solution_yaml ]
then
echo "ERROR: $solution_yaml does not exist"
exit 1
fi

function parseSolution()
{
echo "$(./parse_scripts/parse_yaml.sh $solution_yaml $1)"
}

namespace=$(parseSolution 'solution.namespace')
namespace=$(echo $namespace | cut -f2 -d'>')

printf "########################################################\n"
printf "# Shutdown CORTX Data \n"
printf "########################################################\n"

while IFS= read -r line; do
IFS=" " read -r -a deployments <<< "$line"
kubectl scale deploy "${deployments[0]}" --replicas 0 --namespace=$namespace
done <<< "$(kubectl get deployments --namespace=$namespace | grep 'cortx-control-pod')"

printf "\nWait for CORTX Control to be shutdown"
while true; do
output=$(kubectl get pods --namespace=$namespace | grep 'cortx-control-pod-')
if [[ "$output" == "" ]]; then
break
else
printf "."
fi
sleep 1s
done
printf "\n\n"
printf "All CORTX Control pods have been shutdown"
printf "\n\n"

printf "########################################################\n"
printf "# Shutdown CORTX Data \n"
printf "########################################################\n"

while IFS= read -r line; do
IFS=" " read -r -a deployments <<< "$line"
kubectl scale deploy "${deployments[0]}" --replicas 0 --namespace=$namespace
done <<< "$(kubectl get deployments --namespace=$namespace | grep 'cortx-data-pod-')"

printf "\nWait for CORTX Data to be shutdown"
while true; do
output=$(kubectl get pods --namespace=$namespace | grep 'cortx-data-pod-')
if [[ "$output" == "" ]]; then
break
else
printf "."
fi
sleep 1s
done
printf "\n\n"
printf "All CORTX Data pods have been shutdown"
printf "\n\n"
7 changes: 6 additions & 1 deletion k8_cortx_cloud/solution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ solution:
cortxcontrol: centos:7
cortxdataprov: centos:7
cortxdata: centos:7
cortxsupport: centos:7
openldap: ghcr.io/seagate/symas-openldap:standalone
consul: hashicorp/consul:1.10.0
kafka: bitnami/kafka
zookeeper: bitnami/zookeeper
gluster: docker.io/gluster/gluster-centos
rancher: rancher/local-path-provisioner:v0.0.20
3rdparty:
openldap:
password: seagate1
Expand Down
Loading

0 comments on commit 747096d

Please sign in to comment.