From 876935f3b39566a28c65efa7682a9a2bc391b923 Mon Sep 17 00:00:00 2001 From: Karen Almog Date: Mon, 8 Oct 2018 11:56:02 +0200 Subject: [PATCH 1/2] remove hard-coding of AWS instnace type resolves #85 --- machines/aws/worker.machineset.yaml | 2 +- pkg/render/config.go | 1 + pkg/render/render_test.go | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/machines/aws/worker.machineset.yaml b/machines/aws/worker.machineset.yaml index 32ca9c183..4a3630cbb 100644 --- a/machines/aws/worker.machineset.yaml +++ b/machines/aws/worker.machineset.yaml @@ -45,7 +45,7 @@ spec: - name: "owner-id" values: - "595879546273" - instanceType: m4.large + instanceType: {{.AWS.InstanceType}} placement: region: {{.AWS.Region}} availabilityZone: {{.AWS.AvailabilityZone}} diff --git a/pkg/render/config.go b/pkg/render/config.go index 21d42eec5..8d27504e5 100644 --- a/pkg/render/config.go +++ b/pkg/render/config.go @@ -40,6 +40,7 @@ type AWSConfig struct { ContainerLinuxVersion string `json:"containerLinuxVersion"` Replicas string `json:"replicas"` WithCreds bool `json:"withCreds"` + InstanceType string `json:"instanceType"` } // Images allows build systems to inject images for MAO components. diff --git a/pkg/render/render_test.go b/pkg/render/render_test.go index 93056689a..aef7832cf 100644 --- a/pkg/render/render_test.go +++ b/pkg/render/render_test.go @@ -38,11 +38,11 @@ func TestClusterAWSManifest(t *testing.T) { TargetNamespace: "go-test", Provider: "AWS", AWS: &AWSConfig{ - ClusterName: "TestClusterManifest-ClusterName", - ClusterID: "TestClusterManifest-ClusterID", - Region: "TestClusterManifest-Region", AvailabilityZone: "TestClusterManifest-AvailabilityZone", + ClusterID: "TestClusterManifest-ClusterID", + ClusterName: "TestClusterManifest-ClusterName", Image: "TestClusterManifest-Image", + Region: "TestClusterManifest-Region", Replicas: "TestClusterManifest-Replicas", }, } @@ -71,14 +71,15 @@ func TestMachineSetAWSManifest(t *testing.T) { TargetNamespace: "go-test", Provider: "aws", AWS: &AWSConfig{ - ClusterName: "TestClusterManifest-ClusterName", + AvailabilityZone: "TestClusterManifest-AvailabilityZone", ClusterID: "TestClusterManifest-ClusterID", - ReleaseChannel: "TestChannel", + ClusterName: "TestClusterManifest-ClusterName", ContainerLinuxVersion: "TestCLVersion", - Region: "TestClusterManifest-Region", - AvailabilityZone: "TestClusterManifest-AvailabilityZone", - Image: "TestClusterManifest-Image", - Replicas: "TestClusterManifest-Replicas", + Image: "TestClusterManifest-Image", + InstanceType: "TestClusterManifest-InstanceType", + Region: "TestClusterManifest-Region", + ReleaseChannel: "TestChannel", + Replicas: "TestClusterManifest-Replicas", }, } @@ -126,7 +127,7 @@ spec: - name: "owner-id" values: - "595879546273" - instanceType: m4.large + instanceType: TestClusterManifest-InstanceType placement: region: TestClusterManifest-Region availabilityZone: TestClusterManifest-AvailabilityZone From 9c94eeeccac80b0496f0d021dd028b42c3ac9e15 Mon Sep 17 00:00:00 2001 From: Karen Almog Date: Mon, 8 Oct 2018 15:49:05 +0200 Subject: [PATCH 2/2] add instancetype to e2e --- tests/e2e/main.go | 8 +++++--- tests/e2e/manifests/mao-config.yaml | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 0885a87d6..f7d5e393a 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -39,6 +39,7 @@ const ( targetNamespace = "openshift-cluster-api" awsCredentialsSecretName = "aws-credentials-secret" region = "us-east-1" + instanceType = "m4.large" machineSetReplicas = 2 ) @@ -258,9 +259,10 @@ var rootCmd = &cobra.Command{ } configValues := &render.OperatorConfig{ AWS: &render.AWSConfig{ - ClusterID: clusterID, - ClusterName: clusterID, - Region: region, + ClusterID: clusterID, + ClusterName: clusterID, + Region: region, + InstanceType: instanceType, }, } maoConfigPopulatedData, err := render.Manifests(configValues, maoConfigTemplateData) diff --git a/tests/e2e/manifests/mao-config.yaml b/tests/e2e/manifests/mao-config.yaml index 306a1ff27..ebaa16350 100644 --- a/tests/e2e/manifests/mao-config.yaml +++ b/tests/e2e/manifests/mao-config.yaml @@ -6,6 +6,7 @@ aws: containerLinuxVersion: 1800.7.0 image: "" region: {{.AWS.Region}} + instanceType: {{.AWS.InstanceType}} releaseChannel: stable replicas: 2 WithCreds: true