Skip to content

Commit

Permalink
Merge pull request #57 from lucidworks/APOLLO-23485-sed-fixes
Browse files Browse the repository at this point in the history
APOLLO-23485: Add sed fixes depending on the OS
  • Loading branch information
thelabdude authored Feb 19, 2020
2 parents 8f994e1 + 6d95cc4 commit a645987
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
34 changes: 25 additions & 9 deletions customize_fusion_values.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,27 +133,43 @@ if [ "${NODE_POOL}" == "" ]; then
fi

cp customize_fusion_values.yaml.example $MY_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$MY_VALUES"
sed -i'' -e "s|{SOLR_REPLICAS}|${SOLR_REPLICAS}|g" "$MY_VALUES"
sed -i'' -e "s|{RELEASE}|${RELEASE}|g" "$MY_VALUES"
sed -i'' -e "s|{PROMETHEUS}|${PROMETHEUS_ON}|g" "$MY_VALUES"
sed -i'' -e "s|{SOLR_DISK_GB}|${SOLR_DISK_GB}|g" "$MY_VALUES"

if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$MY_VALUES"
sed -i -e "s|{SOLR_REPLICAS}|${SOLR_REPLICAS}|g" "$MY_VALUES"
sed -i -e "s|{RELEASE}|${RELEASE}|g" "$MY_VALUES"
sed -i -e "s|{PROMETHEUS}|${PROMETHEUS_ON}|g" "$MY_VALUES"
sed -i -e "s|{SOLR_DISK_GB}|${SOLR_DISK_GB}|g" "$MY_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$MY_VALUES"
sed -i '' -e "s|{SOLR_REPLICAS}|${SOLR_REPLICAS}|g" "$MY_VALUES"
sed -i '' -e "s|{RELEASE}|${RELEASE}|g" "$MY_VALUES"
sed -i '' -e "s|{PROMETHEUS}|${PROMETHEUS_ON}|g" "$MY_VALUES"
sed -i '' -e "s|{SOLR_DISK_GB}|${SOLR_DISK_GB}|g" "$MY_VALUES"
fi
echo -e "\nCreated Fusion custom values yaml: ${MY_VALUES}\n"

if [ "$PROMETHEUS_ON" == "true" ]; then
PROMETHEUS_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_prom_values.yaml"
if [ ! -f "${PROMETHEUS_VALUES}" ]; then
cp example-values/prometheus-values.yaml $PROMETHEUS_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i'' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i '' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
fi
echo -e "\nCreated Prometheus custom values yaml: ${PROMETHEUS_VALUES}\n"
fi

GRAFANA_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_graf_values.yaml"
if [ ! -f "${GRAFANA_VALUES}" ]; then
cp example-values/grafana-values.yaml $GRAFANA_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
fi
echo -e "\nCreated Grafana custom values yaml: ${GRAFANA_VALUES}\n"
fi
fi
15 changes: 12 additions & 3 deletions install_prom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,24 @@ fi
PROMETHEUS_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_prom_values.yaml"
if [ ! -f "${PROMETHEUS_VALUES}" ]; then
cp example-values/prometheus-values.yaml $PROMETHEUS_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i'' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i '' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
fi
echo -e "\nCreated Prometheus custom values yaml: ${PROMETHEUS_VALUES}. Keep this file handy as you'll need it to customize your Prometheus installation.\n"
fi

GRAFANA_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_graf_values.yaml"
if [ ! -f "${GRAFANA_VALUES}" ]; then
cp example-values/grafana-values.yaml $GRAFANA_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
fi
echo -e "\nCreated Grafana custom values yaml: ${GRAFANA_VALUES}. Keep this file handy as you'll need it to customize your Grafana installation.\n"
fi

Expand Down
33 changes: 25 additions & 8 deletions setup_f5_k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,24 @@ if [ "$UPGRADE" != "1" ] && [ "${PROMETHEUS}" != "none" ]; then
PROMETHEUS_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_prom_values.yaml"
if [ ! -f "${PROMETHEUS_VALUES}" ]; then
cp example-values/prometheus-values.yaml $PROMETHEUS_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i'' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$PROMETHEUS_VALUES"
sed -i '' -e "s|{NAMESPACE}|${NAMESPACE}|g" "$PROMETHEUS_VALUES"
fi
echo -e "\nCreated Prometheus custom values yaml: ${PROMETHEUS_VALUES}. Keep this file handy as you'll need it to customize your Prometheus installation.\n"
fi

GRAFANA_VALUES="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_graf_values.yaml"
if [ ! -f "${GRAFANA_VALUES}" ]; then
cp example-values/grafana-values.yaml $GRAFANA_VALUES
sed -i'' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
else
sed -i '' -e "s|{NODE_POOL}|${NODE_POOL}|g" "$GRAFANA_VALUES"
fi
echo -e "\nCreated Grafana custom values yaml: ${GRAFANA_VALUES}. Keep this file handy as you'll need it to customize your Grafana installation.\n"
fi

Expand Down Expand Up @@ -514,9 +523,17 @@ kubectl config set-context --current --namespace=${NAMESPACE}

UPGRADE_SCRIPT="${PROVIDER}_${CLUSTER_NAME}_${RELEASE}_upgrade_fusion.sh"
cp upgrade_fusion.sh.example $UPGRADE_SCRIPT
sed -i'' -e "s|<PROVIDER>|${PROVIDER}|g" "$UPGRADE_SCRIPT"
sed -i'' -e "s|<CLUSTER>|${CLUSTER_NAME}|g" "$UPGRADE_SCRIPT"
sed -i'' -e "s|<RELEASE>|${RELEASE}|g" "$UPGRADE_SCRIPT"
sed -i'' -e "s|<NAMESPACE>|${NAMESPACE}|g" "$UPGRADE_SCRIPT"
sed -i'' -e "s|<CHART_VERSION>|${CHART_VERSION}|g" "$UPGRADE_SCRIPT"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sed -i -e "s|<PROVIDER>|${PROVIDER}|g" "$UPGRADE_SCRIPT"
sed -i -e "s|<CLUSTER>|${CLUSTER_NAME}|g" "$UPGRADE_SCRIPT"
sed -i -e "s|<RELEASE>|${RELEASE}|g" "$UPGRADE_SCRIPT"
sed -i -e "s|<NAMESPACE>|${NAMESPACE}|g" "$UPGRADE_SCRIPT"
sed -i -e "s|<CHART_VERSION>|${CHART_VERSION}|g" "$UPGRADE_SCRIPT"
else
sed -i '' -e "s|<PROVIDER>|${PROVIDER}|g" "$UPGRADE_SCRIPT"
sed -i '' -e "s|<CLUSTER>|${CLUSTER_NAME}|g" "$UPGRADE_SCRIPT"
sed -i '' -e "s|<RELEASE>|${RELEASE}|g" "$UPGRADE_SCRIPT"
sed -i '' -e "s|<NAMESPACE>|${NAMESPACE}|g" "$UPGRADE_SCRIPT"
sed -i '' -e "s|<CHART_VERSION>|${CHART_VERSION}|g" "$UPGRADE_SCRIPT"
fi
echo -e "\nCreating $UPGRADE_SCRIPT for upgrading you Fusion cluster. Please keep this script along with your custom values yaml file(s) in version control.\n"

0 comments on commit a645987

Please sign in to comment.