Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eks: Make install script idempotent #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions k8s/eks/bash/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,20 @@ aws_get_sg_id(){
}

aws_create_efs_mount_point(){
aws efs create-mount-target --file-system-id $efs_fs_id --subnet-id $subnet_id --security-group $efs_sg_id --region $REGION
mnt_target_id=$(aws efs describe-mount-targets --region $REGION --file-system-id $efs_fs_id | jq -r ".MountTargets[] | .MountTargetId")
if [[ -z "${mnt_target_id}" ]]
then
aws efs create-mount-target --file-system-id $efs_fs_id --subnet-id $subnet_id --security-group $efs_sg_id --region $REGION
fi
efs_dns=$efs_fs_id.efs.$REGION.amazonaws.com

}

create_cm_efs(){
kubectl create configmap efs-provisioner --from-literal=file.system.id=$efs_fs_id --from-literal=aws.region=$REGION --from-literal=provisioner.name=testground.io/aws-efs
if ! kubectl get configmap | grep --quiet efs-provisioner; then
kubectl create configmap efs-provisioner --from-literal=file.system.id=$efs_fs_id --from-literal=aws.region=$REGION --from-literal=provisioner.name=testground.io/aws-efs
else
echo "EFS configmap already exists, skipping to the next step."
fi
}

create_efs_manifest(){
Expand Down Expand Up @@ -381,15 +388,23 @@ helm_redis_add_repo(){
}

helm_infra_install_redis(){
helm install testground-infra-redis --set auth.enabled=false --set master.nodeSelector='testground.node.role.infra: "true"' bitnami/redis
if ! helm ls | grep --quiet testground-infra-redis; then
helm install testground-infra-redis --set auth.enabled=false --set master.nodeSelector='testground.node.role.infra: "true"' bitnami/redis
else
echo "Helm testground-infra-redis already exists, skipping to the next step."
fi
}

helm_infra_install_influx_db(){
# We are using v2.6.1 of the helm chart, which has been evicted from the regular index.yaml.
# Adding the archive-full-index branch to use the old version.
# SEE: https://github.com/bitnami/charts/issues/10833
helm repo add bitnami-full-index https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
helm install influxdb bitnami-full-index/influxdb -f $real_path/yaml/influxdb/values.yml --set image.tag=1.8.2 --set image.debug=true --version 2.6.1
if ! helm ls | grep --quiet influxdb; then
# We are using v2.6.1 of the helm chart, which has been evicted from the regular index.yaml.
# Adding the archive-full-index branch to use the old version.
# SEE: https://github.com/bitnami/charts/issues/10833
helm repo add bitnami-full-index https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
helm install influxdb bitnami-full-index/influxdb -f $real_path/yaml/influxdb/values.yml --set image.tag=1.8.2 --set image.debug=true --version 2.6.1
else
echo "Helm influxdb already exists, skipping to the next step."
fi
}

tg_daemon_config_map(){
Expand Down