<commit_before>#cloud-config
---
hostname: kubernetes-master
users:
  - name: core
    ssh-authorized-keys: 
      - "<SSH_PUBLIC_KEY>"
    groups: 
      - sudo
    shell: /bin/bash

write_files:
  - path: /opt/bin/kubernetes-install.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      if [ ! -f /opt/bin/kubelet ]; then
        echo "Kubenetes not installed - installing."

        # Extract the Kubernetes binaries.
        sudo wget -N -P /opt/bin http://storage.googleapis.com/kubernetes-release/release/v1.1.2/bin/linux/amd64/kubectl
        sudo wget -N -P /opt/bin http://storage.googleapis.com/kubernetes-release/release/v1.1.2/bin/linux/amd64/kubelet
        sudo chmod +x /opt/bin/kubelet /opt/bin/kubectl
      fi

  - path: /opt/bin/calico-install.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      if [ ! -f /opt/bin/calicoctl ]; then
        echo "Calico not installed - installing."
       
        # Install the `calicoctl` binary
        wget https://github.com/projectcalico/calico-containers/releases/download/v0.13.0/calicoctl
        chmod +x calicoctl
        sudo mv calicoctl /opt/bin

        # Fetch the calico/node container
        sudo docker pull calico/node:v0.13.0
      fi

  - path: /opt/bin/install-manifests.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      # Ensure directories exists.
      sudo mkdir -p /etc/kubernetes/manifests/
      sudo mkdir -p /etc/kubernetes/ssl/
      sudo mkdir -p /etc/kubernetes/addons/
      
      if [ ! -f /etc/kubernetes/manifests/kubernetes-master.manifest -o ! -f /etc/kubernetes/manifests/calico-etcd.manifest ]; then
        echo "Manifests not installed - installing."

        # Download config.
        sudo wget -N -P /etc/kubernetes/manifests/ https://raw.githubusercontent.com/projectcalico/calico-kubernetes/master/config/master/kubernetes-master.manifest
        sudo wget -N -P /etc/kubernetes/manifests/ https://raw.githubusercontent.com/projectcalico/calico-kubernetes/master/config/master/calico-etcd.manifest
        sudo wget -N -P /etc/kubernetes/addons/ https://raw.githubusercontent.com/projectcalico/calico-kubernetes/master/config/master/dns/skydns.yaml
      fi

      # Insert the master's IP address into the manifest.
      echo "DEFAULT_IPV4: $DEFAULT_IPV4"<commit_msg>Switch to loading resources from calico-cni repo.<commit_after>#cloud-config
---
hostname: kubernetes-master
users:
  - name: core
    ssh-authorized-keys: 
      - "<SSH_PUBLIC_KEY>"
    groups: 
      - sudo
    shell: /bin/bash

write_files:
  - path: /opt/bin/kubernetes-install.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      if [ ! -f /opt/bin/kubelet ]; then
        echo "Kubenetes not installed - installing."

        # Extract the Kubernetes binaries.
        sudo wget -N -P /opt/bin http://storage.googleapis.com/kubernetes-release/release/v1.1.2/bin/linux/amd64/kubectl
        sudo wget -N -P /opt/bin http://storage.googleapis.com/kubernetes-release/release/v1.1.2/bin/linux/amd64/kubelet
        sudo chmod +x /opt/bin/kubelet /opt/bin/kubectl
      fi

  - path: /opt/bin/calico-install.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      if [ ! -f /opt/bin/calicoctl ]; then
        echo "Calico not installed - installing."
       
        # Install the `calicoctl` binary
        wget https://github.com/projectcalico/calico-containers/releases/download/v0.13.0/calicoctl
        chmod +x calicoctl
        sudo mv calicoctl /opt/bin

        # Fetch the calico/node container
        sudo docker pull calico/node:v0.13.0
      fi

  - path: /opt/bin/install-manifests.sh
    owner: root
    permissions: 0755
    content: |
      #! /usr/bin/bash
      
      # Ensure directories exists.
      sudo mkdir -p /etc/kubernetes/manifests/
      sudo mkdir -p /etc/kubernetes/ssl/
      sudo mkdir -p /etc/kubernetes/addons/
      
      if [ ! -f /etc/kubernetes/manifests/kubernetes-master.manifest -o ! -f /etc/kubernetes/manifests/calico-etcd.manifest ]; then
        echo "Manifests not installed - installing."

        # Download config.
        sudo wget -N -P /etc/kubernetes/manifests/ https://raw.githubusercontent.com/projectcalico/calico-cni/k8s-1.1-docs/samples/kubernetes/master/kubernetes-master.manifest
        sudo wget -N -P /etc/kubernetes/manifests/ https://raw.githubusercontent.com/projectcalico/calico-cni/k8s-1.1-docs/samples/kubernetes/master/calico-etcd.manifest
        sudo wget -N -P /etc/kubernetes/addons/ https://raw.githubusercontent.com/projectcalico/calico-cni/k8s-1.1-docs/samples/kubernetes/master/dns/skydns.yaml
      fi

      # Insert the master's IP address into the manifest.
      echo "DEFAULT_IPV4: $DEFAULT_IPV4"
{'fraction_non_alphanumeric': 0.118591723285979, 'fraction_numerical': 0.015029853819229977, 'mean_word_length': 2.2713804713804713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6645212', 'n_tokens_mistral': 1744, 'n_tokens_neox': 1597, 'n_words': 321}