mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-09-30 20:46:32 +00:00
Sketch out new pod creation flow
This commit is contained in:
+21
-6
@@ -1,5 +1,6 @@
|
||||
from .gcloud import Gcloud
|
||||
from .kubernetes import Kubernetes
|
||||
from .template import Ethereum
|
||||
from .table import table
|
||||
|
||||
|
||||
@@ -9,13 +10,13 @@ class Bootnode(object):
|
||||
self.kube = Kubernetes()
|
||||
|
||||
# Disks
|
||||
def list_disks(self, network=None):
|
||||
table(self.gcloud.list_disks(network=network), 'name', 'status', 'link')
|
||||
|
||||
def create_disk(self, snapshot, name):
|
||||
snap = self.gcloud.get_snapshot(snapshot)
|
||||
print(snap.create_disk(name))
|
||||
|
||||
def list_disks(self, network=None):
|
||||
table(self.gcloud.list_disks(network=network), 'name', 'status', 'link')
|
||||
|
||||
def get_disk(self, name):
|
||||
table(self.gcloud.get_disk(name), ['name', 'status', 'link'])
|
||||
|
||||
@@ -23,12 +24,12 @@ class Bootnode(object):
|
||||
table(self.gcloud.last_disk(network=network), 'name', 'status', 'link')
|
||||
|
||||
# Snapshots
|
||||
def get_snapshot(self, name):
|
||||
table(self.gcloud.get_snapshot(name), 'name', 'status', 'link')
|
||||
|
||||
def list_snapshots(self, network=None):
|
||||
table(self.gcloud.list_snapshots(network=network), 'name', 'status', 'link')
|
||||
|
||||
def get_snapshot(self, name):
|
||||
table(self.gcloud.get_snapshot(name), 'name', 'status', 'link')
|
||||
|
||||
def get_last_snapshot(self, network=None):
|
||||
table(self.gcloud.get_last_snapshot(network=network), 'name', 'status', 'link')
|
||||
|
||||
@@ -60,6 +61,20 @@ class Bootnode(object):
|
||||
print(self.gcloud.snapshot_disk(pod.disk, name, pod_name=pod.name))
|
||||
|
||||
# Pods
|
||||
def create_pod(self, network, name):
|
||||
network = Ethereum.normalize_network(network)
|
||||
# snap = self.gcloud.get_last_snapshot(network)
|
||||
# if snap:
|
||||
# snap.create_disk(name)
|
||||
# else:
|
||||
# self.gcloud.create_disk(name)
|
||||
|
||||
# config = Ethereum(name, network)
|
||||
# pool = self.kube.get_pool(network)
|
||||
# if not pool:
|
||||
# self.kube.create_pool(network)
|
||||
# self.gcloud.create_pod(disk, name, config)
|
||||
|
||||
def list_pods(self, network=None):
|
||||
table(self.kube.list_pods(network=network), 'name', 'phase', 'block_number', 'ip')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user