<commit_before>#!/bin/bash

set -e
set -x
set -o pipefail

TEMPLATE_DIR=/opt/garbanzo/templates

CLUSTER_NAME=$(cat /opt/garbanzo/etc/cluster_name)
DOMAIN_NAME=$(cat /opt/garbanzo/etc/domain_name)
PRIVATE_IP=$(cat /opt/garbanzo/etc/private_ip)
MASTER_COUNT=$(cat /opt/garbanzo/etc/master_count)
SSL_DIR=/opt/garbanzo/ssl
SSL_KEY_BUCKET=$(cat /opt/garbanzo/etc/ssl_key_bucket)

# download the bootstrap token
if [ ! -e /var/lib/kubernetes ]; then
  mkdir -p /var/lib/kubernetes/
fi
chown root:root /var/lib/kubernetes
chmod 700 /var/lib/kubernetes

declare -a ETCD_CLUSTER_HOSTS
for i in $(seq 1 $MASTER_COUNT); do
  ETCD_CLUSTER_HOSTS[i]="https://master-${i}-priv.${DOMAIN_NAME}:2379"
done
ETCD_CLUSTER_LIST=$(IFS=, ; echo "${ETCD_CLUSTER_HOSTS[*]}")

aws s3 cp "s3://${SSL_KEY_BUCKET}/token.csv" /var/lib/kubernetes/token.csv
chown root:root /var/lib/kubernetes/token.csv
chmod 600 /var/lib/kubernetes/token.csv

################################################################################
# kube-apiserver
################################################################################
sed \
  -e "s#\${ETCD_CLUSTER_LIST}#${ETCD_CLUSTER_LIST}#" \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  -e "s#\${SSL_DIR}#${SSL_DIR}#" \
  ${TEMPLATE_DIR}/kube-apiserver.service.tmpl > /etc/systemd/system/kube-apiserver.service

# start and check API server status
echo systemctl daemon-reload
echo systemctl enable kube-apiserver
echo systemctl start kube-apiserver
echo systemctl status kube-apiserver --no-pager -l

################################################################################
# kube-controller-manager
################################################################################

sed \
  -e "s#\${CLUSTER_NAME}#${CLUSTER_NAME}#" \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  -e "s#\${SSL_DIR}#${SSL_DIR}#" \
  ${TEMPLATE_DIR}/kube-controller-manager.service.tmpl > /etc/systemd/system/kube-controller-manager.service
echo systemctl daemon-reload
echo systemctl enable kube-controller-manager
echo systemctl start kube-controller-manager
echo systemctl status -l kube-controller-manager --no-pager -l
#
# ################################################################################
# # kube-scheduler
# ################################################################################
#
sed \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  ${TEMPLATE_DIR}/kube-scheduler.service.tmpl > /etc/systemd/system/kube-scheduler.service
#
echo systemctl daemon-reload
echo systemctl enable kube-scheduler
echo systemctl start kube-scheduler
echo systemctl status kube-scheduler --no-pager -l
<commit_msg>systemctl status: Removed extraneous '-l'<commit_after>#!/bin/bash

set -e
set -x
set -o pipefail

TEMPLATE_DIR=/opt/garbanzo/templates

CLUSTER_NAME=$(cat /opt/garbanzo/etc/cluster_name)
DOMAIN_NAME=$(cat /opt/garbanzo/etc/domain_name)
PRIVATE_IP=$(cat /opt/garbanzo/etc/private_ip)
MASTER_COUNT=$(cat /opt/garbanzo/etc/master_count)
SSL_DIR=/opt/garbanzo/ssl
SSL_KEY_BUCKET=$(cat /opt/garbanzo/etc/ssl_key_bucket)

# download the bootstrap token
if [ ! -e /var/lib/kubernetes ]; then
  mkdir -p /var/lib/kubernetes/
fi
chown root:root /var/lib/kubernetes
chmod 700 /var/lib/kubernetes

declare -a ETCD_CLUSTER_HOSTS
for i in $(seq 1 $MASTER_COUNT); do
  ETCD_CLUSTER_HOSTS[i]="https://master-${i}-priv.${DOMAIN_NAME}:2379"
done
ETCD_CLUSTER_LIST=$(IFS=, ; echo "${ETCD_CLUSTER_HOSTS[*]}")

aws s3 cp "s3://${SSL_KEY_BUCKET}/token.csv" /var/lib/kubernetes/token.csv
chown root:root /var/lib/kubernetes/token.csv
chmod 600 /var/lib/kubernetes/token.csv

################################################################################
# kube-apiserver
################################################################################
sed \
  -e "s#\${ETCD_CLUSTER_LIST}#${ETCD_CLUSTER_LIST}#" \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  -e "s#\${SSL_DIR}#${SSL_DIR}#" \
  ${TEMPLATE_DIR}/kube-apiserver.service.tmpl > /etc/systemd/system/kube-apiserver.service

# start and check API server status
echo systemctl daemon-reload
echo systemctl enable kube-apiserver
echo systemctl start kube-apiserver
echo systemctl status kube-apiserver --no-pager -l

################################################################################
# kube-controller-manager
################################################################################

sed \
  -e "s#\${CLUSTER_NAME}#${CLUSTER_NAME}#" \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  -e "s#\${SSL_DIR}#${SSL_DIR}#" \
  ${TEMPLATE_DIR}/kube-controller-manager.service.tmpl > /etc/systemd/system/kube-controller-manager.service
echo systemctl daemon-reload
echo systemctl enable kube-controller-manager
echo systemctl start kube-controller-manager
echo systemctl status kube-controller-manager --no-pager -l
#
# ################################################################################
# # kube-scheduler
# ################################################################################
#
sed \
  -e "s#\${PRIVATE_IP}#${PRIVATE_IP}#" \
  ${TEMPLATE_DIR}/kube-scheduler.service.tmpl > /etc/systemd/system/kube-scheduler.service
#
echo systemctl daemon-reload
echo systemctl enable kube-scheduler
echo systemctl start kube-scheduler
echo systemctl status kube-scheduler --no-pager -l

{'fraction_non_alphanumeric': 0.3093470397867885, 'fraction_numerical': 0.004949552636588616, 'mean_word_length': 5.968169761273209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '130274', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1768, 'n_words': 299}