Skip to content

Instantly share code, notes, and snippets.

@detiber
Last active March 19, 2021 17:44
Show Gist options
  • Select an option

  • Save detiber/24ab7b15741b4f49a466d65f56efe1ab to your computer and use it in GitHub Desktop.

Select an option

Save detiber/24ab7b15741b4f49a466d65f56efe1ab to your computer and use it in GitHub Desktop.

Revisions

  1. detiber revised this gist Mar 19, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ sudo usermod -aG docker <your user>
    ```sh
    git clone https://github.com/tinkerbell/sandbox.git
    cd sandbox
    ./generate-envrc.sh enp3s0 .env
    ./generate-envrc.sh enp3s0 > .env
    ```

    Modify the generated .env file as needed, for example, I changed TINKERBELL_CIDR from 29 to 24
  2. detiber revised this gist Jan 27, 2021. No changes.
  3. detiber revised this gist Jan 27, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -348,7 +348,7 @@ tasks:
    - -c
    - |
    target_device=$(lsblk -l | grep disk | grep -v SWAP | head -n 1 | cut -d ' ' -f 1)
    sgdisk -Z $target_device
    sgdisk -Z /dev/$target_device
    EOF
    template_id=$(docker exec deploy_tink-cli_1 tink template create --name wipe-disk < ./wipe-disk-template.yaml)
    template_id=$(echo $template_id | cut -d ':' -f 2)
  4. detiber revised this gist Jan 27, 2021. 1 changed file with 13 additions and 12 deletions.
    25 changes: 13 additions & 12 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -342,18 +342,19 @@ tasks:
    - /dev:/dev
    actions:
    - name: "disk-wipe"
    image: ubuuntu-install
    image: ubuntu-install
    command:
    - sh
    - -c
    - |
    target_device=$(lsblk -l | grep disk | grep -v SWAP | head -n 1 | cut -d ' ' -f 1)
    sgdisk -Z ${target_device}
    - sh
    - -c
    - |
    target_device=$(lsblk -l | grep disk | grep -v SWAP | head -n 1 | cut -d ' ' -f 1)
    sgdisk -Z $target_device
    EOF
    template_id=$(docker exec -i deploy_tink-cli_1 tink template create --name wipe-disk < ./wipe-disk-template.yaml)
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.105"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.106"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.107"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.108"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.109"}'
    template_id=$(docker exec deploy_tink-cli_1 tink template create --name wipe-disk < ./wipe-disk-template.yaml)
    template_id=$(echo $template_id | cut -d ':' -f 2)
    docker exec deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.105"}'
    docker exec deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.106"}'
    docker exec deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.107"}'
    docker exec deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.108"}'
    docker exec deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.109"}'
    ```
  5. detiber revised this gist Jan 27, 2021. 1 changed file with 31 additions and 0 deletions.
    31 changes: 31 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -325,4 +325,35 @@ TODO: try to do it without setting an actual password, only an ssh key

    ```sh
    kubectl create -f testCluster.yaml
    ```


    ## Wipe template

    ```sh
    cat > wipe-disk-template.yaml <<EOF
    version: "0.1"
    name: wipe_disks
    global_timeout: 6000
    tasks:
    - name: "wipe_disk"
    worker: "{{.device_1}}"
    volumes:
    - /dev:/dev
    actions:
    - name: "disk-wipe"
    image: ubuuntu-install
    command:
    - sh
    - -c
    - |
    target_device=$(lsblk -l | grep disk | grep -v SWAP | head -n 1 | cut -d ' ' -f 1)
    sgdisk -Z ${target_device}
    EOF
    template_id=$(docker exec -i deploy_tink-cli_1 tink template create --name wipe-disk < ./wipe-disk-template.yaml)
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.105"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.106"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.107"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.108"}'
    docker exec -i deploy_tink-cli_1 tink workflow create -t $template_id -r '{"device_1": "192.168.1.109"}'
    ```
  6. detiber revised this gist Jan 27, 2021. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -113,6 +113,7 @@ cat > hardware-data-a.json <<EOF
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:3f:9c:bf",
    "name_servers": ["8.8.8.8"],
    "uefi": true
    },
    "netboot": {
    @@ -145,6 +146,7 @@ cat > hardware-data-b.json <<EOF
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:3f:9c:b6",
    "name_servers": ["8.8.8.8"],
    "uefi": true
    },
    "netboot": {
    @@ -177,6 +179,7 @@ cat > hardware-data-c.json <<EOF
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:3f:9d:29",
    "name_servers": ["8.8.8.8"],
    "uefi": true
    },
    "netboot": {
    @@ -209,6 +212,7 @@ cat > hardware-data-d.json <<EOF
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:3f:9c:28",
    "name_servers": ["8.8.8.8"],
    "uefi": true
    },
    "netboot": {
    @@ -241,6 +245,7 @@ cat > hardware-data-e.json <<EOF
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:39:d8:ef",
    "name_servers": ["8.8.8.8"],
    "uefi": true
    },
    "netboot": {
  7. detiber revised this gist Jan 27, 2021. 1 changed file with 59 additions and 1 deletion.
    60 changes: 59 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -55,6 +55,9 @@ sudo -E ./setup.sh
    sudo chown -R detiber:detiber ~/.docker
    cd ./deploy
    docker-compose up -d

    # Hack to work around limitations of current Tinkerbell event system (postgres triggers)
    PGPASSWORD=tinkerbell docker exec deploy_db_1 psql -U tinkerbell -c 'drop trigger events_channel ON events;'
    ```

    TODO: replace osie with tinkie
    @@ -262,4 +265,59 @@ docker push 192.168.1.1/ubuntu-install

    ### Stand up CAPT

    ### Do the thing
    TODO: setup repos

    ```sh
    kind create cluster
    tilt up
    ```

    ### Do the thing

    ```sh
    cat <<EOF | kubectl create -f -
    ---
    kind: Hardware
    apiVersion: tinkerbell.org/v1alpha1
    metadata:
    name: demo-a
    spec:
    id: 097d8c63-d83d-4940-b94d-c6256aa7685a
    ---
    kind: Hardware
    apiVersion: tinkerbell.org/v1alpha1
    metadata:
    name: demo-b
    spec:
    id: df5db23e-f69f-4faf-b4c2-6e9b6e47704b
    ---
    kind: Hardware
    apiVersion: tinkerbell.org/v1alpha1
    metadata:
    name: demo-c
    spec:
    id: ba1a14d7-a593-4352-9028-4a0976e44c7c
    ---
    kind: Hardware
    apiVersion: tinkerbell.org/v1alpha1
    metadata:
    name: demo-d
    spec:
    id: c24dbe9d-524f-4866-aeb8-e7c38800191d
    ---
    kind: Hardware
    apiVersion: tinkerbell.org/v1alpha1
    metadata:
    name: demo-e
    spec:
    id: f4d0484f-53fb-4f9c-9bce-c7705ec84c3e
    EOF
    ```

    TODO: generate cluster template from repo using clusterctl
    TODO: modify template to add users for troubleshooting.
    TODO: try to do it without setting an actual password, only an ssh key

    ```sh
    kubectl create -f testCluster.yaml
    ```
  8. detiber revised this gist Jan 26, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -249,6 +249,7 @@ cat > hardware-data-e.json <<EOF
    }
    }
    EOF
    for i in a b c d e; do docker exec -i deploy_tink-cli_1 tink hardware push < hardware-data-$i.json; done
    ```

    ### Prep for cluster-api-provider-tink
  9. detiber revised this gist Jan 26, 2021. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -123,7 +123,7 @@ cat > hardware-data-a.json <<EOF
    EOF
    cat > hardware-data-b.json <<EOF
    {
    "id": "",
    "id": "df5db23e-f69f-4faf-b4c2-6e9b6e47704b",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    @@ -141,7 +141,7 @@ cat > hardware-data-b.json <<EOF
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "mac": "b8:ae:ed:3f:9c:b6",
    "uefi": true
    },
    "netboot": {
    @@ -155,7 +155,7 @@ cat > hardware-data-b.json <<EOF
    EOF
    cat > hardware-data-c.json <<EOF
    {
    "id": "",
    "id": "ba1a14d7-a593-4352-9028-4a0976e44c7c",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    @@ -173,7 +173,7 @@ cat > hardware-data-c.json <<EOF
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "mac": "b8:ae:ed:3f:9d:29",
    "uefi": true
    },
    "netboot": {
    @@ -187,7 +187,7 @@ cat > hardware-data-c.json <<EOF
    EOF
    cat > hardware-data-d.json <<EOF
    {
    "id": "",
    "id": "c24dbe9d-524f-4866-aeb8-e7c38800191d",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    @@ -205,7 +205,7 @@ cat > hardware-data-d.json <<EOF
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "mac": "b8:ae:ed:3f:9c:28",
    "uefi": true
    },
    "netboot": {
    @@ -219,7 +219,7 @@ cat > hardware-data-d.json <<EOF
    EOF
    cat > hardware-data-e.json <<EOF
    {
    "id": "",
    "id": "f4d0484f-53fb-4f9c-9bce-c7705ec84c3e",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    @@ -237,7 +237,7 @@ cat > hardware-data-e.json <<EOF
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "mac": "b8:ae:ed:39:d8:ef",
    "uefi": true
    },
    "netboot": {
  10. detiber revised this gist Jan 26, 2021. 1 changed file with 134 additions and 1 deletion.
    135 changes: 134 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -67,24 +67,29 @@ hosts:
    A:
    MAC: b8:ae:ed:3f:9c:bf
    ID: 097d8c63-d83d-4940-b94d-c6256aa7685a
    IP: 192.168.1.105
    B:
    MAC: b8:ae:ed:3f:9c:b6
    ID: df5db23e-f69f-4faf-b4c2-6e9b6e47704b
    IP: 192.168.1.106
    C:
    MAC: b8:ae:ed:3f:9d:29
    ID: ba1a14d7-a593-4352-9028-4a0976e44c7c
    IP: 192.168.1.107
    D:
    MAC: b8:ae:ed:3f:9c:28
    ID: c24dbe9d-524f-4866-aeb8-e7c38800191d
    IP: 192.168.1.108
    E:
    MAC: b8:ae:ed:39:d8:ef
    ID: f4d0484f-53fb-4f9c-9bce-c7705ec84c3e
    IP: 192.168.1.109
    ```
    TODO: automate this with uuidgen
    ```sh
    cat > hardware-data.json <<EOF
    cat > hardware-data-a.json <<EOF
    {
    "id": "097d8c63-d83d-4940-b94d-c6256aa7685a",
    "metadata": {
    @@ -116,6 +121,134 @@ cat > hardware-data.json <<EOF
    }
    }
    EOF
    cat > hardware-data-b.json <<EOF
    {
    "id": "",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    },
    "instance": {},
    "state": ""
    },
    "network": {
    "interfaces": [
    {
    "dhcp": {
    "arch": "x86_64",
    "ip": {
    "address": "192.168.1.106",
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "uefi": true
    },
    "netboot": {
    "allow_pxe": true,
    "allow_workflow": true
    }
    }
    ]
    }
    }
    EOF
    cat > hardware-data-c.json <<EOF
    {
    "id": "",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    },
    "instance": {},
    "state": ""
    },
    "network": {
    "interfaces": [
    {
    "dhcp": {
    "arch": "x86_64",
    "ip": {
    "address": "192.168.1.107",
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "uefi": true
    },
    "netboot": {
    "allow_pxe": true,
    "allow_workflow": true
    }
    }
    ]
    }
    }
    EOF
    cat > hardware-data-d.json <<EOF
    {
    "id": "",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    },
    "instance": {},
    "state": ""
    },
    "network": {
    "interfaces": [
    {
    "dhcp": {
    "arch": "x86_64",
    "ip": {
    "address": "192.168.1.108",
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "uefi": true
    },
    "netboot": {
    "allow_pxe": true,
    "allow_workflow": true
    }
    }
    ]
    }
    }
    EOF
    cat > hardware-data-e.json <<EOF
    {
    "id": "",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    },
    "instance": {},
    "state": ""
    },
    "network": {
    "interfaces": [
    {
    "dhcp": {
    "arch": "x86_64",
    "ip": {
    "address": "192.168.1.109",
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "",
    "uefi": true
    },
    "netboot": {
    "allow_pxe": true,
    "allow_workflow": true
    }
    }
    ]
    }
    }
    EOF
    ```

    ### Prep for cluster-api-provider-tink
  11. detiber revised this gist Jan 26, 2021. 1 changed file with 19 additions and 4 deletions.
    23 changes: 19 additions & 4 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -62,16 +62,31 @@ TODO: custom build of linuxkit for tinkie (if needed)

    ### Load the hardware definitions into tink

    host macs:
    - b8:ae:ed:3f:9c:bf

    ```yaml
    hosts:
    A:
    MAC: b8:ae:ed:3f:9c:bf
    ID: 097d8c63-d83d-4940-b94d-c6256aa7685a
    B:
    MAC: b8:ae:ed:3f:9c:b6
    ID: df5db23e-f69f-4faf-b4c2-6e9b6e47704b
    C:
    MAC: b8:ae:ed:3f:9d:29
    ID: ba1a14d7-a593-4352-9028-4a0976e44c7c
    D:
    MAC: b8:ae:ed:3f:9c:28
    ID: c24dbe9d-524f-4866-aeb8-e7c38800191d
    E:
    MAC: b8:ae:ed:39:d8:ef
    ID: f4d0484f-53fb-4f9c-9bce-c7705ec84c3e
    ```
    TODO: automate this with uuidgen
    ```sh
    cat > hardware-data.json <<EOF
    {
    "id": "097d8c63-d83d-4940-b94d-c6256aa76850",
    "id": "097d8c63-d83d-4940-b94d-c6256aa7685a",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
  12. detiber revised this gist Jan 26, 2021. 1 changed file with 43 additions and 1 deletion.
    44 changes: 43 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -57,9 +57,51 @@ cd ./deploy
    docker-compose up -d
    ```

    TODO: replace osie with tinkie
    TODO: custom build of linuxkit for tinkie (if needed)

    ### Load the hardware definitions into tink

    TODO
    host macs:
    - b8:ae:ed:3f:9c:bf


    TODO: automate this with uuidgen

    ```sh
    cat > hardware-data.json <<EOF
    {
    "id": "097d8c63-d83d-4940-b94d-c6256aa76850",
    "metadata": {
    "facility": {
    "facility_code": "onprem"
    },
    "instance": {},
    "state": ""
    },
    "network": {
    "interfaces": [
    {
    "dhcp": {
    "arch": "x86_64",
    "ip": {
    "address": "192.168.1.105",
    "gateway": "192.168.1.254",
    "netmask": "255.255.255.0"
    },
    "mac": "b8:ae:ed:3f:9c:bf",
    "uefi": true
    },
    "netboot": {
    "allow_pxe": true,
    "allow_workflow": true
    }
    }
    ]
    }
    }
    EOF
    ```

    ### Prep for cluster-api-provider-tink

  13. detiber revised this gist Jan 25, 2021. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,8 @@ sudo curl -L \
    -o /usr/local/bin/docker-compose

    sudo chmod +x /usr/local/bin/docker-compose

    sudo usermod -aG docker <your user>
    ```

    ## Install and start Tinkerbell from sandbox
    @@ -50,6 +52,23 @@ Modify the generated .env file as needed, for example, I changed TINKERBELL_CIDR
    ```sh
    source .env
    sudo -E ./setup.sh
    sudo chown -R detiber:detiber ~/.docker
    cd ./deploy
    docker-compose up -d
    ```
    ```

    ### Load the hardware definitions into tink

    TODO

    ### Prep for cluster-api-provider-tink

    ```sh
    docker pull detiber/ubuntu-install
    docker tag detiber/ubuntu-install 192.168.1.1/ubuntu-install
    docker push 192.168.1.1/ubuntu-install
    ```

    ### Stand up CAPT

    ### Do the thing
  14. detiber revised this gist Jan 25, 2021. 1 changed file with 26 additions and 3 deletions.
    29 changes: 26 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@

    ## Prerequisites

    - Base ubuntu 20.04 release
    - Bridged gateway with dhcp disabled, configured with a static ip of 192.168.1.254/24
    - Base ubuntu 20.04 release, configured with a static ip of 192.168.1.5/24

    ## Install docker and docker-compose

    @@ -14,7 +15,10 @@ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
    software-properties-common \
    git \
    jq \
    ifupdown

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

    @@ -26,7 +30,26 @@ sudo add-apt-repository \
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io

    sudo curl -L "https://github.com/docker/compose/releases/download/1.28.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    sudo curl -L \
    "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" \
    -o /usr/local/bin/docker-compose

    sudo chmod +x /usr/local/bin/docker-compose
    ```

    ## Install and start Tinkerbell from sandbox

    ```sh
    git clone https://github.com/tinkerbell/sandbox.git
    cd sandbox
    ./generate-envrc.sh enp3s0 .env
    ```

    Modify the generated .env file as needed, for example, I changed TINKERBELL_CIDR from 29 to 24

    ```sh
    source .env
    sudo -E ./setup.sh
    cd ./deploy
    docker-compose up -d
    ```
  15. detiber created this gist Jan 25, 2021.
    32 changes: 32 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Tink

    ## Prerequisites

    - Base ubuntu 20.04 release

    ## Install docker and docker-compose

    ```sh
    sudo apt-get update

    sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

    sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io

    sudo curl -L "https://github.com/docker/compose/releases/download/1.28.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    sudo chmod +x /usr/local/bin/docker-compose
    ```