Skip to content

Commit

Permalink
Changed TTL of Health Reports to dynamic values (#76)
Browse files Browse the repository at this point in the history
* Changed TTL of Health Reports to dynamic values
* Version update to 1.4.8
  • Loading branch information
Saket Harsh authored Oct 27, 2020
1 parent d8a82a0 commit 2412599
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 23 deletions.
4 changes: 2 additions & 2 deletions arm/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"contentVersion": "1.0.0.0",
"parameters": {
"appPackageUrl": {
"defaultValue": "https://github.com/microsoft/Service-Fabric-POA/releases/download/v1.4.5/PatchOrchestrationApplication_v1.4.5.sfpkg",
"defaultValue": "https://github.com/microsoft/Service-Fabric-POA/releases/download/v1.4.8/PatchOrchestrationApplication_v1.4.8.sfpkg",
"metadata": {
"description": "The URL to the application package sfpkg file. example: https://github.com/microsoft/Service-Fabric-POA/releases/download/{{version}}/PatchOrchestrationApplication_{{version}}.sfpkg"
},
"type": "String"
},
"applicationTypeVersion": {
"defaultValue": "1.4.5",
"defaultValue": "1.4.8",
"metadata": {
"description": "The application type version."
},
Expand Down
4 changes: 2 additions & 2 deletions arm/template.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"contentVersion": "1.0.0.0",
"parameters": {
"appPackageUrl": {
"value": "https://github.com/microsoft/Service-Fabric-POA/releases/download/v1.4.5/PatchOrchestrationApplication_v1.4.5.sfpkg"
"value": "https://github.com/microsoft/Service-Fabric-POA/releases/download/v1.4.8/PatchOrchestrationApplication_v1.4.8.sfpkg"
},
"applicationTypeVersion": {
"value": "1.4.5"
"value": "1.4.8"
},
"clusterName": {
"value": "{{cluster name}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="CoordinatorServicePkg"
Version="1.4.7"
Version="1.4.8"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand All @@ -11,7 +11,7 @@
</ServiceTypes>

<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.4.7">
<CodePackage Name="Code" Version="1.4.8">
<EntryPoint>
<ExeHost>
<Program>CoordinatorService.exe</Program>
Expand All @@ -21,7 +21,7 @@

<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.4.7" />
<ConfigPackage Name="Config" Version="1.4.8" />

<Resources>
<Endpoints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public async Task PostClusterPatchingStatus(CancellationToken cancellationToken)
{
// Post the health event saying that there is no repair task and things are working fine.
string description = "No claimed tasks and no processing tasks are found.";
HealthManagerHelper.PostNodeHealthReport(this.fabricClient, this.context.ServiceName, ClusterPatchingStatusProperty, description, HealthState.Ok, -1);
HealthManagerHelper.PostNodeHealthReport(this.fabricClient, this.context.ServiceName, ClusterPatchingStatusProperty, description, HealthState.Ok, 2);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,21 @@ private void PostWUUpdateEventOnService()
CheckpointFileData fileData = this.ReadCheckpointFile();
string formatString = "Last patching attempt happened at : {0}, Next patching cycle is scheduled at : {1}";
string healthDescription = "";
DateTime initialTime = DateTime.Now;
if (fileData.lastAttemptedUpdateTime.Equals(_checkpointFileDefaultDateTime))
{
healthDescription = string.Format(formatString, "N/A", fileData.schedulingDateTime.ToString());
}
else
{
initialTime = fileData.lastAttemptedUpdateTime;
healthDescription = string.Format(formatString, fileData.lastAttemptedUpdateTime.ToString(), fileData.schedulingDateTime.ToString());
}
healthDescription += "\nFor detailed installation results, refer to https://docs.microsoft.com/azure/service-fabric/service-fabric-patch-orchestration-application#view-the-windows-update-results";
this._nodeAgentSfUtility.ReportHealth(WUOperationStatus, healthDescription, HealthState.Ok, -1, TimeSpan.FromMinutes(this._serviceSettings.OperationTimeOutInMinutes));

long timeToLive = (long)((fileData.schedulingDateTime - initialTime) + TimeSpan.FromDays(1)).TotalMinutes;

this._nodeAgentSfUtility.ReportHealth(WUOperationStatus, healthDescription, HealthState.Ok, timeToLive, TimeSpan.FromMinutes(this._serviceSettings.OperationTimeOutInMinutes));

}

Expand All @@ -109,7 +114,17 @@ private void PostWUUpdateEventOnService()
/// </summary>
private void DisableWindowsUpdate()
{

CheckpointFileData fileData = this.ReadCheckpointFile();

DateTime initialTime = DateTime.Now;

if (!fileData.lastAttemptedUpdateTime.Equals(_checkpointFileDefaultDateTime))
{
initialTime = fileData.lastAttemptedUpdateTime;
}

long timeToLive = (long)((fileData.schedulingDateTime - initialTime) + TimeSpan.FromDays(1)).TotalMinutes;

if (!this._serviceSettings.DisableWindowsUpdates)
{
_eventSource.InfoMessage("Not disabling automatic windows updates.");
Expand Down Expand Up @@ -139,7 +154,7 @@ private void DisableWindowsUpdate()
_eventSource.InfoMessage("New AU registry values are {0}", auUtility.LogCurrentAUValues());
}
string updateMsg = "Windows Update policy has been configured to Notify before Download";
this._nodeAgentSfUtility.ReportHealth(WUOperationSetting, updateMsg, HealthState.Ok, -1, TimeSpan.FromMinutes(this._serviceSettings.OperationTimeOutInMinutes));
this._nodeAgentSfUtility.ReportHealth(WUOperationSetting, updateMsg, HealthState.Ok, timeToLive, TimeSpan.FromMinutes(this._serviceSettings.OperationTimeOutInMinutes));
return;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="NodeAgentServicePkg"
Version="1.4.7"
Version="1.4.8"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand All @@ -11,7 +11,7 @@
</ServiceTypes>

<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.4.7">
<CodePackage Name="Code" Version="1.4.8">
<SetupEntryPoint>
<ExeHost>
<Program>SetupEntryPoint.bat</Program>
Expand All @@ -27,7 +27,7 @@

<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.4.7" />
<ConfigPackage Name="Config" Version="1.4.8" />

<Resources>
<Endpoints>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="PatchOrchestrationApplicationType" ApplicationTypeVersion="1.4.7" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="PatchOrchestrationApplicationType" ApplicationTypeVersion="1.4.8" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="CoordinatorService_MinReplicaSetSize" DefaultValue="3" />
<Parameter Name="CoordinatorService_TargetReplicaSetSize" DefaultValue="3" />
Expand Down Expand Up @@ -54,7 +54,7 @@
should match the Name and Version attributes of the ServiceManifest element defined in the
ServiceManifest.xml file. -->
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="CoordinatorServicePkg" ServiceManifestVersion="1.4.7" />
<ServiceManifestRef ServiceManifestName="CoordinatorServicePkg" ServiceManifestVersion="1.4.8" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
Expand All @@ -68,7 +68,7 @@
</ConfigOverrides>
</ServiceManifestImport>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="NodeAgentServicePkg" ServiceManifestVersion="1.4.7" />
<ServiceManifestRef ServiceManifestName="NodeAgentServicePkg" ServiceManifestVersion="1.4.8" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PropertyGroup Label="Configuration">
<Id>ServiceFabric.PatchOrchestrationApplication</Id>
<Title>ServiceFabric.PatchOrchestrationApplication</Title>
<Version>1.4.7</Version>
<Version>1.4.8</Version>
<Authors>brkhande;raunakp</Authors>
<Owners>brkhande;raunakp</Owners>
<Description>This package contains Service Fabric Patch Orchestration Application.</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Param
$ImageStoreConnectionString = "fabric:ImageStore",

[string]
$ApplicationVersion = "1.4.7",
$ApplicationVersion = "1.4.8",

[hashtable]
$ApplicationParameters = @{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Param
$ImageStoreConnectionString = "fabric:ImageStore",

[string]
$ApplicationVersion = "1.4.7"
$ApplicationVersion = "1.4.8"
)

Remove-ServiceFabricApplication -ApplicationName fabric:/PatchOrchestrationApplication -Force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Param
$ImageStoreConnectionString = "fabric:ImageStore",

[string]
$ApplicationVersion = "1.4.7",
$ApplicationVersion = "1.4.8",

[hashtable]
$ApplicationParameters = @{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TelemetryEvents
// Every time a new version of application would be release, manually update this version.
// This application version is used for telemetry
// For consistency keep this applicaiton version same as application version from application manifest.
private const string ApplicationVersion = "1.4.7";
private const string ApplicationVersion = "1.4.8";

public TelemetryEvents(FabricClient fabricClient, ITelemetryEventSource eventSource)
{
Expand Down
2 changes: 1 addition & 1 deletion src/properties/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
1. Assembly info
2. File info
3. Not yet in Telemetry of windows -->
<VersionPrefix>1.4.7</VersionPrefix>
<VersionPrefix>1.4.8</VersionPrefix>
<Company>Microsoft</Company>
<!--GenerateAssemblyInfo>false</GenerateAssemblyInfo-->
</PropertyGroup>
Expand Down

0 comments on commit 2412599

Please sign in to comment.