Skip to content

Conversation

@RazvanLoghin1
Copy link

Description

This PR introduces a new HasStableAksVersion operator to the Template Analyzer's JSON Rule Engine

This operator validates whether Azure Kubernetes Service (AKS) clusters are using stable Kubernetes versions for their deployment regions.


Key Changes

  • New Operator: HasStableAksVersionOperator evaluates AKS resources to verify they use stable Kubernetes versions.
  • Version Provider System: Implemented a provider pattern with IStableAksVersionProvider interface to fetch stable versions.
  • Default Implementation: DefaultStableAksVersionProvider fetches real-time stable versions from the official AKS releases API: [https://releases.aks.azure.com/webpage/parsed_data.json]
  • Caching Mechanism: Thread-safe singleton implementation with lazy initialization to minimise API calls.
  • Registry Pattern: StableAksVersionProviderRegistry allows runtime provider configuration (useful for testing).
  • Comprehensive Testing: Added unit tests (80%+ coverage), integration tests, and functional tests.
  • Documentation: Updated authoring guidelines with operator usage examples.

The operator:

  • Extracts location and properties.kubernetesVersion from AKS cluster resources.
  • Normalises location names (lowercase, no spaces) for consistent matching.
  • Fetches region-specific stable versions from Azure's AKS API (cached after first fetch).
  • Returns true if the version stability matches the expected value in the rule.

Example Usage

"path": "resources[*]",
  "where": {
    "path": "type",
    "equals": "Microsoft.ContainerService/managedClusters"
  },
"hasStableAKSVersion": true

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • Description of the pull request is clear and informative.
  • I have added myself to the 'assignees'.
  • I have added 'linked issues' if relevant.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@RazvanLoghin1 RazvanLoghin1 requested a review from a team as a code owner August 26, 2025 09:42
@RazvanLoghin1
Copy link
Author

@RazvanLoghin1 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@RazvanLoghin1 RazvanLoghin1 reopened this Aug 26, 2025
@RazvanLoghin1 RazvanLoghin1 marked this pull request as draft August 26, 2025 12:54
@RazvanLoghin1
Copy link
Author

@microsoft-github-policy-service agree company="Microsoft"

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.

1 participant