<commit_before>#cloud-config

---
write-files:
  - path: /etc/conf.d/nfs
    permissions: '0644'
    content: |
      OPTS_RPC_MOUNTD=""
  - path: /opt/bin/wupiao
    permissions: '0755'
    content: |
      #!/bin/bash
      # [w]ait [u]ntil [p]ort [i]s [a]ctually [o]pen
      [ -n "$1" ] && \
        until curl -o /dev/null -sIf http://${1}; do \
          sleep 1 && echo .;
        done;
      exit $?

coreos:
  etcd2:
    name: __NAME__
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    advertise-client-urls: http://$public_ipv4:2379,http://$public_ipv4:4001
    initial-cluster-token: <PASSWORD>
    listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
    initial-advertise-peer-urls: http://$private_ipv4:2380
    initial-cluster: __ETCD_SEED_CLUSTER__
    initial-cluster-state: new
  fleet:
    public-ip: $public_ipv4
    metadata: "role=master"
  flannel:
    interface: $public_ipv4
  units:
    - name: rpcbind.service
      enable: true
      command: start
    - name: rpc-statd.service
      enable: true
      command: start
    - name: docker-cache.service
      command: start
      content: |
        [Unit]
        Description=Docker cache proxy
        Requires=early-docker.service
        After=early-docker.service
        Before=early-docker.target
        [Service]
        Restart=always
        TimeoutStartSec=0
        RestartSec=5
        Environment="TMPDIR=/var/tmp/"
        Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
        ExecStartPre=-/usr/bin/docker kill docker-registry
        ExecStartPre=-/usr/bin/docker rm docker-registry
        ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
        # GUNICORN_OPTS is an workaround for
        # https://github.com/docker/docker-registry/issues/892
        ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
          -e STANDALONE=false \
          -e GUNICORN_OPTS=[--preload] \
          -e MIRROR_SOURCE=https://registry-1.docker.io \
          -e MIRROR_SOURCE_INDEX=https://index.docker.io \
          -e MIRROR_TAGS_CACHE_TTL=1800 \
          __PROXY_LINE__-e HTTP_PROXY=__HTTP_PROXY__ \
          __PROXY_LINE__-e HTTPS_PROXY=__HTTPS_PROXY__ \
          __PROXY_LINE__-e NO_PROXY=__NO_PROXY__ \
          quay.io/devops/docker-registry:latest
    - name: fleet.service
      command: start
    - name: flanneld.service
      command: start
      drop-ins:
        - name: 50-network-config.conf
          content: |
            [Unit]
            Requires=etcd2.service
            [Service]
            ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "host-gw"}}'
    - name: docker.service
      command: start
      drop-ins:
        - name: 51-docker-mirror.conf
          content: |
            [Unit]
            # making sure that docker-cache is up and that flanneld finished
            # startup, otherwise containers won't land in flannel's network...
            Requires=docker-cache.service flanneld.service
            After=docker-cache.service flanneld.service
            [Service]
            Environment="DOCKER_OPTS=__DOCKER_OPTIONS__ --registry-mirror=http://$private_ipv4:5000"
        - __PROXY_LINE__name: http-proxy.conf
          __PROXY_LINE__content: |
            __PROXY_LINE__[Service]
            __PROXY_LINE__EnvironmentFile=/etc/environment
    - name: early-docker.service
      drop-ins:
        - __PROXY_LINE__name: http-proxy.conf
          __PROXY_LINE__content: |
            __PROXY_LINE__[Service]
            __PROXY_LINE__EnvironmentFile=/etc/environment
    - name: kube-install.service
      command: start
      content: |
        [Unit]
        Description=Download/Install Kubernetes
        Requires=network-online.target kube-certs.service
        After=network-online.target kube-certs.service
        ConditionPathExists=/srv/kubernetes
        [Service]
        Type=oneshot
        EnvironmentFile=/etc/environment<commit_msg>Master node is not supposed to run pod containers.<commit_after>#cloud-config

---
write-files:
  - path: /etc/conf.d/nfs
    permissions: '0644'
    content: |
      OPTS_RPC_MOUNTD=""
  - path: /opt/bin/wupiao
    permissions: '0755'
    content: |
      #!/bin/bash
      # [w]ait [u]ntil [p]ort [i]s [a]ctually [o]pen
      [ -n "$1" ] && \
        until curl -o /dev/null -sIf http://${1}; do \
          sleep 1 && echo .;
        done;
      exit $?

coreos:
  etcd2:
    name: __NAME__
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    advertise-client-urls: http://$public_ipv4:2379,http://$public_ipv4:4001
    initial-cluster-token: <PASSWORD>
    listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
    initial-advertise-peer-urls: http://$private_ipv4:2380
    initial-cluster: __ETCD_SEED_CLUSTER__
    initial-cluster-state: new
  fleet:
    public-ip: $public_ipv4
    metadata: "role=master"
  flannel:
    interface: $public_ipv4
  units:
    - name: rpcbind.service
      enable: true
      command: start
    - name: rpc-statd.service
      enable: true
      command: start
    - name: docker-cache.service
      command: start
      content: |
        [Unit]
        Description=Docker cache proxy
        Requires=early-docker.service
        After=early-docker.service
        Before=early-docker.target
        [Service]
        Restart=always
        TimeoutStartSec=0
        RestartSec=5
        Environment="TMPDIR=/var/tmp/"
        Environment="DOCKER_HOST=unix:///var/run/early-docker.sock"
        ExecStartPre=-/usr/bin/docker kill docker-registry
        ExecStartPre=-/usr/bin/docker rm docker-registry
        ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
        # GUNICORN_OPTS is an workaround for
        # https://github.com/docker/docker-registry/issues/892
        ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
          -e STANDALONE=false \
          -e GUNICORN_OPTS=[--preload] \
          -e MIRROR_SOURCE=https://registry-1.docker.io \
          -e MIRROR_SOURCE_INDEX=https://index.docker.io \
          -e MIRROR_TAGS_CACHE_TTL=1800 \
          __PROXY_LINE__-e HTTP_PROXY=__HTTP_PROXY__ \
          __PROXY_LINE__-e HTTPS_PROXY=__HTTPS_PROXY__ \
          __PROXY_LINE__-e NO_PROXY=__NO_PROXY__ \
          quay.io/devops/docker-registry:latest
    - name: fleet.service
      command: start
    - name: flanneld.service
      command: start
      drop-ins:
        - name: 50-network-config.conf
          content: |
            [Unit]
            Requires=etcd2.service
            [Service]
            ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend": {"Type": "host-gw"}}'
    - name: docker.service
      command: start
      drop-ins:
        - name: 51-docker-mirror.conf
        - __PROXY_LINE__name: http-proxy.conf
          __PROXY_LINE__content: |
            __PROXY_LINE__[Service]
            __PROXY_LINE__EnvironmentFile=/etc/environment
    - name: early-docker.service
      drop-ins:
        - __PROXY_LINE__name: http-proxy.conf
          __PROXY_LINE__content: |
            __PROXY_LINE__[Service]
            __PROXY_LINE__EnvironmentFile=/etc/environment
    - name: kube-install.service
      command: start
      content: |
        [Unit]
        Description=Download/Install Kubernetes
        Requires=network-online.target kube-certs.service
        After=network-online.target kube-certs.service
        ConditionPathExists=/srv/kubernetes
        [Service]
        Type=oneshot
        EnvironmentFile=/etc/environment
{'fraction_non_alphanumeric': 0.11574013800286422, 'fraction_numerical': 0.021221195156880614, 'mean_word_length': 2.1783202316921804, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '5949889', 'n_tokens_mistral': 2671, 'n_tokens_neox': 2579, 'n_words': 410}