Skip to content

Commit 11fd018

Browse files
authored
Update Disk API version (#4171)
This fixes #4057
1 parent 5fe0bce commit 11fd018

File tree

89 files changed

+69349
-10913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+69349
-10913
lines changed

docs/hugo/content/reference/_index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ These resource(s) are available for use in the current release of ASO. Different
153153

154154
To install the CRDs for these resources, your ASO configuration must include `compute.azure.com/*` as a one of the configured CRD patterns. See [CRD Management in ASO](https://azure.github.io/azure-service-operator/guide/crd-management/) for details on doing this for both [Helm](https://azure.github.io/azure-service-operator/guide/crd-management/#helm) and [YAML](https://azure.github.io/azure-service-operator/guide/crd-management/#yaml) based installations.
155155

156+
### Next Release
157+
158+
Development of these new resources is complete and they will be available in the next release of ASO.
159+
160+
| Resource | ARM Version | CRD Version | Supported From | Sample |
161+
|-------------------|-------------|---------------|----------------|---------------------------------------------------------------------------------------------------------------------------------|
162+
| Disk | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_disk.yaml) |
163+
| DiskAccess | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_diskaccess.yaml) |
164+
| DiskEncryptionSet | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_diskencryptionset.yaml) |
165+
| Snapshot | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_snapshot.yaml) |
166+
156167
### Released
157168

158169
These resource(s) are available for use in the current release of ASO. Different versions of a given resource reflect different versions of the Azure ARM API.

docs/hugo/content/reference/compute/_index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ no_list: true
55
---
66
To install the CRDs for these resources, your ASO configuration must include `compute.azure.com/*` as a one of the configured CRD patterns. See [CRD Management in ASO](https://azure.github.io/azure-service-operator/guide/crd-management/) for details on doing this for both [Helm](https://azure.github.io/azure-service-operator/guide/crd-management/#helm) and [YAML](https://azure.github.io/azure-service-operator/guide/crd-management/#yaml) based installations.
77

8+
### Next Release
9+
10+
Development of these new resources is complete and they will be available in the next release of ASO.
11+
12+
| Resource | ARM Version | CRD Version | Supported From | Sample |
13+
|-------------------|-------------|---------------|----------------|---------------------------------------------------------------------------------------------------------------------------------|
14+
| Disk | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_disk.yaml) |
15+
| DiskAccess | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_diskaccess.yaml) |
16+
| DiskEncryptionSet | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_diskencryptionset.yaml) |
17+
| Snapshot | 2024-03-02 | v1api20240302 | v2.9.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/compute/v1api/v1api20240302_snapshot.yaml) |
18+
819
### Released
920

1021
These resource(s) are available for use in the current release of ASO. Different versions of a given resource reflect different versions of the Azure ARM API.

v2/api/compute/customizations/disk_access_extension_types_gen.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v2/api/compute/customizations/disk_encryption_set_extension_types_gen.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v2/api/compute/customizations/disk_extension_types_gen.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Copyright (c) Microsoft Corporation.
3+
Licensed under the MIT license.
4+
*/
5+
6+
package customizations
7+
8+
import (
9+
"regexp"
10+
11+
"github.com/go-logr/logr"
12+
13+
"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
14+
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
15+
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/extensions"
16+
)
17+
18+
var _ extensions.ErrorClassifier = &DiskExtension{}
19+
20+
// diskAccessNotFoundRegex matches the error returned by CRP when the DiskAccess doesn't exist yet.
21+
var diskAccessNotFoundRegex = regexp.MustCompile("DiskAccess.*not found")
22+
23+
// diskAccessFailedStateRegex matches the error returned by CRP when a DiskAccess is not in successful state yet.
24+
// Note that even though this says failed, this is returned even if the resource is in a transitioning state (and
25+
// will succeed eventually)
26+
var diskAccessFailedStateRegex = regexp.MustCompile("DiskAccess.*is in failed state.")
27+
28+
// ClassifyError evaluates the provided error, returning whether it is fatal or can be retried.
29+
func (e *DiskExtension) ClassifyError(
30+
cloudError *genericarmclient.CloudError,
31+
apiVersion string,
32+
log logr.Logger,
33+
next extensions.ErrorClassifierFunc,
34+
) (core.CloudErrorDetails, error) {
35+
details, err := next(cloudError)
36+
if err != nil {
37+
return core.CloudErrorDetails{}, err
38+
}
39+
40+
// If the DiskAccess doesn't exist yet, we retry as it may be being created
41+
if shouldRetry(details) {
42+
details.Classification = core.ErrorRetryable
43+
}
44+
45+
return details, nil
46+
}
47+
48+
func shouldRetry(details core.CloudErrorDetails) bool {
49+
if details.Code == "BadRequest" && diskAccessNotFoundRegex.MatchString(details.Message) {
50+
return true
51+
}
52+
53+
if details.Code == "Conflict" && diskAccessFailedStateRegex.MatchString(details.Message) {
54+
return true
55+
}
56+
57+
return false
58+
}

v2/api/compute/customizations/snapshot_extension_types_gen.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v2/api/compute/customizations/structure.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Code generated by azure-service-operator-codegen. DO NOT EDIT.
22
github.com/Azure/azure-service-operator/v2/api/compute/customizations
33
---------------------------------------------------------------------
4+
DiskAccessExtension: Object (0 properties)
45
DiskEncryptionSetExtension: Object (0 properties)
56
DiskExtension: Object (0 properties)
67
ImageExtension: Object (0 properties)

0 commit comments

Comments
 (0)