<commit_before>#!/bin/bash

set -e

KOLLA_CONFIG_DIRECTORY=${KOLLA_CONFIG_DIRECTORY:=/etc/kolla}
KOLLA_K8S_VALUE=${KOLLA_K8S_VALUE:=value.yml}
NODE_CONFIG_DIRECTORY=${NODE_CONFIG_DIRECTORY:=/etc/kolla}

if [ -f "$KOLLA_CONFIG_DIRECTORY/$KOLLA_K8S_VALUE" ]; then
    NODE_CONFIG_DIRECTORY="$(crudini --get /etc/kolla/$KOLLA_K8S_VALUE DEFAULT node_config_directory)"
fi

function usage() {
    cat - <<EOF
$0: COMMAND

commands:
prepare   Prepare deploy environment 
deploy    Deploy openstack by helm
test      Test openstack
EOF
}

function download_kubectl() {
    echo "Finding latest kubectl"
    # curl -s https://github.com/kubernetes/kubernetes/releases/latest  | awk -F '[<>]' '/.*/ { match($0, "tag/([^\"]+)",a); print a[1] }'
    LATEST=$(curl -s https://github.com/kubernetes/kubernetes/releases/latest  | awk -F '[<>]' '/.*/ { print substr($0,match($0, "tag/([^\"]+)")+4,RLENGTH-4);  }' | head -1)
    
    echo "Getting kubectl-$LATEST"
    curl -o /usr/bin/kubectl "http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/amd64/kubectl"
    chmod 755 /usr/bin/kubectl
}

function prepare() {
    git clone http://github.com/openstack/kolla-kubernetes
    
    [ -d "/etc/kolla" ] || mkdir /etc/kolla
    
    if [ ! -f "/etc/kolla/passwords.yml" ]; then
        git clone http://github.com/openstack/kolla-ansible
        ln -T kolla-ansible/etc/kolla/passwords.yml /etc/kolla/passwords.yml
    fi

    cd kolla-kubernetes
    pip install .
    echo "Generate openstack password"<commit_msg>Using cp instead hard link<commit_after>#!/bin/bash

set -e

KOLLA_CONFIG_DIRECTORY=${KOLLA_CONFIG_DIRECTORY:=/etc/kolla}
KOLLA_K8S_VALUE=${KOLLA_K8S_VALUE:=value.yml}
NODE_CONFIG_DIRECTORY=${NODE_CONFIG_DIRECTORY:=/etc/kolla}

if [ -f "$KOLLA_CONFIG_DIRECTORY/$KOLLA_K8S_VALUE" ]; then
    NODE_CONFIG_DIRECTORY="$(crudini --get /etc/kolla/$KOLLA_K8S_VALUE DEFAULT node_config_directory)"
fi

function usage() {
    cat - <<EOF
$0: COMMAND

commands:
prepare   Prepare deploy environment 
deploy    Deploy openstack by helm
test      Test openstack
EOF
}

function download_kubectl() {
    echo "Finding latest kubectl"
    # curl -s https://github.com/kubernetes/kubernetes/releases/latest  | awk -F '[<>]' '/.*/ { match($0, "tag/([^\"]+)",a); print a[1] }'
    LATEST=$(curl -s https://github.com/kubernetes/kubernetes/releases/latest  | awk -F '[<>]' '/.*/ { print substr($0,match($0, "tag/([^\"]+)")+4,RLENGTH-4);  }' | head -1)
    
    echo "Getting kubectl-$LATEST"
    curl -o /usr/bin/kubectl "http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/amd64/kubectl"
    chmod 755 /usr/bin/kubectl
}

function prepare() {
    git clone http://github.com/openstack/kolla-kubernetes
    
    [ -d "/etc/kolla" ] || mkdir /etc/kolla
    
    if [ ! -f "/etc/kolla/passwords.yml" ]; then
        git clone http://github.com/openstack/kolla-ansible
        cp kolla-ansible/etc/kolla/passwords.yml /etc/kolla/passwords.yml
    fi

    cd kolla-kubernetes
    pip install .
    echo "Generate openstack password"
{'fraction_non_alphanumeric': 0.1613219895287958, 'fraction_numerical': 0.01112565445026178, 'mean_word_length': 3.488986784140969, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '2862790', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1126, 'n_words': 202}