Skip to content

Commit

Permalink
Merge pull request #958 from threefoldtech/development
Browse files Browse the repository at this point in the history
update master branch with latest
  • Loading branch information
rawdaGastan authored Jul 30, 2024
2 parents 95983cd + 1990228 commit 1796478
Show file tree
Hide file tree
Showing 73 changed files with 1,292 additions and 1,199 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
go-version: 1.21

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
args: --config=.golangci.yml
54 changes: 0 additions & 54 deletions .github/workflows/main_release_test.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
uses: goreleaser/goreleaser-action@v6.0.0
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
Expand Down
92 changes: 86 additions & 6 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
terraform_version: 1.0.11
terraform-version: 1.8.5
- name: install wg and yggdrasil and add peers
run: |
sudo apt-get update
Expand All @@ -38,9 +38,9 @@ jobs:
sudo apt-get update
sudo apt-get install yggdrasil
sudo systemctl enable yggdrasil
PEERS=$(curl https://raw.githubusercontent.com/threefoldtech/zos-config/main/development.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl start yggdrasil
PEERS=$(curl https://raw.githubusercontent.com/AhmedHanafy725/yggdrasil-config/main/config.json | jq '.yggdrasil.peers[]' -r | sed 's/\//\\\//g' | sed -z 's/\n/\\n/g')
sudo sed -i -- 's/Peers\: \[\]/Peers: [\n'"$PEERS"']/g' /etc/yggdrasil/yggdrasil.conf
sudo systemctl restart yggdrasil
- uses: actions/[email protected]
with:
fetch-depth: 0
Expand All @@ -50,9 +50,89 @@ jobs:
mkdir -p ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
go build -o terraform-provider-grid
mv terraform-provider-grid ~/.terraform.d/plugins/threefoldtechdev.com/providers/grid/0.2/linux_amd64/
- name: Run Go Tests
- name: Test virtual machines
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -timeout 3600s
run: go test -v ./... --tags=integration -run TestVM

- name: Test kubernetes
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: |
go test -v ./... --tags=integration -run TestK8s
go test -v ./... --tags=integration -run TestModuleK8s
- name: Test Gateways
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestGatewayDeployments

- name: Test private gateways
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestGatewayPrivate

- name: Test wireguard
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestWireguard

- name: Test ZDBs
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestZdbs

- name: Test QSFS
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestQSFS

- name: Test peertube
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestPeertube

- name: Test presearch
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestPresearch

- name: Test taiga
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestTaiga

- name: Test mattermost
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestMattermost

- name: Test nomad
env:
MNEMONICS: ${{ secrets.MNEMONICS }}
NETWORK: ${{ matrix.network }}
working-directory: integrationtests
run: go test -v ./... --tags=integration -run TestNomad

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
go mod download
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
uses: goreleaser/goreleaser-action@v6.0.0
with:
install-only: true

Expand Down
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
version: 2
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
Expand Down Expand Up @@ -51,8 +52,6 @@ signs:
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true

git:
tag_sort: taggerdate
1 change: 1 addition & 0 deletions examples/resources/gateway_name/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "grid_name_proxy" "p1" {
backends = [format("http://69.164.223.208")]
tls_passthrough = false
}

output "fqdn" {
value = data.grid_gateway_domain.domain.fqdn
}
6 changes: 3 additions & 3 deletions examples/resources/k8s/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ resource "grid_scheduler" "sched" {
}

locals {
solution_type = "Kubernetes"
solution_type = "kubernetes/mr"
name = "myk8s"
}

resource "grid_network" "net1" {
solution_type = local.solution_type
name = local.name
nodes = distinct(values(grid_scheduler.sched.nodes))
ip_range = "10.1.0.0/16"
description = "newer network"
description = "kubernetes network"
add_wg_access = true
mycelium_keys = {
format("%s", grid_scheduler.sched.nodes["master_node"]) = random_bytes.master_mycelium_key.hex
Expand Down
9 changes: 7 additions & 2 deletions examples/resources/mattermost/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ resource "grid_network" "net1" {
description = "newer network"
add_wg_access = true
}

resource "grid_deployment" "d1" {
solution_type = local.solution_type
name = local.name
Expand All @@ -60,29 +61,33 @@ resource "grid_deployment" "d1" {
planetary = true
}
}

# this data source is used to break circular dependency in cases similar to the following:
# vm: needs to know the domain in its init script
# gateway_name: needs the ip of the vm to use as backend.
# - the fqdn can be computed from grid_gateway_domain for the vm
# - the backend can reference the vm ip directly
data "grid_gateway_domain" "domain" {
node = grid_scheduler.sched.nodes["gateway"]
name = "ashrafmattermost"
name = local.name
}

resource "grid_name_proxy" "p1" {
solution_type = local.solution_type
name = local.name
node = grid_scheduler.sched.nodes["gateway"]
backends = [format("http://[%s]:8000", grid_deployment.d1.vms[0].planetary_ip)]
tls_passthrough = false
}

output "fqdn" {
value = data.grid_gateway_domain.domain.fqdn
}

output "node1_zmachine1_ip" {
value = grid_deployment.d1.vms[0].ip
}

output "ygg_ip" {
value = grid_deployment.d1.vms[0].planetary_ip
}

18 changes: 9 additions & 9 deletions examples/resources/nomad_with_modules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ locals {
servers = [
{
name = "server1"
node = 13
node = 13
cpu = 2
memory = 1024
rootfs_size = 1024
Expand All @@ -45,10 +45,10 @@ locals {
}
},
{
name = "server3"
node = 13
cpu = 2
memory = 1024
name = "server3"
node = 13
cpu = 2
memory = 1024
rootfs_size = 1024
disk = {
name = "server3dsk"
Expand All @@ -59,10 +59,10 @@ locals {

clients = [
{
name = "client1"
node = 27
cpu = 2
memory = 1024
name = "client1"
node = 27
cpu = 2
memory = 1024
rootfs_size = 1024
disk = {
name = "client1dsk"
Expand Down
22 changes: 13 additions & 9 deletions examples/resources/peertube/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ resource "grid_scheduler" "sched" {
}

requests {
name = "domain"
public_config = true
name = "domain"
public_config = true
public_ips_count = 1
}
}

locals {
solution_type = "Peertube"
name = "ashraftube"
name = "peertube"
node = grid_scheduler.sched.nodes["peertube"]
}

# this data source is used to break circular dependency in cases similar to the following:
# vm: needs to know the domain in its init script
# gateway_name: needs the ip of the vm to use as backend.
# - the fqdn can be computed from grid_gateway_domain for the vm
# - the backend can reference the vm ip directly
# - the backend can reference the vm ip directly
data "grid_gateway_domain" "domain" {
node = grid_scheduler.sched.nodes["domain"]
name = local.name
Expand All @@ -44,7 +45,7 @@ resource "grid_network" "net1" {
name = local.name
nodes = [grid_scheduler.sched.nodes["peertube"]]
ip_range = "10.1.0.0/16"
description = "newer network"
description = "peertube network"
}
resource "grid_deployment" "d1" {
node = grid_scheduler.sched.nodes["peertube"]
Expand Down Expand Up @@ -73,19 +74,22 @@ resource "grid_deployment" "d1" {
planetary = true
}
}

locals {
ygg_ip = try(length(grid_deployment.d1.vms[0].planetary_ip), 0) > 0 ? grid_deployment.d1.vms[0].planetary_ip : ""
}

resource "grid_name_proxy" "p1" {
node = grid_scheduler.sched.nodes["domain"]
solution_type = local.solution_type
name = local.name
backends = [format("http://[%s]:9000", grid_deployment.d1.vms[0].planetary_ip)]
backends = [format("http://[%s]:9000", local.ygg_ip)]
tls_passthrough = false
}

output "fqdn" {
value = data.grid_gateway_domain.domain.fqdn
}
output "node1_zmachine1_ip" {
value = grid_deployment.d1.vms[0].ip
}

output "ygg_ip" {
value = grid_deployment.d1.vms[0].planetary_ip
Expand Down
Loading

0 comments on commit 1796478

Please sign in to comment.