-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f99ac88
commit c3cf969
Showing
8 changed files
with
138 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
metallb_ip_address_range = "10.70.90.80/29" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: longhorn-system | ||
--- | ||
apiVersion: helm.cattle.io/v1 | ||
kind: HelmChart | ||
metadata: | ||
name: longhorn | ||
namespace: longhorn-system | ||
spec: | ||
repo: https://charts.longhorn.io | ||
chart: longhorn | ||
targetNamespace: longhorn-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
provider "kubernetes" { | ||
config_path = "/etc/rancher/k3s/k3s.yaml" | ||
} | ||
|
||
# Read metallb yaml | ||
data "local_file" "yaml_file" { | ||
filename = "./metallb.yaml" | ||
} | ||
|
||
# Parse the Kubernetes config file | ||
data "yamldecode" "metallb_kubernetes_config" { | ||
# swap a single variable (IP range) | ||
input = replace(data.local_file.yaml_file.content, "CHANGE_ME_IP_RANGE", var.metallb_ip_address_range) | ||
} | ||
|
||
# Create metallb with the manifest | ||
resource "kubernetes_manifest" "metallb" { | ||
manifest = data.yamldecode.metallb_kubernetes_config | ||
} | ||
|
||
# Read longhorn yaml | ||
data "local_file" "longhorn_yaml_file" { | ||
filename = "./longhorn.yaml" | ||
} | ||
|
||
# Parse the Kubernetes config file | ||
data "yamldecode" "longhorn_kubernetes_config" { | ||
input = data.local_file.longhorn_yaml_file.content | ||
} | ||
|
||
# Create longhorn with the manifest | ||
resource "kubernetes_manifest" "longhorn" { | ||
manifest = data.yamldecode.longhorn_kubernetes_config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: metallb-system | ||
--- | ||
apiVersion: helm.cattle.io/v1 | ||
kind: HelmChart | ||
metadata: | ||
name: metallb | ||
namespace: metallb-system | ||
spec: | ||
repo: https://metallb.github.io/metallb | ||
chart: metallb | ||
targetNamespace: metallb-system | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: IPAddressPool | ||
metadata: | ||
name: pool-1 | ||
namespace: metallb-system | ||
spec: | ||
addresses: | ||
- "CHANGE_ME_IP_RANGE" | ||
--- | ||
apiVersion: metallb.io/v1beta1 | ||
kind: L2Advertisement | ||
metadata: | ||
name: k3s-l2 | ||
namespace: metallb-system | ||
spec: | ||
ipAddressPools: | ||
- pool-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "metallb_ip_address_range" { | ||
type = string | ||
description = "ip range to be used by metallb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Create meshdb_mgmt directory | ||
MGMT_DIR="/opt/meshdb_mgmt" | ||
mkdir -p $MGMT_DIR | ||
cd $MGMT_DIR | ||
|
||
# Clone the repo | ||
apt-get update && apt-get install -y git | ||
git clone https://github.com/nycmeshnet/meshdb.git | ||
|
||
# JBO TODO REMOVE DEBUG | ||
cd meshdb | ||
git checkout james/infra_updates | ||
cd .. | ||
# END DEBUG | ||
|
||
# Setup secret files (will need to be modified) | ||
cp meshdb/infra/helm/meshdb/secret.values.yaml ./secret.values.yaml | ||
cp meshdb/infra/helm/meshdb/values.yaml ./values.yaml | ||
cp meshdb/infra/tf/example.tfvars ./local.tfvars | ||
cp meshdb/infra/cluster/cluster_example.tfvars ./cluster_local.tfvars | ||
|
||
# Setup k3s | ||
curl -sfL https://get.k3s.io | sh -s - server --cluster-init --disable servicelb | ||
|
||
echo "cluster-init: true" >> /etc/rancher/k3s/config.yaml | ||
echo "disable: servicelb" >> /etc/rancher/k3s/config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# setup_node.sh | ||
MASTER_IP="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)" | ||
NODE_TOKEN="$(cat /var/lib/rancher/k3s/server/node-token)" | ||
|
||
target_host="$1" | ||
|
||
ssh -t ubuntu@$target_host "curl -sfL https://get.k3s.io>k3s; sudo bash k3s --server https://${MASTER_IP}:6443 --token $NODE_TOKEN;sudo apt-get update && sudo apt-get install nfs-common -y"0 |