Merge pull request #55 from c3os-io/feature/cluster-provider

Abstract Cluster Provisioning with Cluster Plugins
This commit is contained in:
Ettore Di Giacinto 2022-08-09 08:01:54 +02:00 committed by Itxaka
parent 7ac3c30747
commit b19a93e984
9 changed files with 40 additions and 8 deletions

View File

@ -6,9 +6,10 @@ import (
"os"
"path/filepath"
events "github.com/c3os-io/c3os/sdk/bus"
"github.com/c3os-io/c3os/internal/bus"
machine "github.com/c3os-io/c3os/internal/machine"
events "github.com/c3os-io/c3os/pkg/bus"
config "github.com/c3os-io/c3os/pkg/config"
"github.com/nxadm/tail"
)

View File

@ -10,7 +10,8 @@ import (
"syscall"
"time"
events "github.com/c3os-io/c3os/pkg/bus"
events "github.com/c3os-io/c3os/sdk/bus"
config "github.com/c3os-io/c3os/pkg/config"
"github.com/c3os-io/c3os/internal/bus"

23
internal/agent/notify.go Normal file
View File

@ -0,0 +1,23 @@
package agent
import (
"github.com/c3os-io/c3os/internal/bus"
"github.com/c3os-io/c3os/pkg/config"
events "github.com/c3os-io/c3os/sdk/bus"
"github.com/mudler/go-pluggable"
)
func Notify(event string, dirs []string) error {
bus.Manager.Initialize()
c, err := config.Scan(config.Directories(dirs...))
if err != nil {
return err
}
_, err = bus.Manager.Publish(pluggable.EventType(event), events.EventPayload{
Config: c.String(),
})
return err
}

View File

@ -5,7 +5,8 @@ import (
"os"
"os/exec"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/c3os-io/c3os/sdk/bus"
"github.com/mudler/go-pluggable"
)
@ -15,6 +16,7 @@ var Manager = &Bus{
[]pluggable.EventType{
bus.EventBootstrap,
bus.EventChallenge,
bus.EventBoot,
bus.EventInstall,
},
),

View File

@ -6,6 +6,8 @@ import (
"fmt"
"strings"
"github.com/c3os-io/c3os/sdk/bus"
logging "github.com/ipfs/go-log"
edgeVPNClient "github.com/mudler/edgevpn/api/client"
"go.uber.org/zap"
@ -18,7 +20,6 @@ import (
"github.com/c3os-io/c3os/internal/role"
"github.com/c3os-io/c3os/internal/utils"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/c3os-io/c3os/pkg/config"
"github.com/mudler/edgevpn/api/client/service"
"github.com/mudler/go-pluggable"

View File

@ -5,9 +5,10 @@ import (
"io/ioutil"
"os"
"github.com/c3os-io/c3os/sdk/bus"
. "github.com/c3os-io/c3os/internal/provider"
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/mudler/go-pluggable"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

View File

@ -3,8 +3,9 @@ package provider
import (
"encoding/json"
"github.com/c3os-io/c3os/sdk/bus"
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/c3os-io/c3os/pkg/config"
"github.com/mudler/go-nodepair"

View File

@ -5,10 +5,11 @@ import (
"io/ioutil"
"os"
"github.com/c3os-io/c3os/sdk/bus"
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
. "github.com/c3os-io/c3os/internal/provider"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/mudler/go-pluggable"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

View File

@ -4,7 +4,8 @@ import (
"context"
"encoding/json"
"github.com/c3os-io/c3os/pkg/bus"
"github.com/c3os-io/c3os/sdk/bus"
"github.com/mudler/go-nodepair"
"github.com/mudler/go-pluggable"
)