replace flannel with cilium

This commit is contained in:
Leonard Cohnen 2022-05-24 10:04:42 +02:00
parent 7e1c898870
commit 791d5564ba
98 changed files with 3626 additions and 2156 deletions

View file

@ -179,7 +179,19 @@ func getIPsFromConfig(stat statec.ConstellationState, config configc.Config) ([]
if err != nil {
return nil, err
}
return append(coordinators.PublicIPs(), nodes.PublicIPs()...), nil
var ips []string
// only deploy to non empty public IPs
for _, ip := range append(coordinators.PublicIPs(), nodes.PublicIPs()...) {
if ip != "" {
ips = append(ips, ip)
}
}
if len(ips) == 0 {
return nil, fmt.Errorf("no public IPs found in statefile")
}
return ips, nil
}
func init() {

View file

@ -5,16 +5,16 @@ import (
"fmt"
azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure"
"github.com/edgelesssys/constellation/coordinator/cloudprovider/cloudtypes"
gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp"
"github.com/edgelesssys/constellation/coordinator/core"
"github.com/edgelesssys/constellation/internal/deploy/ssh"
)
type providerMetadata interface {
// List retrieves all instances belonging to the current constellation.
List(ctx context.Context) ([]core.Instance, error)
List(ctx context.Context) ([]cloudtypes.Instance, error)
// Self retrieves the current instance.
Self(ctx context.Context) (core.Instance, error)
Self(ctx context.Context) (cloudtypes.Instance, error)
}
// Fetcher checks the metadata service to search for instances that were set up for debugging and cloud provider specific SSH keys.
@ -66,7 +66,7 @@ func (f *Fetcher) DiscoverDebugdIPs(ctx context.Context) ([]string, error) {
}
var ips []string
for _, instance := range instances {
ips = append(ips, instance.IPs...)
ips = append(ips, instance.PrivateIPs...)
}
return ips, nil
}

View file

@ -5,7 +5,7 @@ import (
"errors"
"testing"
"github.com/edgelesssys/constellation/coordinator/core"
"github.com/edgelesssys/constellation/coordinator/cloudprovider/cloudtypes"
"github.com/edgelesssys/constellation/internal/deploy/ssh"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -21,15 +21,15 @@ func TestDiscoverDebugIPs(t *testing.T) {
}{
"disovery works": {
meta: stubMetadata{
listRes: []core.Instance{
listRes: []cloudtypes.Instance{
{
IPs: []string{"192.0.2.0"},
PrivateIPs: []string{"192.0.2.0"},
},
{
IPs: []string{"192.0.2.1"},
PrivateIPs: []string{"192.0.2.1"},
},
{
IPs: []string{"192.0.2.2"},
PrivateIPs: []string{"192.0.2.2"},
},
},
},
@ -75,7 +75,7 @@ func TestFetchSSHKeys(t *testing.T) {
}{
"fetch works": {
meta: stubMetadata{
selfRes: core.Instance{
selfRes: cloudtypes.Instance{
Name: "name",
ProviderID: "provider-id",
SSHKeys: map[string][]string{"bob": {"ssh-rsa bobskey"}},
@ -117,24 +117,24 @@ func TestFetchSSHKeys(t *testing.T) {
}
type stubMetadata struct {
listRes []core.Instance
listRes []cloudtypes.Instance
listErr error
selfRes core.Instance
selfRes cloudtypes.Instance
selfErr error
getInstanceRes core.Instance
getInstanceRes cloudtypes.Instance
getInstanceErr error
supportedRes bool
}
func (m *stubMetadata) List(ctx context.Context) ([]core.Instance, error) {
func (m *stubMetadata) List(ctx context.Context) ([]cloudtypes.Instance, error) {
return m.listRes, m.listErr
}
func (m *stubMetadata) Self(ctx context.Context) (core.Instance, error) {
func (m *stubMetadata) Self(ctx context.Context) (cloudtypes.Instance, error) {
return m.selfRes, m.selfErr
}
func (m *stubMetadata) GetInstance(ctx context.Context, providerID string) (core.Instance, error) {
func (m *stubMetadata) GetInstance(ctx context.Context, providerID string) (cloudtypes.Instance, error) {
return m.getInstanceRes, m.getInstanceErr
}