Skip to content

grafanactl: reconcile ADX datasources#228

Open
swiencki wants to merge 4 commits intoAzure:mainfrom
swiencki:swiencki/grafanactl-adx-datasource
Open

grafanactl: reconcile ADX datasources#228
swiencki wants to merge 4 commits intoAzure:mainfrom
swiencki:swiencki/grafanactl-adx-datasource

Conversation

@swiencki
Copy link
Copy Markdown

@swiencki swiencki commented Apr 28, 2026

What

Extends the existing GrafanaDatasources typed step and grafanactl modify datasource reconcile flow with optional ADX/Kusto datasource support.

This keeps Azure Monitor datasource reconciliation as the default path, adds ADX flags only when configured, and supports create/update/delete desired-state behavior for the named ADX datasource.

Why

ARO-HCP needs to provision ADX datasources through the existing typed/prebuilt-binary rollout pattern instead of introducing an ADX-only EV2 shell path or rollout-time go run.

Testing

  • go test ./pipelines/types ./tools/grafanactl/...
  • make lint

Cross-repo rollout

Merge order is required:

  1. This PR lands first.
  2. ARO-HCP consumes the merged ARO-Tools version in ARO-26057: add ADX Grafana datasource provisioning ARO-HCP#4878.
  3. sdp-pipelines consumes the merged ARO-Tools + ARO-HCP versions in https://dev.azure.com/msazure/AzureRedHatOpenShift/_git/sdp-pipelines/pullrequest/15393796 and regenerates rollout artifacts.

Copilot AI review requested due to automatic review settings April 28, 2026 17:57
Copy link
Copy Markdown

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

Adds a new grafanactl modify datasource reconcile-adx subcommand to create/update a single Azure Data Explorer (ADX) Grafana datasource via the Grafana REST API (rather than relying on Azure CLI datasource commands), along with supporting Grafana client capabilities and tests.

Changes:

  • Introduces ADX reconcile command + option parsing/validation/completion flow.
  • Extends the internal Grafana client with datasource type listing and status-aware create/update requests.
  • Updates docs and adds unit tests for the new ADX logic and client behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/grafanactl/internal/grafana/client.go Adds status-aware datasource create/update helpers and datasource type listing.
tools/grafanactl/internal/grafana/client_test.go Adds tests for create/update request behavior and error reporting.
tools/grafanactl/cmd/modify/cmd.go Registers the new modify datasource reconcile-adx subcommand.
tools/grafanactl/cmd/modify/adx_options.go Implements flags, validation, and completion for ADX reconcile options.
tools/grafanactl/cmd/modify/adx.go Implements reconcile logic (create vs update) and desired datasource payload generation.
tools/grafanactl/cmd/modify/adx_options_test.go Adds unit tests covering validation and reconcile create/update paths.
tools/grafanactl/README.md Documents ADX datasource reconcile usage and common flag alternative.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/grafanactl/cmd/modify/adx.go Outdated
Comment thread tools/grafanactl/internal/grafana/client_test.go
Comment thread tools/grafanactl/internal/grafana/client.go Outdated
swiencki added a commit to Azure/ARO-HCP that referenced this pull request Apr 28, 2026
Replace the temporary shell datasource script with a direct grafanactl invocation and keep cleanup datasource deletion out of this rollout scope.

Depends on Azure/ARO-Tools#228.
Copilot AI review requested due to automatic review settings April 30, 2026 21:02
swiencki added a commit to Azure/ARO-HCP that referenced this pull request Apr 30, 2026
Replace the temporary shell datasource script with a direct grafanactl invocation and keep cleanup datasource deletion out of this rollout scope.

Depends on Azure/ARO-Tools#228.
@swiencki swiencki force-pushed the swiencki/grafanactl-adx-datasource branch from 2b887f7 to 73394d8 Compare April 30, 2026 21:02
Copy link
Copy Markdown

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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/grafanactl/cmd/modify/options.go
Comment thread tools/grafanactl/internal/grafana/client.go
Comment thread tools/grafanactl/README.md
Comment thread tools/grafanactl/cmd/modify/adx_options.go Outdated
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.

2 participants