Skip to content

Commit

Permalink
Update Disk API version
Browse files Browse the repository at this point in the history
This fixes Azure#4057
  • Loading branch information
matthchr committed Jul 31, 2024
1 parent 5fe0bce commit 0342885
Show file tree
Hide file tree
Showing 89 changed files with 69,354 additions and 10,913 deletions.
11 changes: 11 additions & 0 deletions docs/hugo/content/reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ These resource(s) are available for use in the current release of ASO. Different

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.

### Next Release

Development of these new resources is complete and they will be available in the next release of ASO.

| Resource | ARM Version | CRD Version | Supported From | Sample |
|-------------------|-------------|---------------|----------------|---------------------------------------------------------------------------------------------------------------------------------|
| 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) |
| DiskAccess | 2024-03-02 | v1api20240302 | v2.9.0 | - |
| 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) |
| 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) |

### Released

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.
Expand Down
11 changes: 11 additions & 0 deletions docs/hugo/content/reference/compute/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ no_list: true
---
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.

### Next Release

Development of these new resources is complete and they will be available in the next release of ASO.

| Resource | ARM Version | CRD Version | Supported From | Sample |
|-------------------|-------------|---------------|----------------|---------------------------------------------------------------------------------------------------------------------------------|
| 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) |
| DiskAccess | 2024-03-02 | v1api20240302 | v2.9.0 | - |
| 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) |
| 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) |

### Released

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.
Expand Down
20 changes: 20 additions & 0 deletions v2/api/compute/customizations/disk_access_extension_types_gen.go

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

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

8 changes: 6 additions & 2 deletions v2/api/compute/customizations/disk_extension_types_gen.go

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

63 changes: 63 additions & 0 deletions v2/api/compute/customizations/disk_extensions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
*/

package customizations

import (
"regexp"

"github.com/go-logr/logr"

"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/extensions"
)

var _ extensions.ErrorClassifier = &DiskExtension{}

// diskAccessNotFoundRegex matches the error returned by CRP when the DiskAccess doesn't exist yet.
var diskAccessNotFoundRegex = regexp.MustCompile("DiskAccess.*not found")

// diskAccessFailedStateRegex matches the error returned by CRP when a DiskAccess is not in successful state yet.
// Note that even though this says failed, this is returned even if the resource is in a transitioning state (and
// will succeed eventually)
var diskAccessFailedStateRegex = regexp.MustCompile("DiskAccess.*is in failed state.")

//var retryableList = []*regexp.Regexp{
// diskAccessNotFoundRegex,
// diskAccessFailedStateRegex,
//}

// ClassifyError evaluates the provided error, returning whether it is fatal or can be retried.
func (e *DiskExtension) ClassifyError(
cloudError *genericarmclient.CloudError,
apiVersion string,
log logr.Logger,
next extensions.ErrorClassifierFunc,
) (core.CloudErrorDetails, error) {
details, err := next(cloudError)
if err != nil {
return core.CloudErrorDetails{}, err
}

// If the DiskAccess doesn't exist yet, we retry as it may be being created
if retryable(details) {
details.Classification = core.ErrorRetryable
}

return details, nil
}

func retryable(details core.CloudErrorDetails) bool {
if details.Code == "BadRequest" && diskAccessNotFoundRegex.MatchString(details.Message) {
return true
}

if details.Code == "Conflict" && diskAccessFailedStateRegex.MatchString(details.Message) {
return true
}

return false
}
8 changes: 6 additions & 2 deletions v2/api/compute/customizations/snapshot_extension_types_gen.go

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

1 change: 1 addition & 0 deletions v2/api/compute/customizations/structure.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Code generated by azure-service-operator-codegen. DO NOT EDIT.
github.com/Azure/azure-service-operator/v2/api/compute/customizations
---------------------------------------------------------------------
DiskAccessExtension: Object (0 properties)
DiskEncryptionSetExtension: Object (0 properties)
DiskExtension: Object (0 properties)
ImageExtension: Object (0 properties)
Expand Down
Loading

0 comments on commit 0342885

Please sign in to comment.