cluster: rename pkg/zones to pkg/cluster
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "git.jpi.io/amery/jpictl/pkg/zones"
|
import "git.jpi.io/amery/jpictl/pkg/cluster"
|
||||||
|
|
||||||
// Config describes the repository
|
// Config describes the repository
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@@ -14,9 +14,9 @@ var cfg = &Config{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoadZones loads all zones and machines in the config directory
|
// LoadZones loads all zones and machines in the config directory
|
||||||
func (cfg *Config) LoadZones(resolve bool) (*zones.Zones, error) {
|
func (cfg *Config) LoadZones(resolve bool) (*cluster.Zones, error) {
|
||||||
return zones.New(cfg.Base, cfg.Domain,
|
return cluster.New(cfg.Base, cfg.Domain,
|
||||||
zones.ResolvePublicAddresses(resolve),
|
cluster.ResolvePublicAddresses(resolve),
|
||||||
zones.WithLogger(log),
|
cluster.WithLogger(log),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-9
@@ -7,8 +7,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.jpi.io/amery/jpictl/pkg/zones"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"git.jpi.io/amery/jpictl/pkg/cluster"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command
|
// Command
|
||||||
@@ -38,9 +39,9 @@ var gatewaySetCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatewaySet(zi zones.ZoneIterator, gw string) error {
|
func gatewaySet(zi cluster.ZoneIterator, gw string) error {
|
||||||
var err error
|
var err error
|
||||||
zi.ForEachZone(func(z *zones.Zone) bool {
|
zi.ForEachZone(func(z *cluster.Zone) bool {
|
||||||
for _, m := range z.Machines {
|
for _, m := range z.Machines {
|
||||||
if m.Name == gw {
|
if m.Name == gw {
|
||||||
z.SetGateway(m.ID, true)
|
z.SetGateway(m.ID, true)
|
||||||
@@ -74,9 +75,9 @@ var gatewayUnsetCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatewayUnset(zi zones.ZoneIterator, ngw string) error {
|
func gatewayUnset(zi cluster.ZoneIterator, ngw string) error {
|
||||||
var err error
|
var err error
|
||||||
zi.ForEachZone(func(z *zones.Zone) bool {
|
zi.ForEachZone(func(z *cluster.Zone) bool {
|
||||||
for _, m := range z.Machines {
|
for _, m := range z.Machines {
|
||||||
if m.Name == ngw && m.IsGateway() {
|
if m.Name == ngw && m.IsGateway() {
|
||||||
z.SetGateway(m.ID, false)
|
z.SetGateway(m.ID, false)
|
||||||
@@ -115,10 +116,10 @@ var gatewayListCmd = &cobra.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatewayListAll(zi zones.ZoneIterator) error {
|
func gatewayListAll(zi cluster.ZoneIterator) error {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
var err error
|
var err error
|
||||||
zi.ForEachZone(func(z *zones.Zone) bool {
|
zi.ForEachZone(func(z *cluster.Zone) bool {
|
||||||
b.WriteString(z.Name + ":")
|
b.WriteString(z.Name + ":")
|
||||||
var sIDs []string
|
var sIDs []string
|
||||||
ids, num := z.GatewayIDs()
|
ids, num := z.GatewayIDs()
|
||||||
@@ -137,10 +138,10 @@ func gatewayListAll(zi zones.ZoneIterator) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatewayList(zi zones.ZoneIterator, m string) error {
|
func gatewayList(zi cluster.ZoneIterator, m string) error {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
var err error
|
var err error
|
||||||
zi.ForEachZone(func(z *zones.Zone) bool {
|
zi.ForEachZone(func(z *cluster.Zone) bool {
|
||||||
if z.Name == m {
|
if z.Name == m {
|
||||||
b.WriteString(z.Name + ":")
|
b.WriteString(z.Name + ":")
|
||||||
ids, num := z.GatewayIDs()
|
ids, num := z.GatewayIDs()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// Package cluster contains information about the cluster
|
||||||
|
package cluster
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import "darvaza.org/slog"
|
import "darvaza.org/slog"
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
// SyncAll updates all config files
|
// SyncAll updates all config files
|
||||||
func (m *Zones) SyncAll() error {
|
func (m *Zones) SyncAll() error {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// Package zones contains information about the cluster
|
package cluster
|
||||||
package zones
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package zones
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
Reference in New Issue
Block a user