Skip to content

Commit

Permalink
VM extensions autoupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
et1975 committed Jan 7, 2025
1 parent cc57024 commit 6d0dfe5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Release Notes
=============

## 1.9.11
* VM extensions: support for auto-upgrades and initial version

## 1.9.10
* Application Gateways: Adds SSL Certificates
* Network Security Groups: use ARM expressions in security rules
Expand Down
3 changes: 3 additions & 0 deletions docs/content/api-overview/resources/vm-scale-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ The Virtual Machine Scale Set builder (`vmss`) creates a virtual machine scale s
| applicationHealthExtension | port | TCP port to probe. |
| applicationHealthExtension | interval | Interval to probe for health. |
| applicationHealthExtension | number_of_probes | Sets the number of times the probe must fail to consider this instance a failure. |
| applicationHealthExtension | enable_automatic_upgrade | Enable/Disable automatic extension upgrade (not enabled by default) |
| applicationHealthExtension | type_handler_version | Extension version (default: "1.0") |


#### Example

Expand Down
5 changes: 4 additions & 1 deletion src/Farmer/Arm/Compute.fs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ type ApplicationHealthExtension = {
NumberOfProbes: int option
GracePeriod: TimeSpan option
Tags: Map<string, string>
EnableAutomaticUpgrade: bool option
TypeHandlerVersion: string option
} with

static member Name = "HealthExtension"
Expand All @@ -138,8 +140,9 @@ type ApplicationHealthExtension = {
match this.OS with
| Linux -> "ApplicationHealthLinux"
| Windows -> "ApplicationHealthWindows"
typeHandlerVersion = "1.0"
typeHandlerVersion = this.TypeHandlerVersion |> Option.defaultValue "1.0"
autoUpgradeMinorVersion = true
enableAutomaticUpgrade = this.EnableAutomaticUpgrade |> Option.map box |> Option.defaultValue null
settings = {|
protocol = this.Protocol.ArmValue
port = this.Port
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Builders/Builders.Vm.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ type VmGalleryApplicationBuilder() =
galleryApp

[<CustomOperation "enable_automatic_upgrade">]
member _.EnableAutomaticUpgrade(state, enable) = {
member _.EnableAutomaticUpgrade(state: VmGalleryApplication, enable) = {
state with
EnableAutomaticUpgrade = Some enable
}
Expand Down
18 changes: 18 additions & 0 deletions src/Farmer/Builders/Builders.VmScaleSet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type ApplicationHealthExtensionConfig = {
NumberOfProbes: int option
GracePeriod: TimeSpan option
Tags: Map<string, string>
TypeHandlerVersion: string option
EnableAutomaticUpgrade: bool option
} with

interface IExtensionBuilder with
Expand All @@ -37,6 +39,8 @@ type ApplicationHealthExtensionConfig = {
NumberOfProbes = this.NumberOfProbes
GracePeriod = this.GracePeriod
Tags = this.Tags
TypeHandlerVersion = this.TypeHandlerVersion
EnableAutomaticUpgrade = this.EnableAutomaticUpgrade
}

interface IBuilder with
Expand Down Expand Up @@ -279,6 +283,20 @@ type ApplicationHealthExtensionBuilder() =
NumberOfProbes = None
GracePeriod = None
Tags = Map.empty
TypeHandlerVersion = None
EnableAutomaticUpgrade = None
}

[<CustomOperation "enable_automatic_upgrade">]
member _.EnableAutomaticUpgrade(state: ApplicationHealthExtensionConfig, enable) = {
state with
EnableAutomaticUpgrade = Some enable
}

[<CustomOperation "type_handler_version">]
member _.TypeHandlerVersion(state: ApplicationHealthExtensionConfig, version) = {
state with
TypeHandlerVersion = Some version
}

/// Sets the VMSS where this health extension should be installed.
Expand Down

0 comments on commit 6d0dfe5

Please sign in to comment.