mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
cli: unify terraform variable creation (#2119)
Before we defined the variables twice. Once for upgrades, once for create. Also move default node group names into a constant
This commit is contained in:
parent
f9391ed903
commit
cf822f7eee
19 changed files with 464 additions and 451 deletions
|
@ -14,6 +14,7 @@ go_library(
|
|||
importpath = "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/cloud/aws/client",
|
||||
visibility = ["//operators/constellation-node-operator:__subpackages__"],
|
||||
deps = [
|
||||
"//internal/constants",
|
||||
"//operators/constellation-node-operator/api/v1alpha1",
|
||||
"//operators/constellation-node-operator/internal/cloud/api",
|
||||
"@com_github_aws_aws_sdk_go_v2_config//:config",
|
||||
|
@ -36,6 +37,7 @@ go_test(
|
|||
],
|
||||
embed = [":client"],
|
||||
deps = [
|
||||
"//internal/constants",
|
||||
"//operators/constellation-node-operator/api/v1alpha1",
|
||||
"//operators/constellation-node-operator/internal/cloud/api",
|
||||
"@com_github_aws_aws_sdk_go_v2_service_autoscaling//:autoscaling",
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
scalingtypes "github.com/aws/aws-sdk-go-v2/service/autoscaling/types"
|
||||
"github.com/aws/aws-sdk-go-v2/service/ec2"
|
||||
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1"
|
||||
cspapi "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/cloud/api"
|
||||
)
|
||||
|
@ -185,9 +186,9 @@ func (c *Client) ListScalingGroups(ctx context.Context, uid string) ([]cspapi.Sc
|
|||
if nodeGroupName == "" {
|
||||
switch role {
|
||||
case updatev1alpha1.ControlPlaneRole:
|
||||
nodeGroupName = "control_plane_default"
|
||||
nodeGroupName = constants.ControlPlaneDefault
|
||||
case updatev1alpha1.WorkerRole:
|
||||
nodeGroupName = "worker_default"
|
||||
nodeGroupName = constants.WorkerDefault
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
scalingtypes "github.com/aws/aws-sdk-go-v2/service/autoscaling/types"
|
||||
"github.com/aws/aws-sdk-go-v2/service/ec2"
|
||||
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
cspapi "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/cloud/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -279,14 +280,14 @@ func TestListScalingGroups(t *testing.T) {
|
|||
wantGroups: []cspapi.ScalingGroup{
|
||||
{
|
||||
Name: "control-plane-asg",
|
||||
NodeGroupName: "control_plane_default",
|
||||
NodeGroupName: constants.ControlPlaneDefault,
|
||||
GroupID: "control-plane-asg",
|
||||
AutoscalingGroupName: "control-plane-asg",
|
||||
Role: "ControlPlane",
|
||||
},
|
||||
{
|
||||
Name: "worker-asg",
|
||||
NodeGroupName: "worker_default",
|
||||
NodeGroupName: constants.WorkerDefault,
|
||||
GroupID: "worker-asg",
|
||||
AutoscalingGroupName: "worker-asg",
|
||||
Role: "Worker",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue