Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release v1.8] Retain fault and update domain counts #112

Merged
merged 2 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions charts/internal/azure-infra/templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ output "{{ .Values.outputKeys.availabilitySetID }}" {
output "{{ .Values.outputKeys.availabilitySetName }}" {
value = "${azurerm_availability_set.workers.name}"
}

output "{{ .Values.outputKeys.countFaultDomains }}" {
value = "${azurerm_availability_set.workers.platform_fault_domain_count}"
}

output "{{ .Values.outputKeys.countUpdateDomains }}" {
value = "${azurerm_availability_set.workers.platform_update_domain_count}"
}
{{- end}}
{{ if .Values.identity -}}
output "{{ .Values.outputKeys.identityID }}" {
Expand Down
2 changes: 2 additions & 0 deletions charts/internal/azure-infra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ outputKeys:
subnetName: subnetName
availabilitySetID: availabilitySetID
availabilitySetName: availabilitySetName
countFaultDomains: countFaultDomains
countUpdateDomains: countUpdateDomains
routeTableName: routeTableName
securityGroupName: securityGroupName
# identityID: managedIdentityID
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/frankban/quicktest v1.9.0 // indirect
github.com/gardener/etcd-druid v0.3.0
github.com/gardener/gardener v1.5.2
github.com/gardener/gardener v1.5.3
github.com/gardener/gardener-extension-networking-calico v1.7.1-0.20200522070525-f9aa28d3c83a
github.com/gardener/machine-controller-manager v0.27.0
github.com/go-logr/logr v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ github.com/gardener/external-dns-management v0.7.7/go.mod h1:egCe/FPOsUbXA4WV0ne
github.com/gardener/gardener v1.1.2/go.mod h1:CP9I0tCDVXTLPkJv/jUtXVUh948kSNKEGUg0haLz9gk=
github.com/gardener/gardener v1.3.1/go.mod h1:936P5tQbg6ViiW8BVC9ELM95sFrk4DgobKrxMNtn/LU=
github.com/gardener/gardener v1.4.1-0.20200519155656-a8ccc6cc779a/go.mod h1:t9oESM37bAMIuezi9I0H0I8+++8jy8BUPitcf4ERRXY=
github.com/gardener/gardener v1.5.2 h1:uv1m8kJMnh66yFj2gDUMYHbU1GNbXWKvRTlfy9MfI54=
github.com/gardener/gardener v1.5.2/go.mod h1:V+RVjUftDzhmb2ztBpf0uzyo1xoBjoDn0KKe0z+8IE0=
github.com/gardener/gardener v1.5.3 h1:9bW7dvD0/Pju6x3VriRIyL3AmoQ91SLl09gaCSEpeiw=
github.com/gardener/gardener v1.5.3/go.mod h1:V+RVjUftDzhmb2ztBpf0uzyo1xoBjoDn0KKe0z+8IE0=
github.com/gardener/gardener-extension-networking-calico v1.7.1-0.20200522070525-f9aa28d3c83a h1:jBvyEhkRzW11Nz2y9IIQAo9HUaCvCqxEko5Nf9NRYUI=
github.com/gardener/gardener-extension-networking-calico v1.7.1-0.20200522070525-f9aa28d3c83a/go.mod h1:bmD89OLvEBbXLlznsHe90ZlgTU+OrKErwHb6NWlSTvY=
github.com/gardener/gardener-resource-manager v0.10.0/go.mod h1:0pKTHOhvU91eQB0EYr/6Ymd7lXc/5Hi8P8tF/gpV0VQ=
Expand Down
26 changes: 25 additions & 1 deletion hack/api-reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,30 @@ string
<p>Name is the name of the availability set</p>
</td>
</tr>
<tr>
<td>
<code>countFaultDomains</code></br>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>CountFaultDomains is the count of fault domains.</p>
</td>
</tr>
<tr>
<td>
<code>countUpdateDomains</code></br>
<em>
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>CountUpdateDomains is the count of update domains.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="azure.provider.extensions.gardener.cloud/v1alpha1.CloudControllerManagerConfig">CloudControllerManagerConfig
Expand Down Expand Up @@ -403,7 +427,7 @@ string
<td>
<code>count</code></br>
<em>
int
int32
</em>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/azure/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func FindMachineImage(machineImages []api.MachineImage, name, version string) (*
}

// FindDomainCountByRegion takes a region and the domain counts and finds the count for the given region.
func FindDomainCountByRegion(domainCounts []api.DomainCount, region string) (int, error) {
func FindDomainCountByRegion(domainCounts []api.DomainCount, region string) (int32, error) {
for _, domainCount := range domainCounts {
if domainCount.Region == region {
return domainCount.Count, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/azure/helper/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ var _ = Describe("Helper", func() {
DescribeTable("#FindDomainCountByRegion",
func(domainCounts []api.DomainCount, region string, expectedCount int, expectErr bool) {
count, err := FindDomainCountByRegion(domainCounts, region)
expectResults(count, expectedCount, err, expectErr)
expectResults(count, int32(expectedCount), err, expectErr)
},

Entry("list is nil", nil, "foo", 0, true),
Entry("empty list", []api.DomainCount{}, "foo", 0, true),
Entry("entry not found", []api.DomainCount{{Region: "bar", Count: 1}}, "foo", 0, true),
Entry("entry exists", []api.DomainCount{{Region: "bar", Count: 1}}, "bar", 1, false),
Entry("entry not found", []api.DomainCount{{Region: "bar", Count: int32(1)}}, "foo", 0, true),
Entry("entry exists", []api.DomainCount{{Region: "bar", Count: int32(1)}}, "bar", 1, false),
)

DescribeTable("#FindImage",
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/azure/helper/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ func InfrastructureConfigFromInfrastructure(infra *extensionsv1alpha1.Infrastruc
return nil, fmt.Errorf("provider config is not set on the infrastructure resource")
}

// InfrastructureStatusFromInfrastructure extracts the InfrastructureStatus from the
// ProviderStatus section of the given Infrastructure.
func InfrastructureStatusFromInfrastructure(infra *extensionsv1alpha1.Infrastructure) (*api.InfrastructureStatus, error) {
config := &api.InfrastructureStatus{}
if infra.Status.ProviderStatus != nil && infra.Status.ProviderStatus.Raw != nil {
if _, _, err := decoder.Decode(infra.Status.ProviderStatus.Raw, nil, config); err != nil {
return nil, err
}
return config, nil
}
return nil, fmt.Errorf("provider status is not set on the infrastructure resource")
}

// CloudProfileConfigFromCluster decodes the provider specific cloud profile configuration for a cluster
func CloudProfileConfigFromCluster(cluster *controller.Cluster) (*api.CloudProfileConfig, error) {
var cloudProfileConfig *api.CloudProfileConfig
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/azure/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type DomainCount struct {
// Region is a region.
Region string
// Count is the count value for the respective domain count.
Count int
Count int32
}

// MachineImages is a mapping from logical names and versions to provider-specific identifiers.
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/azure/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ type AvailabilitySet struct {
ID string
// Name is the name of the availability set
Name string
// CountFaultDomains is the count of fault domains.
CountFaultDomains *int32
// CountUpdateDomains is the count of update domains.
CountUpdateDomains *int32
}

// RouteTable is the azure route table
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/azure/v1alpha1/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type DomainCount struct {
// Region is a region.
Region string `json:"region"`
// Count is the count value for the respective domain count.
Count int `json:"count"`
Count int32 `json:"count"`
}

// MachineImages is a mapping from logical names and versions to provider-specific identifiers.
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/azure/v1alpha1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ type AvailabilitySet struct {
ID string `json:"id"`
// Name is the name of the availability set
Name string `json:"name"`
// CountFaultDomains is the count of fault domains.
// +optional
CountFaultDomains *int32 `json:"countFaultDomains,omitempty"`
// CountUpdateDomains is the count of update domains.
// +optional
CountUpdateDomains *int32 `json:"countUpdateDomains,omitempty"`
}

// RouteTable is the azure route table
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/azure/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion pkg/apis/azure/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion pkg/apis/azure/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading