From f3e6b79d57548f698ae3939b0898eb7302f3f8dd Mon Sep 17 00:00:00 2001 From: Sidhant Bhatia Date: Wed, 11 Dec 2024 18:09:31 -0500 Subject: [PATCH 1/2] made github version check configurable for airgapped clusters --- FabricHealer/FabricHealerManager.cs | 12 ++++++++---- FabricHealer/PackageRoot/Config/Settings.xml | 1 + FabricHealer/Repair/RepairConstants.cs | 3 +++ FabricHealer/Utilities/ConfigSettings.cs | 11 +++++++++++ .../ApplicationPackageRoot/ApplicationManifest.xml | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/FabricHealer/FabricHealerManager.cs b/FabricHealer/FabricHealerManager.cs index 03d4c829..7931991d 100644 --- a/FabricHealer/FabricHealerManager.cs +++ b/FabricHealer/FabricHealerManager.cs @@ -273,13 +273,17 @@ await TelemetryUtilities.EmitTelemetryEtwHealthEventAsync( } } - // Check for new version once a day. - if (DateTime.UtcNow.Subtract(LastVersionCheckDateTime) >= OperationalTelemetryRunInterval) + if (ConfigSettings.CheckGithubVersion) { - await CheckGithubForNewVersionAsync(); - LastVersionCheckDateTime = DateTime.UtcNow; + // Check for new version once a day. + if (DateTime.UtcNow.Subtract(LastVersionCheckDateTime) >= OperationalTelemetryRunInterval) + { + await CheckGithubForNewVersionAsync(); + LastVersionCheckDateTime = DateTime.UtcNow; + } } + await Task.Delay( TimeSpan.FromSeconds( ConfigSettings.HealthCheckIntervalInSeconds > 0 ? ConfigSettings.HealthCheckIntervalInSeconds : 10), Token); diff --git a/FabricHealer/PackageRoot/Config/Settings.xml b/FabricHealer/PackageRoot/Config/Settings.xml index a3bcfdf9..ba6cde07 100644 --- a/FabricHealer/PackageRoot/Config/Settings.xml +++ b/FabricHealer/PackageRoot/Config/Settings.xml @@ -7,6 +7,7 @@ + diff --git a/FabricHealer/Repair/RepairConstants.cs b/FabricHealer/Repair/RepairConstants.cs index 96e907d8..a6d116e9 100644 --- a/FabricHealer/Repair/RepairConstants.cs +++ b/FabricHealer/Repair/RepairConstants.cs @@ -154,5 +154,8 @@ public static class RepairConstants public const string MaxOutstandingRepairs = "MaxOutstandingRepairs"; public const string NodeProbationPeriod = "NodeProbationPeriod"; public const string MinHealthStateDuration = "MinHealthStateDuration"; + + // Octokit Github Version Check + public const string CheckGithubVersion = "CheckGithubVersion"; } } \ No newline at end of file diff --git a/FabricHealer/Utilities/ConfigSettings.cs b/FabricHealer/Utilities/ConfigSettings.cs index 6b693e50..23b1e662 100644 --- a/FabricHealer/Utilities/ConfigSettings.cs +++ b/FabricHealer/Utilities/ConfigSettings.cs @@ -63,6 +63,12 @@ public string AppInsightsConnectionString private set; } + public bool CheckGithubVersion + { + get; + private set; + } + // For Azure LogAnalytics Telemetry public string LogAnalyticsWorkspaceId { @@ -188,6 +194,11 @@ internal void UpdateConfigSettings(ConfigurationSettings settings = null) EnableCustomRepairPredicateType = enableCustomRepairPredicateType; } + if(bool.TryParse(GetConfigSettingValue(RepairConstants.RepairManagerConfigurationSectionName, RepairConstants.CheckGithubVersion), out bool checkGithubVersion)) + { + CheckGithubVersion = checkGithubVersion; + } + // Logger if (bool.TryParse(GetConfigSettingValue(RepairConstants.RepairManagerConfigurationSectionName, RepairConstants.EnableVerboseLoggingParameter), out bool enableVerboseLogging)) { diff --git a/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml b/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml index 8d1470b4..40c1c380 100644 --- a/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml +++ b/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml @@ -5,6 +5,7 @@ + From 432fc55ef6e884af8f3f646ff2005cd2b2fd7dee Mon Sep 17 00:00:00 2001 From: Sidhant Bhatia Date: Thu, 12 Dec 2024 16:32:21 -0500 Subject: [PATCH 2/2] added missing parameter value to ConfigOverride section --- FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml b/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml index 40c1c380..b05627d6 100644 --- a/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml +++ b/FabricHealerApp/ApplicationPackageRoot/ApplicationManifest.xml @@ -61,6 +61,7 @@ +