Skip to content

Commit ab7ee97

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), openshift/installer@3b393da8 (pkg/types/aws/machinepool: Drop IAM-role overrides, 2019-01-30, openshift/installer#1154), and openshift/installer@9ad20c35 (pkg/destroy/aws: Remove ClusterName consumer, 2019-01-31, openshift/installer#1170). 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 ab7ee97

File tree

11 files changed

+31
-85
lines changed

11 files changed

+31
-85
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

contrib/cmd/hiveutil/awstagdeprovision.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func NewDeprovisionAWSWithTagsCommand() *cobra.Command {
4848
flags := cmd.Flags()
4949
flags.StringVar(&logLevel, "loglevel", "info", "log level, one of: debug, info, warn, error, fatal, panic")
5050
flags.StringVar(&opt.Region, "region", "us-east-1", "AWS region to use")
51-
flags.StringVar(&opt.ClusterName, "cluster-name", "", "Name that cluster was installed with")
5251
return cmd
5352
}
5453

contrib/pkg/installmanager/installmanager.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,9 @@ func runUninstaller(clusterName, region, clusterID string, logger log.FieldLogge
326326
{kubernetesKeyPrefix + clusterName: "owned"},
327327
}
328328
uninstaller := &aws.ClusterUninstaller{
329-
Filters: filters,
330-
Region: region,
331-
ClusterName: clusterName,
332-
Logger: logger,
329+
Filters: filters,
330+
Region: region,
331+
Logger: logger,
333332
}
334333

335334
return uninstaller.Run()

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,6 @@ func (r *ReconcileRemoteMachineSet) generateMachineSetsFromClusterDeployment(cd
308308
workerPool.Platform.AWS.Zones = azs
309309
}
310310

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

pkg/controller/remotemachineset/remotemachineset_controller_test.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
104104
name: "No-op",
105105
localExisting: []runtime.Object{
106106
testClusterDeployment([]hivev1.MachinePool{
107-
testMachinePool("worker", 3, testName+"-worker", []string{}),
107+
testMachinePool("worker", 3, []string{}),
108108
}),
109109
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
110110
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -130,7 +130,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
130130
name: "Update machine set replicas",
131131
localExisting: []runtime.Object{
132132
testClusterDeployment([]hivev1.MachinePool{
133-
testMachinePool("worker", 3, testName+"-worker", []string{}),
133+
testMachinePool("worker", 3, []string{}),
134134
}),
135135
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
136136
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -156,7 +156,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
156156
name: "Create missing machine set",
157157
localExisting: []runtime.Object{
158158
testClusterDeployment([]hivev1.MachinePool{
159-
testMachinePool("worker", 3, testName+"-worker", []string{"us-east-1a", "us-east-1b", "us-east-1c"}),
159+
testMachinePool("worker", 3, []string{"us-east-1a", "us-east-1b", "us-east-1c"}),
160160
}),
161161
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
162162
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -181,7 +181,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
181181
name: "Delete extra machine set",
182182
localExisting: []runtime.Object{
183183
testClusterDeployment([]hivev1.MachinePool{
184-
testMachinePool("worker", 3, testName+"-worker", []string{}),
184+
testMachinePool("worker", 3, []string{}),
185185
}),
186186
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
187187
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -208,8 +208,8 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
208208
name: "Multiple machineset noop",
209209
localExisting: []runtime.Object{
210210
testClusterDeployment([]hivev1.MachinePool{
211-
testMachinePool("alpha", 3, testName+"-worker", []string{"us-east-1a"}),
212-
testMachinePool("beta", 3, testName+"-worker", []string{"us-east-1b"}),
211+
testMachinePool("alpha", 3, []string{"us-east-1a"}),
212+
testMachinePool("beta", 3, []string{"us-east-1b"}),
213213
}),
214214
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
215215
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -233,8 +233,8 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
233233
name: "Update multiple machineset replicas",
234234
localExisting: []runtime.Object{
235235
testClusterDeployment([]hivev1.MachinePool{
236-
testMachinePool("alpha", 3, testName+"-worker", []string{"us-east-1a"}),
237-
testMachinePool("beta", 3, testName+"-worker", []string{"us-east-1b"}),
236+
testMachinePool("alpha", 3, []string{"us-east-1a"}),
237+
testMachinePool("beta", 3, []string{"us-east-1b"}),
238238
}),
239239
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
240240
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -258,8 +258,8 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
258258
name: "Create additional machinepool machinesets",
259259
localExisting: []runtime.Object{
260260
testClusterDeployment([]hivev1.MachinePool{
261-
testMachinePool("alpha", 3, testName+"-worker", []string{}),
262-
testMachinePool("beta", 3, testName+"-worker", []string{}),
261+
testMachinePool("alpha", 3, []string{}),
262+
testMachinePool("beta", 3, []string{}),
263263
}),
264264
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
265265
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -288,7 +288,7 @@ func TestRemoteMachineSetReconcile(t *testing.T) {
288288
name: "Delete additional machinepool machinesets",
289289
localExisting: []runtime.Object{
290290
testClusterDeployment([]hivev1.MachinePool{
291-
testMachinePool("alpha", 3, testName+"-worker", []string{}),
291+
testMachinePool("alpha", 3, []string{}),
292292
}),
293293
testSecret(adminKubeconfigSecret, adminKubeconfigSecretKey, testName),
294294
testSecret(adminPasswordSecret, adminPasswordSecretKey, testName),
@@ -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
}

0 commit comments

Comments
 (0)