mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-09 07:02:50 -04:00
Remove ConstellationPort from config file
Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
parent
83857b142c
commit
c679526bae
3 changed files with 5 additions and 14 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net"
|
"net"
|
||||||
|
"strconv"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
"github.com/edgelesssys/constellation/cli/azure"
|
||||||
|
@ -105,7 +106,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, ser
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoints := ipsToEndpoints(append(coordinators.PublicIPs(), nodes.PublicIPs()...), *config.CoordinatorPort)
|
endpoints := ipsToEndpoints(append(coordinators.PublicIPs(), nodes.PublicIPs()...), strconv.Itoa(constants.CoordinatorPort))
|
||||||
|
|
||||||
cmd.Println("Waiting for cloud provider resource creation and boot ...")
|
cmd.Println("Waiting for cloud provider resource creation and boot ...")
|
||||||
if err := waiter.InitializeValidators(validators.V()); err != nil {
|
if err := waiter.InitializeValidators(validators.V()); err != nil {
|
||||||
|
@ -129,7 +130,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, ser
|
||||||
autoscalingNodeGroups: autoscalingNodeGroups,
|
autoscalingNodeGroups: autoscalingNodeGroups,
|
||||||
cloudServiceAccountURI: serviceAccount,
|
cloudServiceAccountURI: serviceAccount,
|
||||||
}
|
}
|
||||||
result, err := activate(ctx, cmd, protCl, input, config, validators.V())
|
result, err := activate(ctx, cmd, protCl, input, validators.V())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -158,9 +159,9 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, ser
|
||||||
}
|
}
|
||||||
|
|
||||||
func activate(ctx context.Context, cmd *cobra.Command, client protoClient, input activationInput,
|
func activate(ctx context.Context, cmd *cobra.Command, client protoClient, input activationInput,
|
||||||
config *config.Config, validators []atls.Validator,
|
validators []atls.Validator,
|
||||||
) (activationResult, error) {
|
) (activationResult, error) {
|
||||||
err := client.Connect(net.JoinHostPort(input.coordinatorPubIP, *config.CoordinatorPort), validators)
|
err := client.Connect(net.JoinHostPort(input.coordinatorPubIP, strconv.Itoa(constants.CoordinatorPort)), validators)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return activationResult{}, err
|
return activationResult{}, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
azureClient "github.com/edgelesssys/constellation/cli/azure/client"
|
azureClient "github.com/edgelesssys/constellation/cli/azure/client"
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
|
@ -43,7 +42,6 @@ var (
|
||||||
// All fields in this struct and its child structs have pointer types
|
// All fields in this struct and its child structs have pointer types
|
||||||
// to ensure the default values of the actual type is not confused with an omitted value.
|
// to ensure the default values of the actual type is not confused with an omitted value.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
CoordinatorPort *string `yaml:"coordinatorPort,omitempty"`
|
|
||||||
AutoscalingNodeGroupsMin *int `yaml:"autoscalingNodeGroupsMin,omitempty"`
|
AutoscalingNodeGroupsMin *int `yaml:"autoscalingNodeGroupsMin,omitempty"`
|
||||||
AutoscalingNodeGroupsMax *int `yaml:"autoscalingNodeGroupsMax,omitempty"`
|
AutoscalingNodeGroupsMax *int `yaml:"autoscalingNodeGroupsMax,omitempty"`
|
||||||
StateDiskSizeGB *int `yaml:"StateDisksizeGB,omitempty"`
|
StateDiskSizeGB *int `yaml:"StateDisksizeGB,omitempty"`
|
||||||
|
@ -53,7 +51,6 @@ type Config struct {
|
||||||
// Default returns a struct with the default config.
|
// Default returns a struct with the default config.
|
||||||
func Default() *Config {
|
func Default() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
CoordinatorPort: proto.String(strconv.Itoa(constants.CoordinatorPort)),
|
|
||||||
AutoscalingNodeGroupsMin: intPtr(1),
|
AutoscalingNodeGroupsMin: intPtr(1),
|
||||||
AutoscalingNodeGroupsMax: intPtr(10),
|
AutoscalingNodeGroupsMax: intPtr(10),
|
||||||
StateDiskSizeGB: intPtr(30),
|
StateDiskSizeGB: intPtr(30),
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/spf13/afero"
|
"github.com/spf13/afero"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDefaultConfig(t *testing.T) {
|
func TestDefaultConfig(t *testing.T) {
|
||||||
|
@ -47,11 +46,6 @@ func TestFromFile(t *testing.T) {
|
||||||
wantResultMutator func(c *Config) // mutates the Default() config to the expected result.
|
wantResultMutator func(c *Config) // mutates the Default() config to the expected result.
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
"overwrite fields": {
|
|
||||||
from: &Config{CoordinatorPort: proto.String("1000")},
|
|
||||||
configName: constants.ConfigFilename,
|
|
||||||
wantResultMutator: func(c *Config) { c.CoordinatorPort = proto.String("1000") },
|
|
||||||
},
|
|
||||||
"overwrite slices": {
|
"overwrite slices": {
|
||||||
from: &Config{Provider: someProviderConfig},
|
from: &Config{Provider: someProviderConfig},
|
||||||
configName: constants.ConfigFilename,
|
configName: constants.ConfigFilename,
|
||||||
|
@ -86,7 +80,6 @@ func TestFromFile(t *testing.T) {
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
wantResult := Default()
|
wantResult := Default()
|
||||||
tc.wantResultMutator(wantResult)
|
tc.wantResultMutator(wantResult)
|
||||||
assert.EqualValues(wantResult.CoordinatorPort, result.CoordinatorPort)
|
|
||||||
assert.EqualValues(wantResult.AutoscalingNodeGroupsMin, result.AutoscalingNodeGroupsMin)
|
assert.EqualValues(wantResult.AutoscalingNodeGroupsMin, result.AutoscalingNodeGroupsMin)
|
||||||
assert.EqualValues(wantResult.AutoscalingNodeGroupsMax, result.AutoscalingNodeGroupsMax)
|
assert.EqualValues(wantResult.AutoscalingNodeGroupsMax, result.AutoscalingNodeGroupsMax)
|
||||||
require.NotNil(wantResult.Provider)
|
require.NotNil(wantResult.Provider)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue