From 75c27f6a7628299f20ee0cfa6ac4111c8a1d066f Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Thu, 22 Jun 2023 14:50:40 -0400 Subject: [PATCH 01/12] domain flag for auto installs --- scripts/nm-quick.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index 98541f16f..8ae3d80ab 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -4,7 +4,7 @@ CONFIG_FILE=netmaker.env # location of nm-quick.sh (usually `/root`) SCRIPT_DIR=$(dirname "$(realpath "$0")") CONFIG_PATH="$SCRIPT_DIR/$CONFIG_FILE" -NM_QUICK_VERSION="0.1.0" +NM_QUICK_VERSION="0.1.1" LATEST=$(curl -s https://api.github.com/repos/gravitl/netmaker/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d [:space:],\") if [ $(id -u) -ne 0 ]; then @@ -17,11 +17,12 @@ unset BUILD_TYPE unset BUILD_TAG unset IMAGE_TAG unset AUTO_BUILD +unset NETMAKER_BASE_DOMAIN # usage - displays usage instructions usage() { echo "nm-quick.sh v$NM_QUICK_VERSION" - echo "usage: ./nm-quick.sh [-e] [-b buildtype] [-t tag] [-a auto]" + echo "usage: ./nm-quick.sh [-e] [-b buildtype] [-t tag] [-a auto] [-d domain]" echo " -e if specified, will install netmaker EE" echo " -b type of build; options:" echo " \"version\" - will install a specific version of Netmaker using remote git and dockerhub" @@ -29,14 +30,16 @@ usage() { echo " \"branch\": - will install a specific branch using remote git and dockerhub" echo " -t tag of build; if buildtype=version, tag=version. If builtype=branch or builtype=local, tag=branch" echo " -a auto-build; skip prompts and use defaults, if none provided" + echo " -d domain; if specified, will use this domain instead of auto-generating one" echo "examples:" echo " nm-quick.sh -e -b version -t $LATEST" echo " nm-quick.sh -e -b local -t feature_v0.17.2_newfeature" echo " nm-quick.sh -e -b branch -t develop" + echo " nm-quick.sh -e -b version -t $LATEST -a -d example.com" exit 1 } -while getopts evab:t: flag; do +while getopts evab:d:t: flag; do case "${flag}" in e) INSTALL_TYPE="ee" @@ -60,6 +63,9 @@ while getopts evab:t: flag; do t) BUILD_TAG=${OPTARG} ;; + d) + NETMAKER_BASE_DOMAIN=${OPTARG} + ;; esac done @@ -490,8 +496,9 @@ set_install_vars() { if [ "$IP_ADDR" = "" ]; then IP_ADDR=$(curl -s ifconfig.me) fi - - NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io + if [ "$NETMAKER_BASE_DOMAIN" = "" ]; then + NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io + fi SERVER_HOST=$IP_ADDR if test -z "$MASTER_KEY"; then MASTER_KEY=$( From 4903f2ecca95487080cb20cfb8167d5af6daeced Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Mon, 26 Jun 2023 09:51:03 -0400 Subject: [PATCH 02/12] use static servers with custom domain (#2421) --- .github/workflows/branchtest.yml | 57 ++++++++++++++++++++++++++-- .github/workflows/deletedroplets.yml | 28 ++++++++++++-- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/.github/workflows/branchtest.yml b/.github/workflows/branchtest.yml index 03c4ff586..63a41159d 100644 --- a/.github/workflows/branchtest.yml +++ b/.github/workflows/branchtest.yml @@ -10,12 +10,13 @@ jobs: skip-check: runs-on: ubuntu-latest outputs: - skip: ${{ steps.check.outputs.skip }} + skip: ${{ steps.skip.outputs.skip }} steps: - id: skip uses: fkirc/skip-duplicate-actions@v5 with: concurrent_skipping: 'always' + getbranch: runs-on: ubuntu-latest needs: skip-check @@ -29,7 +30,7 @@ jobs: repository: gravitl/netclient ref: develop - name: check if branch exists - id: checkbranch + id: getbranch run: | if git show-ref ${{ github.head_ref}}; then echo branch exists @@ -39,12 +40,62 @@ jobs: echo "netclientbranch=develop" >> $GITHUB_OUTPUT fi + getserver: + runs-on: ubuntu-latest + needs: skip-check + if: ${{ needs.skip-check.outputs.skip != 'true' }} + outputs: + netmakerserver: ${{ steps.getserver.outputs.server }} + steps: + - name: setup ssh + run: | + mkdir -p ~/.ssh/ + echo "$SSH_KEY" > ~/.ssh/id_devops + chmod 600 ~/.ssh/id_devops + cat >>~/.ssh/config <> /tmp/server + break + fi + done + echo server is $server + if [ "$server" == "" ] + then + echo server not set + exit 1 + fi + echo "netmakerserver=${ server }" >> $GITHUB_OUTPUT + - name: save server name + uses: actions/upload-artifact@v3 + with: + name: server + path: /tmp/ping + retention-days: 3 + terraform: - needs: getbranch + needs: [getbranch, getserver] uses: gravitl/devops/.github/workflows/terraform.yml@master with: netmakerbranch: ${{ github.head_ref }} netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }} + server: ${{ needs.getserver.outputs.netmakerserver }} secrets: inherit diff --git a/.github/workflows/deletedroplets.yml b/.github/workflows/deletedroplets.yml index 406349a92..7ec939dd0 100644 --- a/.github/workflows/deletedroplets.yml +++ b/.github/workflows/deletedroplets.yml @@ -16,6 +16,9 @@ jobs: with: run_id: ${{ github.event.workflow_run.id}} if_no_artifact_found: warn + - name: get server name + run: | + echo "SERVER=$(cat ./server/server) >> $GITHUB_ENV" - name: discord success message uses: appleboy/discord-action@master with: @@ -23,7 +26,7 @@ jobs: webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} color: "#42f545" username: "GitHub Bot" - message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} was successful: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}) will be deleted in 15 min" + message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} on dashboard.${{ env.SERVER }}.clustercat.com was successful: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}) will be deleted in 15 min" file: ./results/results.log - name: delete droplets if: success() || failure() @@ -36,6 +39,14 @@ jobs: env: DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }} + - name: mark server as available + uses: appleboy/ssh-action@master + with: + host: server.${{ env.SERVER }}.clustercat.com + username: root + key: ${{ secrets.TESTING_SSH_KEY }} + script: | + rm /tmp/branchtest on-failure: runs-on: ubuntu-latest @@ -46,6 +57,9 @@ jobs: with: run_id: ${{ github.event.workflow_run.id}} if_no_artifact_found: warn + - name: get server name + run: | + echo "SERVER=$(cat ./server/server) >> $GITHUB_ENV" - name: discord failure message uses: appleboy/discord-action@master with: @@ -53,7 +67,7 @@ jobs: webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} color: "#990000" username: "GitHub Bot" - message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} failed: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt}}) will be deleted in 5 hours" + message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} failed: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt}}) will be deleted in 3 hours" file: ./results/results.log - name: discord error message uses: appleboy/discord-action@master @@ -67,7 +81,7 @@ jobs: - name: delete droplets if: success() || failure() run: | - sleep 5h + sleep 3h curl -X GET \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ @@ -75,3 +89,11 @@ jobs: env: DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }} + - name: mark server as available + uses: appleboy/ssh-action@master + with: + host: server.${{ env.SERVER }}.clustercat.com + username: root + key: ${{ secrets.TESTING_SSH_KEY }} + script: | + rm /tmp/branchtest From 287c9f496c2d81b5a98505bc5f0bee45b2da3d9c Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Mon, 10 Jul 2023 14:18:50 +0530 Subject: [PATCH 03/12] send delete peer update always --- controllers/node.go | 11 +++-------- logic/peers.go | 13 ++++++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/controllers/node.go b/controllers/node.go index 667fbb519..5b893313b 100644 --- a/controllers/node.go +++ b/controllers/node.go @@ -770,17 +770,12 @@ func deleteNode(w http.ResponseWriter, r *http.Request) { if !fromNode { // notify node change runUpdates(&node, false) } - go func(deletedNode *models.Node, fromNode bool) { // notify of peer change + go func(deletedNode *models.Node) { // notify of peer change var err error - if fromNode { - err = mq.PublishDeletedNodePeerUpdate(deletedNode) - } else { - err = mq.PublishPeerUpdate() - } + err = mq.PublishDeletedNodePeerUpdate(deletedNode) if err != nil { logger.Log(1, "error publishing peer update ", err.Error()) } - host, err := logic.GetHost(node.HostID.String()) if err != nil { logger.Log(1, "failed to retrieve host for node", node.ID.String(), err.Error()) @@ -788,7 +783,7 @@ func deleteNode(w http.ResponseWriter, r *http.Request) { if err := mq.PublishDNSDelete(&node, host); err != nil { logger.Log(1, "error publishing dns update", err.Error()) } - }(&node, fromNode) + }(&node) } func runUpdates(node *models.Node, ifaceDelta bool) { diff --git a/logic/peers.go b/logic/peers.go index 909a2e32d..6b251922f 100644 --- a/logic/peers.go +++ b/logic/peers.go @@ -312,7 +312,6 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N } hostPeerUpdate.NodePeers = append(hostPeerUpdate.NodePeers, nodePeer) } - //} } var extPeers []wgtypes.PeerConfig var extPeerIDAndAddrs []models.IDandAddr @@ -387,6 +386,18 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N } hostPeerUpdate.Peers[i] = peer } + if deletedNode != nil { + peerHost, err := GetHost(deletedNode.HostID.String()) + if err == nil && host.ID != peerHost.ID { + if _, ok := peerIndexMap[peerHost.PublicKey.String()]; !ok { + hostPeerUpdate.Peers = append(hostPeerUpdate.Peers, wgtypes.PeerConfig{ + PublicKey: peerHost.PublicKey, + Remove: true, + }) + } + } + + } for i := range hostPeerUpdate.NodePeers { peer := hostPeerUpdate.NodePeers[i] From 3f11ddd8c57b09fe75abb3f012c9f6bba739089d Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Mon, 10 Jul 2023 16:05:36 +0530 Subject: [PATCH 04/12] fix add/remove host api calls --- controllers/hosts.go | 35 ++++++++++++++++++++++++----------- controllers/node.go | 7 +++---- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/controllers/hosts.go b/controllers/hosts.go index 92f0fd897..06e7b975f 100644 --- a/controllers/hosts.go +++ b/controllers/hosts.go @@ -9,7 +9,6 @@ import ( "github.com/gorilla/mux" "github.com/gravitl/netmaker/logger" "github.com/gravitl/netmaker/logic" - "github.com/gravitl/netmaker/logic/hostactions" "github.com/gravitl/netmaker/models" "github.com/gravitl/netmaker/mq" "github.com/gravitl/netmaker/servercfg" @@ -259,18 +258,13 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) { return } logger.Log(1, "added new node", newNode.ID.String(), "to host", currHost.Name) - hostactions.AddAction(models.HostUpdate{ + + mq.HostUpdate(&models.HostUpdate{ Action: models.JoinHostToNetwork, Host: *currHost, Node: *newNode, }) - if servercfg.IsMessageQueueBackend() { - mq.HostUpdate(&models.HostUpdate{ - Action: models.RequestAck, - Host: *currHost, - }) - } - + go mq.PublishPeerUpdate() logger.Log(2, r.Header.Get("user"), fmt.Sprintf("added host %s to network %s", currHost.Name, network)) w.WriteHeader(http.StatusOK) } @@ -309,6 +303,25 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) { logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal")) return } + if node.IsRelayed { + // cleanup node from relayednodes on relay node + relayNode, err := logic.GetNodeByID(node.RelayedBy) + if err == nil { + relayedNodes := []string{} + for _, relayedNodeID := range relayNode.RelayedNodes { + if relayedNodeID == node.ID.String() { + continue + } + relayedNodes = append(relayedNodes, relayedNodeID) + } + relayNode.RelayedNodes = relayedNodes + logic.UpsertNode(&relayNode) + } + } + if node.IsRelay { + // unset all the relayed nodes + logic.SetRelayedNodes(false, node.ID.String(), node.RelayedNodes) + } node.Action = models.NODE_DELETE node.PendingDelete = true logger.Log(1, "deleting node", node.ID.String(), "from host", currHost.Name) @@ -317,10 +330,10 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) { return } // notify node change - runUpdates(node, false) go func() { // notify of peer change - if err := mq.PublishPeerUpdate(); err != nil { + err = mq.PublishDeletedNodePeerUpdate(node) + if err != nil { logger.Log(1, "error publishing peer update ", err.Error()) } if err := mq.PublishDNSDelete(node, currHost); err != nil { diff --git a/controllers/node.go b/controllers/node.go index 5b893313b..7be7c2fac 100644 --- a/controllers/node.go +++ b/controllers/node.go @@ -754,7 +754,6 @@ func deleteNode(w http.ResponseWriter, r *http.Request) { relayNode.RelayedNodes = relayedNodes logic.UpsertNode(&relayNode) } - } if node.IsRelay { // unset all the relayed nodes @@ -770,9 +769,9 @@ func deleteNode(w http.ResponseWriter, r *http.Request) { if !fromNode { // notify node change runUpdates(&node, false) } - go func(deletedNode *models.Node) { // notify of peer change + go func() { // notify of peer change var err error - err = mq.PublishDeletedNodePeerUpdate(deletedNode) + err = mq.PublishDeletedNodePeerUpdate(&node) if err != nil { logger.Log(1, "error publishing peer update ", err.Error()) } @@ -783,7 +782,7 @@ func deleteNode(w http.ResponseWriter, r *http.Request) { if err := mq.PublishDNSDelete(&node, host); err != nil { logger.Log(1, "error publishing dns update", err.Error()) } - }(&node) + }() } func runUpdates(node *models.Node, ifaceDelta bool) { From 504ce7feb99d387f582ee62218d3f222d18bc3d4 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Mon, 10 Jul 2023 16:56:03 +0530 Subject: [PATCH 05/12] keep mq updates in a single go func --- controllers/hosts.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/controllers/hosts.go b/controllers/hosts.go index 06e7b975f..fa27cfdfa 100644 --- a/controllers/hosts.go +++ b/controllers/hosts.go @@ -258,13 +258,14 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) { return } logger.Log(1, "added new node", newNode.ID.String(), "to host", currHost.Name) - - mq.HostUpdate(&models.HostUpdate{ - Action: models.JoinHostToNetwork, - Host: *currHost, - Node: *newNode, - }) - go mq.PublishPeerUpdate() + go func() { + mq.HostUpdate(&models.HostUpdate{ + Action: models.JoinHostToNetwork, + Host: *currHost, + Node: *newNode, + }) + mq.PublishPeerUpdate() + }() logger.Log(2, r.Header.Get("user"), fmt.Sprintf("added host %s to network %s", currHost.Name, network)) w.WriteHeader(http.StatusOK) } From 81ca3b87972991e7f4a69f9b9fb882acfb0035f6 Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Tue, 11 Jul 2023 03:32:16 -0400 Subject: [PATCH 06/12] move branch test logic to devops (#2443) --- .github/workflows/branchtest.yml | 71 +++----------------------------- 1 file changed, 5 insertions(+), 66 deletions(-) diff --git a/.github/workflows/branchtest.yml b/.github/workflows/branchtest.yml index 5aaead6d6..ed545dee2 100644 --- a/.github/workflows/branchtest.yml +++ b/.github/workflows/branchtest.yml @@ -39,73 +39,12 @@ jobs: echo branch does not exist echo "netclientbranch=develop" >> $GITHUB_OUTPUT fi - - getserver: - runs-on: ubuntu-latest - needs: skip-check - if: ${{ needs.skip-check.outputs.skip != 'true' }} - outputs: - netmakerserver: ${{ steps.getserver.outputs.server }} - steps: - - name: setup ssh - run: | - mkdir -p ~/.ssh/ - echo "$SSH_KEY" > ~/.ssh/id_devops - chmod 600 ~/.ssh/id_devops - cat >>~/.ssh/config <> /tmp/server - - break - fi - done - echo server is $server - if [ "$server" == "" ] - then - echo server not set - exit 1 - fi - echo "netmakerserver=${ server }" >> $GITHUB_OUTPUT - - name: save server name - uses: actions/upload-artifact@v3 - with: - name: server - path: /tmp/ping - retention-days: 3 - - terraform: - needs: [getbranch, getserver] - uses: gravitl/devops/.github/workflows/terraform.yml@master + branchtest: + uses: gravitl/devops/.github/workflows/testdeploybranch.yml@master + needs: [getbranch, skip-check] with: - netmakerbranch: ${{ github.head_ref }} netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }} - server: ${{ needs.getserver.outputs.netmakerserver }} - secrets: inherit - - - testbranch: - needs: [getbranch, terraform] - uses: gravitl/devops/.github/workflows/branchtest.yml@master - with: + netmakerbranch: ${{ github.head_ref }} tag: ${{ github.run_id }}-${{ github.run_attempt }} - network: netmaker - secrets: inherit - + secrets: inherit From fc3261c90ad378f04673a9a4d648f1f63f88514a Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Tue, 11 Jul 2023 19:08:29 +0530 Subject: [PATCH 07/12] handle IOT OS --- logic/peers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic/peers.go b/logic/peers.go index 6b251922f..a90f7e739 100644 --- a/logic/peers.go +++ b/logic/peers.go @@ -386,7 +386,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N } hostPeerUpdate.Peers[i] = peer } - if deletedNode != nil { + if deletedNode != nil && host.OS != models.OS_Types.IoT { peerHost, err := GetHost(deletedNode.HostID.String()) if err == nil && host.ID != peerHost.ID { if _, ok := peerIndexMap[peerHost.PublicKey.String()]; !ok { From 2b48deaf61bc59dae9831cb9d6ce136027d7ae0f Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Mon, 24 Jul 2023 04:06:53 -0400 Subject: [PATCH 08/12] save server name to env (#2460) --- .github/workflows/deletedroplets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deletedroplets.yml b/.github/workflows/deletedroplets.yml index 359bd7b0d..2be81983a 100644 --- a/.github/workflows/deletedroplets.yml +++ b/.github/workflows/deletedroplets.yml @@ -18,7 +18,7 @@ jobs: if_no_artifact_found: warn - name: get server name run: | - echo "SERVER=$(cat ./server/server) >> $GITHUB_ENV" + echo "SERVER=$(cat ./server/server)" >> $GITHUB_ENV - name: discord success message uses: appleboy/discord-action@master with: @@ -59,7 +59,7 @@ jobs: if_no_artifact_found: warn - name: get server name run: | - echo "SERVER=$(cat ./server/server) >> $GITHUB_ENV" + echo "SERVER=$(cat ./server/server)" >> $GITHUB_ENV - name: discord failure message uses: appleboy/discord-action@master with: From 46cddad98a1285ce69ecec87e302c3f8ba6867d5 Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Wed, 26 Jul 2023 16:17:01 -0400 Subject: [PATCH 09/12] ensure branch test servers available after test runs (#2467) * save server name to env * free server always; add PR to discord messages --- .github/workflows/deletedroplets.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/deletedroplets.yml b/.github/workflows/deletedroplets.yml index 2be81983a..986b9a067 100644 --- a/.github/workflows/deletedroplets.yml +++ b/.github/workflows/deletedroplets.yml @@ -19,6 +19,12 @@ jobs: - name: get server name run: | echo "SERVER=$(cat ./server/server)" >> $GITHUB_ENV + - name: get PR + env: + GH_TOKEN: ${{ github.token }} + run: | + echo "pull_request=$(gh api -H 'Accept: application/vnd.github+json' -H 'X-Github-Api-Version: 2022-11-28' \ + /repos/${{ github.repository}}/actions/runs/${{ github.event.workflow_run.id }} | jq .pull_requests[0].number)" >> $GITHUB_ENV - name: discord success message uses: appleboy/discord-action@master with: @@ -40,6 +46,7 @@ jobs: DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }} - name: mark server as available + if: success() || failure() uses: appleboy/ssh-action@master with: host: server.${{ env.SERVER }}.clustercat.com @@ -60,6 +67,12 @@ jobs: - name: get server name run: | echo "SERVER=$(cat ./server/server)" >> $GITHUB_ENV + - name: get PR + env: + GH_TOKEN: ${{ github.token }} + run: | + echo "pull_request=$(gh api -H 'Accept: application/vnd.github+json' -H 'X-Github-Api-Version: 2022-11-28' \ + /repos/${{ github.repository}}/actions/runs/${{ github.event.workflow_run.id }} | jq .pull_requests[0].number)" >> $GITHUB_ENV - name: discord failure message uses: appleboy/discord-action@master with: @@ -90,6 +103,7 @@ jobs: DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} TAG: ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }} - name: mark server as available + if: success() || failure() uses: appleboy/ssh-action@master with: host: server.${{ env.SERVER }}.clustercat.com From 002ac80d887ae966cc16a126a00b261b5e9aa75e Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Thu, 27 Jul 2023 02:02:23 -0400 Subject: [PATCH 10/12] use correct method to delete droplets (#2468) --- .github/workflows/deletedroplets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deletedroplets.yml b/.github/workflows/deletedroplets.yml index 986b9a067..5e1917929 100644 --- a/.github/workflows/deletedroplets.yml +++ b/.github/workflows/deletedroplets.yml @@ -38,7 +38,7 @@ jobs: if: success() || failure() run: | sleep 15m - curl -X GET \ + curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ "https://api.digitalocean.com/v2/droplets?tag_name=$TAG" @@ -95,7 +95,7 @@ jobs: if: success() || failure() run: | sleep 3h - curl -X GET \ + curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ "https://api.digitalocean.com/v2/droplets?tag_name=$TAG" From 155c6b0d2f91c4fa5bfc5dc6ea7306499cbe9802 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Fri, 18 Aug 2023 22:00:38 +0530 Subject: [PATCH 11/12] set coredns to 1.10.1 version --- compose/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index d17275291..7fbf71136 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -62,7 +62,7 @@ services: coredns: container_name: coredns - image: coredns/coredns + image: coredns/coredns:1.10.1 command: -conf /root/dnsconfig/Corefile env_file: ./netmaker.env depends_on: From d225608ee9417e6d431fb8c5dd86ad5bf012a116 Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Tue, 22 Aug 2023 15:24:32 -0400 Subject: [PATCH 12/12] update node expiration during migration --- controllers/migrate.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/migrate.go b/controllers/migrate.go index 6bf2e540f..0d365664c 100644 --- a/controllers/migrate.go +++ b/controllers/migrate.go @@ -5,7 +5,6 @@ import ( "fmt" "net" "net/http" - "strconv" "time" "github.com/google/uuid" @@ -201,7 +200,7 @@ func convertLegacyNode(legacy models.LegacyNode, hostID uuid.UUID) models.Node { node.DNSOn = models.ParseBool(legacy.DNSOn) node.PersistentKeepalive = time.Duration(int64(time.Second) * int64(legacy.PersistentKeepalive)) node.LastModified = time.Now() - node.ExpirationDateTime, _ = time.Parse(strconv.Itoa(int(legacy.ExpirationDateTime)), "0") + node.ExpirationDateTime = time.Unix(legacy.ExpirationDateTime, 0) node.EgressGatewayNatEnabled = models.ParseBool(legacy.EgressGatewayNatEnabled) node.EgressGatewayRequest = legacy.EgressGatewayRequest node.IngressGatewayRange = legacy.IngressGatewayRange