Skip to content

Commit b71bc4f

Browse files
authored
adding azure az support (#738)
Signed-off-by: Moath Qasim <[email protected]> Signed-off-by: Moath Qasim <[email protected]>
1 parent ea01ca0 commit b71bc4f

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

examples/azure-machinedeployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ spec:
7474
imageID: "myImageID"
7575
assignPublicIP: false
7676
securityGroupName: my-security-group
77+
# zones is an optional field and it represents Availability Zones is a high-availability offering
78+
# that protects your applications and data from datacenter failures.
79+
zones:
80+
- "1"
7781
# Can be 'ubuntu', 'coreos' ,'centos' or 'rhel'
7882
operatingSystem: "coreos"
7983
operatingSystemSpec:

pkg/cloudprovider/provider/azure/create_delete_resources.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ func createOrUpdatePublicIPAddress(ctx context.Context, ipName string, machineUI
206206
PublicIPAddressVersion: network.IPv4,
207207
PublicIPAllocationMethod: network.Static,
208208
},
209-
Tags: map[string]*string{machineUIDTag: to.StringPtr(string(machineUID))},
209+
Tags: map[string]*string{machineUIDTag: to.StringPtr(string(machineUID))},
210+
Zones: &c.Zones,
210211
}
211212
future, err := ipClient.CreateOrUpdate(ctx, c.ResourceGroup, ipName, ipParams)
212213
if err != nil {

pkg/cloudprovider/provider/azure/provider.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ type config struct {
8080
AvailabilitySet string
8181
SecurityGroupName string
8282
ImageID string
83+
Zones []string
8384

8485
OSDiskSize int32
8586
DataDiskSize int32
@@ -241,6 +242,7 @@ func (p *provider) getConfig(s v1alpha1.ProviderSpec) (*config, *providerconfigt
241242
return nil, nil, fmt.Errorf("failed to get the value of \"securityGroupName\" field, error = %v", err)
242243
}
243244

245+
c.Zones = rawCfg.Zones
244246
c.Tags = rawCfg.Tags
245247
c.OSDiskSize = rawCfg.OSDiskSize
246248
c.DataDiskSize = rawCfg.DataDiskSize
@@ -506,7 +508,8 @@ func (p *provider) Create(machine *v1alpha1.Machine, data *cloudprovidertypes.Pr
506508
},
507509
StorageProfile: storageProfile,
508510
},
509-
Tags: tags,
511+
Tags: tags,
512+
Zones: &config.Zones,
510513
}
511514

512515
if config.AvailabilitySet != "" {

pkg/cloudprovider/provider/azure/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type RawConfig struct {
3535
RouteTableName providerconfigtypes.ConfigVarString `json:"routeTableName"`
3636
AvailabilitySet providerconfigtypes.ConfigVarString `json:"availabilitySet"`
3737
SecurityGroupName providerconfigtypes.ConfigVarString `json:"securityGroupName"`
38+
Zones []string `json:"zones"`
3839

3940
ImageID providerconfigtypes.ConfigVarString `json:"imageID"`
4041
OSDiskSize int32 `json:"osDiskSize"`

test/e2e/provisioning/testdata/machinedeployment-azure.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ spec:
3939
routeTableName: "machine-controller-e2e"
4040
imageID: "<< IMAGE_ID >>"
4141
assignPublicIP: false
42+
zones:
43+
- "1"
4244
operatingSystem: "<< OS_NAME >>"
4345
operatingSystemSpec:
4446
distUpgradeOnBoot: false

0 commit comments

Comments
 (0)