Skip to content

Commit

Permalink
add EdgeNet@home configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmouchet committed Mar 29, 2022
1 parent 8fc2b1a commit eb84daf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
8 changes: 8 additions & 0 deletions edgenet-at-home-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- hosts: all
become: true
roles:
- edgenet-ssh
- edgenet-kubernetes
vars_files:
- vars/edgenet-at-home.yml
13 changes: 4 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"time"
)

const defaultKubeconfigURL = "https://raw.githubusercontent.com/EdgeNet-project/edgenet/master/configs/public.cfg"
const defaultVPNNetworkV4 = "10.183.0.0/20"
const defaultVPNNetworkV6 = "fdb4:ae86:ec99:4004::/64"
const edgenetConfigFile = "/opt/edgenet/config.yaml"
Expand Down Expand Up @@ -157,10 +156,6 @@ func main() {
config.load(edgenetConfigFile)
log.Printf("config=%+v\n", config)

if config.KubeconfigURL == "" {
config.KubeconfigURL = defaultKubeconfigURL
}

if config.Platform == "" {
log.Println("step=detect-platform")
config.Platform = platforms.Detect()
Expand Down Expand Up @@ -188,7 +183,7 @@ func main() {
check(err)
_, vpnNetworkV6, err := net.ParseCIDR(defaultVPNNetworkV6)
check(err)
config.VPNIPv4, config.VPNIPv6 = cluster.FindVPNIPs(defaultKubeconfigURL, *vpnNetworkV4, *vpnNetworkV6)
config.VPNIPv4, config.VPNIPv6 = cluster.FindVPNIPs(config.KubeconfigURL, *vpnNetworkV4, *vpnNetworkV6)
}

if config.VPNPrivateKey == "" {
Expand Down Expand Up @@ -219,9 +214,9 @@ func main() {
network.AssignVPNIP(vpnLinkName, *config.VPNIPv4, *config.VPNIPv6)
privateKey, err := wgtypes.ParseKey(config.VPNPrivateKey)
check(err)
cluster.CreateVPNPeer(defaultKubeconfigURL, hostname, config.PublicIPv4, config.VPNIPv4.IP, config.VPNIPv6.IP, config.VPNListenPort, privateKey.PublicKey().String())
cluster.CreateVPNPeer(config.KubeconfigURL, hostname, config.PublicIPv4, config.VPNIPv4.IP, config.VPNIPv6.IP, config.VPNListenPort, privateKey.PublicKey().String())
// Pre-establish the tunnels before the VPNPeer controller gets started.
peers := cluster.ListVPNPeer(defaultKubeconfigURL)
peers := cluster.ListVPNPeer(config.KubeconfigURL)
for _, peer := range peers {
network.AddPeer(vpnLinkName, peer)
}
Expand All @@ -239,5 +234,5 @@ func main() {
network.SetKubeletNodeIP(kubeletEnvFileRedHat, nodeIP)

log.Println("step=join-cluster")
cluster.Join(defaultKubeconfigURL, hostname, nodeIP)
cluster.Join(config.KubeconfigURL, hostname, nodeIP)
}
6 changes: 6 additions & 0 deletions roles/edgenet-kubernetes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
state: directory
mode: "0755"

- name: Ensure EdgeNet configuration is present
template:
src: edgenet-config.yaml.j2
dest: /opt/edgenet/config.yaml
mode: 0644

- name: Ensure EdgeNet binary is present
get_url:
url: "{{ edgenet_node_url }}"
Expand Down
1 change: 1 addition & 0 deletions roles/edgenet-kubernetes/templates/edgenet-config.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubeconfigURL: {{ kubeconfig_url }}
2 changes: 1 addition & 1 deletion roles/edgenet-ssh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
groups: wheel
append: true
createhome: true
comment: EdgeNet (edge-net.org)
comment: edge-net.org

- name: Ensure the .ssh directory is present
file:
Expand Down
6 changes: 6 additions & 0 deletions vars/edgenet-at-home.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# edgenet-kubernetes
containerd_version: 1.6
kubernetes_version: 1.23
edgenet_node_version: 1.0.13
# edgenet-ssh
edgenet_ssh_public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0yU5EV3zQaP/2Ln4do32sHLm9NdU7p3vQUIKY/AttBp+91equT2jA7SD+71aOYiEp8TzjNCCN98DJxwyhT4MM0FRkd0KbgB3djk4rDJ4ePSeqPtmEXwzRfbnrMqfs9pt0STGWLqpCkPrX7Vfo89PyNMi3fGJaKJ+8AcYf40uLQm5MrPS1XZIOYi+UOru7VlgA53UxGkG0NorjCMYw5Sqt0q4Ds1pURBGq+dorbwgur4SgtYLURXvEqJG8q32Ta6q2hLQ6jJ3/hPaEs5Uc/pEmAoS5QMK5HLQtJxTlNQ3WfMz+Oz1NZRAaZO3TrrGKs4J2bUu9d6fbn1XIYtCF9ABXI+cBYPMk8RtOyNR8Rl9mxa1qN6KDgeCJR897Bo/IIIBwdthfK3kpQsK/PvPJIlTbga/e7r6fnYfXpa1Ycs36AfwZko6W5BorxMXza7asRLNvDa2TgZmfTsTEBut8Jw1BRIJWkvZRWbAmS13XE/bUPO3win0nq4CPO/8Q2UlqzudaDEWqrnlB7bgrEUoMSyTp0yG9JG1DAgKXOk9Z0dcUZ/XyhwSeR/nET7avKO2ixWX+1CPqPIHA3Ya3BYlWwYBkdEStA5k3c/7lrSRVzbBhsW9x8InyeLh+Tiv4VNG9V0BnsDzS6zppk+QpvlVfJBpNGfFTvoEsaSf6HcA8+V12Pw== root@ehome.planet-lab.eu
2 changes: 1 addition & 1 deletion vars/edgenet-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# edgenet-kubernetes
containerd_version: 1.4
kubernetes_version: 1.21
edgenet_node_version: 1.0.12
edgenet_node_version: 1.0.13

0 comments on commit eb84daf

Please sign in to comment.