Skip to content

Conversation

@ashleyvansp
Copy link
Contributor

@ashleyvansp ashleyvansp commented Jul 3, 2025

Overview

This pull request implements ApplyAsync() and its helper methods. The method is used to generate changes between the current state (the live Kusto cluster) and a desired state (YAML config file). It then executes those changes by running the change scripts on the Kusto cluster.

This PR is a follow-up to #106.

https://github.com/github/data/issues/9010

Changes

  • Implements ApplyAsync() which diffs then executes cluster configuration changes
  • Adds functionality to KustoClusterHandler to execute cluster scripts
  • Refactors the KustoClusterHandler for better testability
  • Updates the ClusterCapacityPolicy model to have parity with the model returned by .show cluster policy capacity
    • When I first created this model I was referencing the properties from the Microsoft docs, but the docs seem to be slightly out of sync with the actual model returned from Kusto

Copilot AI review requested due to automatic review settings July 3, 2025 23:07

This comment was marked as outdated.

@ashleyvansp ashleyvansp requested a review from Copilot July 3, 2025 23:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the ability to diff and apply cluster configuration changes by implementing ApplyAsync() (and its helper WriteAsync/ExecuteClusterScriptAsync) in KustoClusterHandler and KustoClusterOrchestrator, refactors handlers to use ICslAdminProvider, and updates the capacity policy model to include MirroringCapacity.

  • Introduces ApplyAsync in KustoClusterOrchestrator to load YAML, generate diffs, and execute scripts.
  • Implements WriteAsync and ExecuteClusterScriptAsync in KustoClusterHandler to batch and run cluster scripts.
  • Updates ClusterCapacityPolicy and related classes to add MirroringCapacity and refactor capacities.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Parser/YamlClusterHandlerFactory.cs Implements IYamlClusterHandlerFactory
Parser/KustoClusterHandlerFactory.cs Passes AdminClient to handler instead of full client
Parser/KustoClusterHandler.cs Replaces KustoClient with ICslAdminProvider, adds script execution methods
Model/ClusterCapacityPolicy.cs Adds MirroringCapacity, refactors materialized view capacity classes
KustoClusterOrchestrator.cs Adds ApplyAsync for full apply workflow
Tests/Parser/KustoClusterHandlerTests.cs Adds unit tests for WriteAsync and LoadAsync
Tests/KustoClusterOrchestratorTests.cs Updates tests to use ICslAdminProvider mocks
Tests/Changes/ClusterChangesTest.cs Refactors test helpers to match capacity policy changes
Comments suppressed due to low confidence (1)

KustoSchemaTools.Tests/KustoClusterOrchestratorTests.cs:6

  • Essential using directives for Xunit ([Fact]), System.Threading.Tasks (async/Task), and System.Collections.Generic (List<>) were removed, causing compilation errors. Re-add these namespaces at the top of the test file.
using Kusto.Data.Common;

@ashleyvansp ashleyvansp merged commit 620346c into main Jul 4, 2025
5 checks passed
@ashleyvansp ashleyvansp deleted the ashleyvansp/applyCluster branch July 4, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants