mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-19 00:52:36 +00:00
Merge pull request #55 from c3os-io/feature/cluster-provider
Abstract Cluster Provisioning with Cluster Plugins
This commit is contained in:
committed by
Itxaka
parent
7ac3c30747
commit
b19a93e984
@@ -6,9 +6,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
events "github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
"github.com/c3os-io/c3os/internal/bus"
|
"github.com/c3os-io/c3os/internal/bus"
|
||||||
machine "github.com/c3os-io/c3os/internal/machine"
|
machine "github.com/c3os-io/c3os/internal/machine"
|
||||||
events "github.com/c3os-io/c3os/pkg/bus"
|
|
||||||
config "github.com/c3os-io/c3os/pkg/config"
|
config "github.com/c3os-io/c3os/pkg/config"
|
||||||
"github.com/nxadm/tail"
|
"github.com/nxadm/tail"
|
||||||
)
|
)
|
||||||
|
@@ -10,7 +10,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"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"
|
config "github.com/c3os-io/c3os/pkg/config"
|
||||||
|
|
||||||
"github.com/c3os-io/c3os/internal/bus"
|
"github.com/c3os-io/c3os/internal/bus"
|
||||||
|
23
internal/agent/notify.go
Normal file
23
internal/agent/notify.go
Normal 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
|
||||||
|
}
|
@@ -5,7 +5,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"github.com/c3os-io/c3os/pkg/bus"
|
"github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ var Manager = &Bus{
|
|||||||
[]pluggable.EventType{
|
[]pluggable.EventType{
|
||||||
bus.EventBootstrap,
|
bus.EventBootstrap,
|
||||||
bus.EventChallenge,
|
bus.EventChallenge,
|
||||||
|
bus.EventBoot,
|
||||||
bus.EventInstall,
|
bus.EventInstall,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@@ -6,6 +6,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
edgeVPNClient "github.com/mudler/edgevpn/api/client"
|
edgeVPNClient "github.com/mudler/edgevpn/api/client"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@@ -18,7 +20,6 @@ import (
|
|||||||
"github.com/c3os-io/c3os/internal/role"
|
"github.com/c3os-io/c3os/internal/role"
|
||||||
"github.com/c3os-io/c3os/internal/utils"
|
"github.com/c3os-io/c3os/internal/utils"
|
||||||
|
|
||||||
"github.com/c3os-io/c3os/pkg/bus"
|
|
||||||
"github.com/c3os-io/c3os/pkg/config"
|
"github.com/c3os-io/c3os/pkg/config"
|
||||||
"github.com/mudler/edgevpn/api/client/service"
|
"github.com/mudler/edgevpn/api/client/service"
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
|
@@ -5,9 +5,10 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
. "github.com/c3os-io/c3os/internal/provider"
|
. "github.com/c3os-io/c3os/internal/provider"
|
||||||
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
|
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
|
||||||
"github.com/c3os-io/c3os/pkg/bus"
|
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
@@ -3,8 +3,9 @@ package provider
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
|
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/c3os-io/c3os/pkg/config"
|
||||||
|
|
||||||
"github.com/mudler/go-nodepair"
|
"github.com/mudler/go-nodepair"
|
||||||
|
@@ -5,10 +5,11 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/c3os-io/c3os/sdk/bus"
|
||||||
|
|
||||||
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
|
providerConfig "github.com/c3os-io/c3os/internal/provider/config"
|
||||||
|
|
||||||
. "github.com/c3os-io/c3os/internal/provider"
|
. "github.com/c3os-io/c3os/internal/provider"
|
||||||
"github.com/c3os-io/c3os/pkg/bus"
|
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
. "github.com/onsi/ginkgo/v2"
|
. "github.com/onsi/ginkgo/v2"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
@@ -4,7 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"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-nodepair"
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user