Skip to content

Commit 9b876e5

Browse files
committed
*: Bump to install-config v0.12.0
Catching up with openshift/installer@dafc79f0 (Generate Network.cluster config instead of NetworkConfig.networkoperator, 2019-01-15, openshift/installer#1013) and openshift/installer@3b393da8 (pkg/types/aws/machinepool: Drop IAM-role overrides, 2019-01-30, openshift/installer#1154). The uint32 -> int32 cast is slightly dangerous, because it will silently wrap overflowing values [1,2]. But I'll try and get the installer updated to use unsigned types as well, and then we won't have to worry about converting. [1]: golang/go#19624 [2]: golang/go#30209
1 parent 7fb42d3 commit 9b876e5

8 files changed

+17
-64
lines changed

config/crds/hive_v1alpha1_clusterdeployment.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ spec:
5555
description: AWS is the configuration used when installing
5656
on AWS.
5757
properties:
58-
iamRoleName:
59-
description: IAMRoleName defines the IAM role associated
60-
with the ec2 instance.
61-
type: string
6258
rootVolume:
6359
description: EC2RootVolume defines the storage for ec2
6460
instance.
@@ -91,7 +87,6 @@ spec:
9187
type: array
9288
required:
9389
- type
94-
- iamRoleName
9590
- rootVolume
9691
type: object
9792
libvirt:
@@ -172,10 +167,6 @@ spec:
172167
description: AWS is the configuration used when installing on
173168
AWS.
174169
properties:
175-
iamRoleName:
176-
description: IAMRoleName defines the IAM role associated
177-
with the ec2 instance.
178-
type: string
179170
rootVolume:
180171
description: EC2RootVolume defines the storage for ec2 instance.
181172
properties:
@@ -207,7 +198,6 @@ spec:
207198
type: array
208199
required:
209200
- type
210-
- iamRoleName
211201
- rootVolume
212202
type: object
213203
libvirt:
@@ -345,10 +335,6 @@ spec:
345335
used when installing on AWS for machine pools which do not
346336
define their own platform configuration.
347337
properties:
348-
iamRoleName:
349-
description: IAMRoleName defines the IAM role associated
350-
with the ec2 instance.
351-
type: string
352338
rootVolume:
353339
description: EC2RootVolume defines the storage for ec2 instance.
354340
properties:
@@ -380,7 +366,6 @@ spec:
380366
type: array
381367
required:
382368
- type
383-
- iamRoleName
384369
- rootVolume
385370
type: object
386371
region:

config/samples/hive_v1alpha1_clusterdeployment.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ spec:
2222
platform:
2323
aws:
2424
type: m4.large
25-
iamRoleName: ""
2625
rootVolume:
2726
iops: 100 # TODO
2827
size: 22
@@ -34,7 +33,6 @@ spec:
3433
platform:
3534
aws:
3635
type: m4.large
37-
iamRoleName: ""
3836
rootVolume:
3937
iops: 100 # TODO
4038
size: 22

config/templates/cluster-deployment.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ objects:
119119
platform:
120120
aws:
121121
type: m4.large
122-
iamRoleName: ""
123122
rootVolume:
124123
iops: 100 # TODO
125124
size: 22
@@ -130,7 +129,6 @@ objects:
130129
platform:
131130
aws:
132131
type: m4.large
133-
iamRoleName: ""
134132
rootVolume:
135133
iops: 100 # TODO
136134
size: 22

pkg/apis/hive/v1alpha1/machinepools.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ type AWSMachinePoolPlatform struct {
3636
// eg. m4-large
3737
InstanceType string `json:"type"`
3838

39-
// IAMRoleName defines the IAM role associated
40-
// with the ec2 instance.
41-
IAMRoleName string `json:"iamRoleName"`
42-
4339
// EC2RootVolume defines the storage for ec2 instance.
4440
EC2RootVolume `json:"rootVolume"`
4541
}

pkg/controller/remotemachineset/remotemachineset_controller.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,6 @@ func (r *ReconcileRemoteMachineSet) generateMachineSetsFromClusterDeployment(cd
310310

311311
hivePool := findHiveMachinePool(cd, workerPool.Name)
312312

313-
defaultIAMRole := fmt.Sprintf("%s-worker-role", ic.ObjectMeta.Name)
314-
if hivePool.Platform.AWS.IAMRoleName == "" {
315-
workerPool.Platform.AWS.IAMRoleName = defaultIAMRole
316-
}
317-
318313
icMachineSets, err := installaws.MachineSets(cd.Status.ClusterID, ic, &workerPool, defaultAMI, workerPool.Name, "worker-user-data")
319314
if err != nil {
320315
return nil, err

pkg/controller/remotemachineset/remotemachineset_controller_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
391391
}
392392
}
393393

394-
func testMachinePool(name string, replicas int, iamRoleName string, zones []string) hivev1.MachinePool {
394+
func testMachinePool(name string, replicas int, zones []string) hivev1.MachinePool {
395395
mpReplicas := int64(replicas)
396396

397397
testMachinePool := hivev1.MachinePool{
@@ -400,7 +400,6 @@ func testMachinePool(name string, replicas int, iamRoleName string, zones []stri
400400
Platform: hivev1.MachinePoolPlatform{
401401
AWS: &hivev1.AWSMachinePoolPlatform{
402402
InstanceType: "m4.large",
403-
IAMRoleName: iamRoleName,
404403
},
405404
},
406405
}

pkg/install/convertconfig.go

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ limitations under the License.
1717
package install
1818

1919
import (
20-
"fmt"
21-
2220
hivev1 "github.com/openshift/hive/pkg/apis/hive/v1alpha1"
2321

2422
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2523

24+
networkv1 "github.com/openshift/cluster-network-operator/pkg/apis/networkoperator/v1"
2625
"github.com/openshift/installer/pkg/ipnet"
2726
"github.com/openshift/installer/pkg/types"
2827
installeraws "github.com/openshift/installer/pkg/types/aws"
29-
30-
netopv1 "github.com/openshift/cluster-network-operator/pkg/apis/networkoperator/v1"
3128
)
3229

3330
// GenerateInstallConfig builds an InstallConfig for the installer from our ClusterDeploymentSpec.
@@ -38,11 +35,6 @@ import (
3835
func GenerateInstallConfig(cd *hivev1.ClusterDeployment, sshKey, pullSecret string) (*types.InstallConfig, error) {
3936
spec := cd.Spec
4037

41-
networkType, err := convertNetworkingType(spec.Networking.Type)
42-
if err != nil {
43-
return nil, err
44-
}
45-
4638
platform := types.Platform{}
4739
if spec.Platform.AWS != nil {
4840
aws := spec.Platform.AWS
@@ -53,7 +45,6 @@ func GenerateInstallConfig(cd *hivev1.ClusterDeployment, sshKey, pullSecret stri
5345
if aws.DefaultMachinePlatform != nil {
5446
platform.AWS.DefaultMachinePlatform = &installeraws.MachinePool{
5547
InstanceType: aws.DefaultMachinePlatform.InstanceType,
56-
IAMRoleName: aws.DefaultMachinePlatform.IAMRoleName,
5748
EC2RootVolume: installeraws.EC2RootVolume{
5849
IOPS: aws.DefaultMachinePlatform.EC2RootVolume.IOPS,
5950
Size: aws.DefaultMachinePlatform.EC2RootVolume.Size,
@@ -84,7 +75,6 @@ func GenerateInstallConfig(cd *hivev1.ClusterDeployment, sshKey, pullSecret stri
8475
if mp.Platform.AWS != nil {
8576
newMP.Platform.AWS = &installeraws.MachinePool{
8677
InstanceType: mp.Platform.AWS.InstanceType,
87-
IAMRoleName: mp.Platform.AWS.IAMRoleName,
8878
EC2RootVolume: installeraws.EC2RootVolume{
8979
IOPS: mp.Platform.AWS.EC2RootVolume.IOPS,
9080
Size: mp.Platform.AWS.EC2RootVolume.Size,
@@ -101,14 +91,14 @@ func GenerateInstallConfig(cd *hivev1.ClusterDeployment, sshKey, pullSecret stri
10191
Name: spec.ClusterName,
10292
},
10393
TypeMeta: metav1.TypeMeta{
104-
APIVersion: "v1beta1",
94+
APIVersion: types.InstallConfigVersion,
10595
},
10696
SSHKey: sshKey,
10797
BaseDomain: spec.BaseDomain,
10898
Networking: &types.Networking{
109-
Type: networkType,
99+
Type: string(spec.Networking.Type),
110100
ServiceCIDR: parseCIDR(spec.Networking.ServiceCIDR),
111-
ClusterNetworks: spec.Networking.ClusterNetworks,
101+
ClusterNetworks: convertClusterNetworks(spec.Networking.ClusterNetworks),
112102
MachineCIDR: parseCIDR(spec.Networking.MachineCIDR),
113103
},
114104
PullSecret: pullSecret,
@@ -125,13 +115,13 @@ func parseCIDR(s string) *ipnet.IPNet {
125115
return ipnet.MustParseCIDR(s)
126116
}
127117

128-
func convertNetworkingType(hnt hivev1.NetworkType) (netopv1.NetworkType, error) {
129-
switch hnt {
130-
case hivev1.NetworkTypeOpenshiftOVN:
131-
return netopv1.NetworkTypeOVNKubernetes, nil
132-
case hivev1.NetworkTypeOpenshiftSDN:
133-
return netopv1.NetworkTypeOpenshiftSDN, nil
134-
default:
135-
return "", fmt.Errorf("unknown NetworkType: %s", hnt)
118+
func convertClusterNetworks(networks []networkv1.ClusterNetwork) []types.ClusterNetworkEntry {
119+
output := make([]types.ClusterNetworkEntry, 0, len(networks))
120+
for _, network := range networks {
121+
output = append(output, types.ClusterNetworkEntry{
122+
CIDR: *parseCIDR(network.CIDR),
123+
HostSubnetLength: int32(network.HostSubnetLength),
124+
})
136125
}
126+
return output
137127
}

pkg/install/convertconfig_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const (
4848
pullSecret = "pullSecret"
4949
awsInstanceType = "fake-aws-type"
5050
awsRegion = "us-east-1"
51-
iamRoleName = "rolename"
5251
ec2VolIOPS = 100
5352
ec2VolSize = 500
5453
ec2VolType = "sometype"
@@ -83,7 +82,6 @@ func buildValidClusterDeployment() *hivev1.ClusterDeployment {
8382
},
8483
DefaultMachinePlatform: &hivev1.AWSMachinePoolPlatform{
8584
InstanceType: awsInstanceType,
86-
IAMRoleName: iamRoleName,
8785
EC2RootVolume: hivev1.EC2RootVolume{
8886
IOPS: ec2VolIOPS,
8987
Size: ec2VolSize,
@@ -109,7 +107,6 @@ func buildValidClusterDeployment() *hivev1.ClusterDeployment {
109107
Platform: hivev1.MachinePoolPlatform{
110108
AWS: &hivev1.AWSMachinePoolPlatform{
111109
InstanceType: awsInstanceType,
112-
IAMRoleName: iamRoleName,
113110
EC2RootVolume: hivev1.EC2RootVolume{
114111
IOPS: ec2VolIOPS,
115112
Size: ec2VolSize,
@@ -126,7 +123,6 @@ func buildValidClusterDeployment() *hivev1.ClusterDeployment {
126123
Platform: hivev1.MachinePoolPlatform{
127124
AWS: &hivev1.AWSMachinePoolPlatform{
128125
InstanceType: awsInstanceType,
129-
IAMRoleName: iamRoleName,
130126
EC2RootVolume: hivev1.EC2RootVolume{
131127
IOPS: ec2VolIOPS,
132128
Size: ec2VolSize,
@@ -145,7 +141,7 @@ func buildBaseExpectedInstallConfig() *installtypes.InstallConfig {
145141
replicas := int64(3)
146142
return &installtypes.InstallConfig{
147143
TypeMeta: metav1.TypeMeta{
148-
APIVersion: "v1beta1",
144+
APIVersion: installtypes.InstallConfigVersion,
149145
},
150146
BaseDomain: "test.example.com",
151147
SSHKey: adminSSHKey,
@@ -154,9 +150,9 @@ func buildBaseExpectedInstallConfig() *installtypes.InstallConfig {
154150
// TODO: Hardcoded to match installer for now.
155151
Type: "OpenshiftSDN",
156152
ServiceCIDR: ipnet.MustParseCIDR("172.30.0.0/16"),
157-
ClusterNetworks: []netopv1.ClusterNetwork{
153+
ClusterNetworks: []installtypes.ClusterNetworkEntry{
158154
{
159-
CIDR: "10.128.0.0/14",
155+
CIDR: *ipnet.MustParseCIDR("10.128.0.0/14"),
160156
HostSubnetLength: 9,
161157
},
162158
},
@@ -170,7 +166,6 @@ func buildBaseExpectedInstallConfig() *installtypes.InstallConfig {
170166
},
171167
DefaultMachinePlatform: &installawstypes.MachinePool{
172168
InstanceType: awsInstanceType,
173-
IAMRoleName: iamRoleName,
174169
EC2RootVolume: installawstypes.EC2RootVolume{
175170
IOPS: ec2VolIOPS,
176171
Size: ec2VolSize,
@@ -186,7 +181,6 @@ func buildBaseExpectedInstallConfig() *installtypes.InstallConfig {
186181
Platform: installtypes.MachinePoolPlatform{
187182
AWS: &installawstypes.MachinePool{
188183
InstanceType: awsInstanceType,
189-
IAMRoleName: iamRoleName,
190184
EC2RootVolume: installawstypes.EC2RootVolume{
191185
IOPS: ec2VolIOPS,
192186
Size: ec2VolSize,
@@ -202,7 +196,6 @@ func buildBaseExpectedInstallConfig() *installtypes.InstallConfig {
202196
Platform: installtypes.MachinePoolPlatform{
203197
AWS: &installawstypes.MachinePool{
204198
InstanceType: awsInstanceType,
205-
IAMRoleName: iamRoleName,
206199
EC2RootVolume: installawstypes.EC2RootVolume{
207200
IOPS: ec2VolIOPS,
208201
Size: ec2VolSize,
@@ -264,9 +257,8 @@ func TestConvert(t *testing.T) {
264257
expectedInstallConfig: func() *installtypes.InstallConfig {
265258
ic := buildBaseExpectedInstallConfig()
266259
ic.Networking.ServiceCIDR = &ipnet.IPNet{}
267-
ic.Networking.PodCIDR = nil
268260
ic.Networking.MachineCIDR = &ipnet.IPNet{}
269-
ic.Networking.ClusterNetworks = []netopv1.ClusterNetwork{}
261+
ic.Networking.ClusterNetworks = []installtypes.ClusterNetworkEntry{}
270262
return ic
271263
}(),
272264
},

0 commit comments

Comments
 (0)