Compare commits

..

10 Commits

Author SHA1 Message Date
amery 2279c1cd88 env: set ceph monitors variables
they indicate the ceph monitors on the specified zone

* MON{zoneID}_NAME
* MON{zoneID}_ID
* MON{zoneID}_IP

Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 781beef410 zones: extend scan to ensure every zone has a ceph monitor
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 6e8fd3ed38 zones: set Machine.CephMonitor if its referenced as monitor on ceph.conf
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 80afc24ca8 zones: introduce Zone.GetCephMonitors()
returning the local ceph monitors and setting one
if there is none. non-gateway nodes are preferred
when setting a monitor automatically

Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 3820fd84f2 zones: introduce Zones.GetCephConfig() accessor for m/ceph.conf
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 781277980c ceph: add NewConfigFromReader() and initial ceph.conf parser
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 44d6ad2599 zones: introduce Machine.CephMonitor field
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 9d3a9627e3 zones: introduce Zones.CephFSID and Zones.GetCephFSID()
the accessor doesn't generate one if needed yet

Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:45 +00:00
amery 655dacac42 vscode: add ceph to the dictionary
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:20:44 +00:00
amery ff4bb97599 vscode: add jpictl, zerolog and darvaza to the dictionary
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-09-05 12:19:51 +00:00
3 changed files with 27 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"ceph",
"darvaza",
"jpictl",
"zerolog"
]
}
+12
View File
@@ -4,9 +4,21 @@ import (
"bytes"
"sort"
"darvaza.org/core"
"github.com/gofrs/uuid/v5"
"git.jpi.io/amery/jpictl/pkg/ceph"
)
// GetCephFSID returns our Ceph's FSID
func (m *Zones) GetCephFSID() (uuid.UUID, error) {
if core.IsZero(m.CephFSID) {
// TODO: generate one
return uuid.Nil, nil
}
return m.CephFSID, nil
}
// GetCephConfig reads the ceph.conf file
func (m *Zones) GetCephConfig() (*ceph.Config, error) {
data, err := m.ReadFile("ceph.conf")
+7
View File
@@ -6,6 +6,7 @@ import (
"sort"
"darvaza.org/resolver"
"github.com/gofrs/uuid/v5"
)
var (
@@ -135,15 +136,21 @@ func (z *Zone) GatewayIDs() ([]int, int) {
return out, len(out)
}
// revive:disable:line-length-limit
// Zones represents all zones in a cluster
type Zones struct {
dir fs.FS
resolver resolver.Resolver
domain string
CephFSID uuid.UUID `toml:"ceph_fsid,omitempty" json:"ceph_fsid,omitempty" yaml:"ceph_fsid,omitempty"`
Zones []*Zone `toml:"zones"`
}
// revive:enable:line-length-limit
// ForEachMachine calls a function for each Machine in the cluster
// until instructed to terminate the loop
func (m *Zones) ForEachMachine(fn func(*Machine) bool) {