Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move default size to util.cluster
Browse files Browse the repository at this point in the history
Tof1973 committed Jan 31, 2025
1 parent 7988305 commit fae240b
Showing 5 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions hack/cluster/cluster.go
Original file line number Diff line number Diff line change
@@ -53,15 +53,15 @@ func run(ctx context.Context, log *logrus.Entry) error {

masterVmSize := os.Getenv("MASTER_VM_SIZE")
if masterVmSize == "" {
masterVmSize = version.DefaultInstallStream.MasterVmSize.String()
masterVmSize = cluster.DefaultMasterVmSize.String()
log.Infof("using default master VM size %s", masterVmSize)
} else {
log.Infof("using specified master VM size %s", masterVmSize)
}

workerVmSize := os.Getenv("WORKER_VM_SIZE")
if workerVmSize == "" {
workerVmSize = version.DefaultInstallStream.WorkerVmSize.String()
workerVmSize = cluster.DefaultWorkerVmSize.String()
log.Infof("using default worker VM size %s", workerVmSize)
} else {
log.Infof("using specified worker VM size %s", workerVmSize)
4 changes: 2 additions & 2 deletions pkg/api/openshiftcluster.go
Original file line number Diff line number Diff line change
@@ -445,8 +445,8 @@ type MasterProfile struct {
// VMSize represents a VM size
type VMSize string

func (vmSize *VMSize) String() string {
return string(*vmSize)
func (vmSize VMSize) String() string {
return string(vmSize)
}

// VMSize constants
4 changes: 3 additions & 1 deletion pkg/util/cluster/cluster.go
Original file line number Diff line number Diff line change
@@ -69,6 +69,8 @@ type Cluster struct {

const GenerateSubnetMaxTries = 100
const localDefaultURL string = "https://localhost:8443"
const DefaultMasterVmSize = api.VMSizeStandardD8sV3
const DefaultWorkerVmSize = api.VMSizeStandardD4sV3

func insecureLocalClient() *http.Client {
return &http.Client{
@@ -583,7 +585,7 @@ func (c *Cluster) createCluster(ctx context.Context, vnetResourceGroup, clusterN
return err
}
// In LocalDev mode, if workerVmSize is not default one, then it means user requested a specific one we need to keep.
if workerVmSize == version.DefaultInstallStream.WorkerVmSize {
if workerVmSize == DefaultWorkerVmSize {
oc.Properties.WorkerProfiles[0].VMSize = api.VMSizeStandardD2sV3
}
}
4 changes: 0 additions & 4 deletions pkg/util/version/const.go
Original file line number Diff line number Diff line change
@@ -28,8 +28,6 @@ var GitCommit = "unknown"
type Stream struct {
Version *Version `json:"version"`
PullSpec string `json:"-"`
MasterVmSize api.VMSize `json:"masterVmSize"`
WorkerVmSize api.VMSize `json:"workervMSize"`
}

// Install stream data for production and INT has moved to RP-Config.
@@ -38,8 +36,6 @@ type Stream struct {
var DefaultInstallStream = Stream{
Version: NewVersion(4, 15, 35),
PullSpec: "quay.io/openshift-release-dev/ocp-release@sha256:8c8433f95d09b051e156ff638f4ccc95543918c3aed92b8c09552a8977a2a1a2",
MasterVmSize: api.VMSizeStandardD8sV3,
WorkerVmSize: api.VMSizeStandardD4sV3,
}

// FluentbitImage contains the location of the Fluentbit container image
10 changes: 5 additions & 5 deletions test/e2e/setup.go
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ import (
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/features"
redhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift"
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/storage"
"github.com/Azure/ARO-RP/pkg/util/cluster"
utilcluster "github.com/Azure/ARO-RP/pkg/util/cluster"
msgraph_errors "github.com/Azure/ARO-RP/pkg/util/graph/graphsdk/models/odataerrors"
utillog "github.com/Azure/ARO-RP/pkg/util/log"
"github.com/Azure/ARO-RP/pkg/util/uuid"
@@ -500,7 +500,7 @@ func setup(ctx context.Context) error {
workerVmSize = os.Getenv("WORKER_VM_SIZE")

if os.Getenv("CI") != "" { // always create cluster in CI
cluster, err := cluster.New(log, _env, os.Getenv("CI") != "")
cluster, err := utilcluster.New(log, _env, os.Getenv("CI") != "")
if err != nil {
return err
}
@@ -510,11 +510,11 @@ func setup(ctx context.Context) error {
}

if masterVmSize == "" {
masterVmSize = version.DefaultInstallStream.MasterVmSize.String()
masterVmSize = utilcluster.DefaultMasterVmSize.String()
}

if workerVmSize == "" {
workerVmSize = version.DefaultInstallStream.WorkerVmSize.String()
workerVmSize = utilcluster.DefaultWorkerVmSize.String()
}

err = cluster.Create(ctx, vnetResourceGroup, clusterName, osClusterVersion, masterVmSize, workerVmSize)
@@ -536,7 +536,7 @@ func setup(ctx context.Context) error {
func done(ctx context.Context) error {
// terminate early if delete flag is set to false
if os.Getenv("CI") != "" && os.Getenv("E2E_DELETE_CLUSTER") != "false" {
cluster, err := cluster.New(log, _env, os.Getenv("CI") != "")
cluster, err := utilcluster.New(log, _env, os.Getenv("CI") != "")
if err != nil {
return err
}

0 comments on commit fae240b

Please sign in to comment.