-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable native support for Failover Cluster NC #287
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description Summary of changes: - Create two new modules, one for ServiceFabric NC cmdlets as well as FailoverCluster NC cmdlets # Change type - [ ] Bug fix (non-breaking change) - [ ] Code style update (formatting, local variables) - [x] New Feature (non-breaking change that adds new functionality without impacting existing) - [ ] Breaking change (fix or feature that may cause functionality impact) - [ ] Other # Checklist: - [x] My code follows the style and contribution guidelines of this project. - [x] I have tested and validated my code changes.
- Updated `Get-SdnNetworkControllerNode` and `Get-SdnNetworkController` to be wrappers around specific SF and NC functions - Added `Get-SdnNetworkControllerSF` and `Get-SdnNetworkControllerSFNode` - Added `Get-SdnNetworkControllerFC` and `Get-SdnNetworkControllerFCNode` - Updated existing SF cmdlets to ensure that FabricHostSvc is running, otherwise throw terminating exception
This pull request introduces several changes to the `SdnDiagnostics` module, primarily to support both Service Fabric and Failover Cluster configurations. The changes simplify the codebase, improve the handling of cluster types, and modify several functions to accommodate the new cluster configurations. Here are the most important changes: Cluster Configuration Support: * [`src/SdnDiagnostics.psm1`](diffhunk://#diff-490865628c61b2e97c50f45b37d7086647c70b2444cbfb9c60cc8c682801356eL11-R22): Renamed `ClusterConfigurationType` to `ClusterConfigType`, added `FailoverClusterConfig` to the `EnvironmentInfo` global variable, and added several new properties. This change supports both Service Fabric and Failover Cluster configurations. * [`src/modules/SdnDiag.NetworkController/private/Get-SdnClusterType.ps1`](diffhunk://#diff-2451a381f2b776c4a302eb668f17924aa1ad82307495e04b55ed8e69bea430f8R1-R49): Added a new function `Get-SdnClusterType` to determine the cluster type of the Network Controller. This function checks if the ApiService is running as a service within windows, which indicates a Failover Cluster configuration. * `src/modules/SdnDiag.NetworkController/private/Get-SdnNetworkControllerRestURL.ps1` and `src/modules/SdnDiag.NetworkController/public/Get-SdnInfrastructureInfo.ps1`: Updated to use `ClusterConfigType` instead of `ClusterConfigurationType`. This change allows these functions to support both Service Fabric and Failover Cluster configurations. [[1]](diffhunk://#diff-fb9eed00d11c628f309c47078a9ef9d96fb8513fd06925ccd1b9313df00910eaL24-R24) [[2]](diffhunk://#diff-5eb3ff3eb27aac8cf3bba7ddb23507bfa1d65b2ff6ae6ab2a176f4d871ba84e6L59-R76) Function Modifications: * [`src/SdnDiagnostics.psm1`](diffhunk://#diff-490865628c61b2e97c50f45b37d7086647c70b2444cbfb9c60cc8c682801356eR624-R643): Added a script block `$collectClusterLogsSB` in the `Start-SdnDataCollection` function to collect cluster logs and compress them into a zip file. This change will help to preserve disk space. * [`src/modules/SdnDiag.Common/private/Get-CommonConfigState.ps1`](diffhunk://#diff-835b08b8e1c0bce0a59f0c589152e1a7e9a6e24bfb443ad00669c63f3924d881L58-R58): Modified the `Get-CommonConfigState` function to include `-ErrorAction $ErrorActionPreference` in the `Get-NetAdapterAdvancedProperty` cmdlet. This change improves error handling. * [`src/modules/SdnDiag.NetworkController.FC/private/Get-SdnClusterName.ps1`](diffhunk://#diff-5c8dc2849956c598e30fbe1008e22689493be806df2cf5f403958cdb2e86d99cR1-R27): Added a new function `Get-SdnClusterName` to retrieve the name of the cluster. This function is used when the cluster configuration is a Failover Cluster. File Renaming and Function Renaming: * [`src/modules/SdnDiag.NetworkController.SF/public/Get-SdnNetworkControllerSFClusterInfo.ps1`](diffhunk://#diff-5341c9c7f5422384dd3e8c32208ecbbfba0da5d944367bc289b2ee83c0d6b14aL1-R1): Renamed from `Get-SdnNetworkControllerClusterInfo.ps1` and updated the function name to `Get-SdnNetworkControllerSFClusterInfo`. This change reflects the specific use of this function for Service Fabric configurations. [[1]](diffhunk://#diff-5341c9c7f5422384dd3e8c32208ecbbfba0da5d944367bc289b2ee83c0d6b14aL1-R1) [[2]](diffhunk://#diff-5341c9c7f5422384dd3e8c32208ecbbfba0da5d944367bc289b2ee83c0d6b14aL10-R14) Code Simplification: * [`src/SdnDiagnostics.psd1`](diffhunk://#diff-17aaaa968cc894449c79b449c228b28d8a8990bde4000e59bcf24d8189671ee1L85-L90): Removed several `Get-SdnNetworkController` function variants that were specific to either FC or SF. This change simplifies the codebase and reflects the new handling of cluster configurations. * [`src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.Config.psd1`](diffhunk://#diff-656db7b7942a5c8bebb655094f4e112758a27267910335e9c06d6575c280b295L15-R16): Simplified the `EventLogProviders` array by using wildcard characters. This change makes the code easier to maintain.
…to iteration-4
This pull request primarily focuses on enhancing the support for Service Fabric clusters in the SdnDiagnostics module. The changes involve adding conditional checks in various functions to ensure they are only executed on Service Fabric clusters. Additionally, some code has been refactored for better organization and readability. The most significant changes are as follows: **Added checks for Service Fabric cluster configuration:** * `Start-SdnCertificateRotation` in `SdnDiagnostics.psm1`: Added a condition to check if the cluster configuration type is Service Fabric. If not, an exception is thrown. Also, the role for getting the SdnModuleConfiguration has been changed to 'NetworkController_SF'. * `Repair-SdnDiagnosticsScheduledTask` in `Repair-SdnDiagnosticsScheduledTask.ps1`: Added a switch statement to set the task name based on the cluster configuration type. * Several functions in `SdnDiag.NetworkController.SF` and `SdnDiag.NetworkController` modules: Added a condition to check if the cluster configuration type is Service Fabric. If not, an exception is thrown. [[1]](diffhunk://#diff-324c08d6d20cb9d37d1a5b9756303f40024eb3d5c4008d8b210c8e7295ea1151R47-R50) [[2]](diffhunk://#diff-9e1adf0cfe8d7b8cf607e163c0a96ffc5c307137717e02c2c6b241176d47b502R30-R33) [[3]](diffhunk://#diff-da56c5aff5c8d4ae1f24d32ba504c7708faf180de322fca8cd422a318f6ca088R34-R37) [[4]](diffhunk://#diff-de7dc7282f0b7233ad4ce1ccf8882c14469a3cb33837707792c5d660dd91605aR48-R51) [[5]](diffhunk://#diff-67eb6850f4f3aa92b6398560376b7e8ae52e5be6b6b9504ba882588c7843e4fbL36-R37) [[6]](diffhunk://#diff-dd2d52a041fb0b98591e81eb4c4f2a8a1807f54f1510401f498ef4e6d1451b4bR38-R41) [[7]](diffhunk://#diff-705c2c643df865da51dd5c96aab0f2b1b892dba826f9e62e51302f6f3fd90ee1R17-R20) [[8]](diffhunk://#diff-a54d2dff16ad518ff9e95173bfb4bdc38c7f5241c46c76e3f79f36359b672b31R17-R20) [[9]](diffhunk://#diff-99617b1bd78044ec20af4d249f5641df0de3a0beae707ac9f9cbf97084b25278R38-R41) [[10]](diffhunk://#diff-0b23655b2855a4a49fd3072131d78f5feec01254c422213affdc0b22b2c27eefR33-R36) **Code refactoring:** * `Set-SdnNetworkController` in `Set-SdnNetworkController.ps1`: The code to set the parameters for the function has been moved after the check for Service Fabric cluster configuration. * `Get-SdnServiceFabricNode` in `Get-SdnServiceFabricNode.ps1`: Removed an unnecessary line of code. These changes aim to improve the module's functionality and compatibility with Service Fabric clusters, ensuring that the appropriate functions are executed based on the cluster configuration type.
luyaof
approved these changes
Jul 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes changes to enhance the functionality of the SDN Diagnostics module, particularly for Service Fabric and Failover Cluster configurations. The most significant changes are the addition of new commands, modifications to existing commands, and the introduction of new modules for different cluster configurations.
Additions and modifications to commands:
src/SdnDiagnostics.Helper.psm1
: Removed 'Test-SdnKnownIssue' and added new commands to the$networkControllerParamCommands
array.src/modules/SdnDiag.Common/private/Export-RegistryKeyConfigDetails.ps1
: Changed the logging level and improved the registry key path enumeration. Added a security measure to redact the AESKey for cluster network controller registry keys. [1] [2]src/modules/SdnDiag.Common/private/Get-CommonConfigState.ps1
: Modified theGet-NetAdapterAdvancedProperty
command to handle errors according to the$ErrorActionPreference
variable.src/modules/SdnDiag.Common/public/Repair-SdnDiagnosticsScheduledTask.ps1
: Added a switch statement to handle differentClusterConfigType
values.src/modules/SdnDiag.Health/private/Test-NcUrlNameResolution.ps1
: Changed theGet-SdnNetworkController
command toGet-SdnNetworkControllerSF
.src/modules/SdnDiag.Health/public/Debug-SdnFabricInfrastructure.ps1
: Added a condition to throw an exception if theClusterConfigType
is not 'ServiceFabric'.New modules for different cluster configurations:
src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.Config.psd1
: Created a new configuration file for the NetworkControllerFC module.src/modules/SdnDiag.NetworkController.FC/SdnDiag.NetworkController.FC.psm1
: Created a new module file for the NetworkControllerFC module.src/modules/SdnDiag.NetworkController.FC/private/Get-NetworkControllerFCConfigState.ps1
: Created a new function to output a set of configuration state files for the network controller role.src/modules/SdnDiag.NetworkController.FC/private/Get-SdnClusterName.ps1
: Created a new function to get the cluster name.src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFC.ps1
: Created a new function to get network controller application settings.src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFCClusterInfo.ps1
: Created a new function to gather the Network Controller cluster wide info.src/modules/SdnDiag.NetworkController.FC/private/Get-SdnNetworkControllerFCNode.ps1
: Created a new function to return a list of servers from network controller.src/modules/SdnDiag.NetworkController.SF/SdnDiag.NetworkController.SF.Config.psd1
: Created a new configuration file for the NetworkControllerSF module.File additions:
src/SdnDiagnostics.psd1
: Added new module files to the list of files.