Skip to content

Add manage grafana command#260

Merged
janboll merged 10 commits into
mainfrom
grafanactl-add-grafana-reconcile
Jul 1, 2026
Merged

Add manage grafana command#260
janboll merged 10 commits into
mainfrom
grafanactl-add-grafana-reconcile

Conversation

@janboll

@janboll janboll commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

https://redhat.atlassian.net/browse/ARO-28040

Adds infrastructure lifecycle management for Azure Managed Grafana to grafanactl, aims at replacing Bicep-based provisioning. The new command creates/updates the Grafana resource and discovers all Azure Monitor Workspaces across subscriptions via Azure Resource Graph and filters to only concern the HCP ones. It will them reconciling them as datasource integrations.

Adds infrastructure lifecycle management for Azure Managed Grafana to
  grafanactl, aims at replacing Bicep-based provisioning. The new
  command creates/updates the Grafana resource and discovers all Azure
  Monitor Workspaces across subscriptions via Azure Resource Graph,
  reconciling them as datasource integrations.
Copilot AI review requested due to automatic review settings June 29, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 manage reconcile workflow intended to manage Azure Managed Grafana lifecycle and reconcile Azure Monitor Workspace integrations using Azure Resource Graph, and wires a corresponding pipeline step type/schema to represent this action.

Changes:

  • Adds a new manage reconcile command with flags/validation and runtime wiring to create/update a Managed Grafana resource and reconcile Azure Monitor Workspace integrations.
  • Introduces Azure Resource Graph–based discovery and a Managed Grafana create/update helper in the internal Azure layer.
  • Extends pipeline step types + JSON schema to include a GrafanaReconcile step, and updates Go dependencies accordingly.

Reviewed changes

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

Show a summary per file
File Description
tools/grafanactl/internal/azure/utils.go Adds SafeString helper for nil-safe string dereferencing.
tools/grafanactl/internal/azure/monitor.go Adds Resource Graph discovery client for Azure Monitor Workspace IDs.
tools/grafanactl/internal/azure/grafana.go Fixes client creation error text; adds create/update helper for Managed Grafana.
tools/grafanactl/cmd/manage/options.go Adds reconcile options, flags, validation, and client initialization.
tools/grafanactl/cmd/manage/cmd.go Implements manage reconcile command behavior and integration reconciliation.
tools/grafanactl/go.mod Adds Resource Graph SDK dependency and bumps several module versions.
tools/grafanactl/go.sum Updates dependency checksums for the new/updated modules.
pipelines/types/resourcegroup.go Enables unmarshalling of the new GrafanaReconcile step action.
pipelines/types/pipeline.schema.v1.json Defines and wires the grafanaReconcileStep schema.
pipelines/types/common.go Adds GrafanaReconcileStep type + action constant.
go.work.sum Updates workspace sums due to dependency changes.

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

Comment thread tools/grafanactl/internal/azure/monitor.go
Comment thread tools/grafanactl/cmd/manage/cmd.go
Comment thread tools/grafanactl/cmd/manage/cmd.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 21 out of 31 changed files in this pull request and generated 1 comment.

Comment thread tools/grafanactl/cmd/manage/cmd.go
Comment thread pipelines/types/pipeline.schema.v1.json Outdated
Filter the AMWs by aroHCPPurpuse tag. Also allow managing tags via step
definition.

Filter the AMWs in manage as well.
Copilot AI review requested due to automatic review settings June 30, 2026 10:20
@janboll janboll force-pushed the grafanactl-add-grafana-reconcile branch from ae467fa to 40e99dc Compare June 30, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 22 out of 32 changed files in this pull request and generated 2 comments.

Comment thread tools/grafanactl/cmd/manage/cmd.go Outdated
Comment thread tools/grafanactl/internal/azure/monitor.go
Copilot AI review requested due to automatic review settings June 30, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 26 out of 36 changed files in this pull request and generated 2 comments.

Comment thread tools/grafanactl/internal/azure/monitor.go Outdated
Comment thread tools/grafanactl/cmd/manage/cmd.go
Copilot AI review requested due to automatic review settings June 30, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 26 out of 36 changed files in this pull request and generated 1 comment.

Comment thread tools/grafanactl/cmd/modify/cmd.go
@janboll janboll force-pushed the grafanactl-add-grafana-reconcile branch from 868c6b9 to 731dad7 Compare June 30, 2026 11:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 30, 2026 11:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 26 out of 36 changed files in this pull request and generated 1 comment.

Comment thread tools/grafanactl/cmd/base/options.go
Copilot AI review requested due to automatic review settings June 30, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 26 out of 36 changed files in this pull request and generated 2 comments.

Comment thread tools/grafanactl/cmd/manage/cmd.go
Comment thread tools/grafanactl/cmd/manage/cmd.go
Comment thread pipelines/types/common.go
@janboll

janboll commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

This enables Azure/ARO-HCP#5843

@raelga raelga left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 07:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 27 out of 37 changed files in this pull request and generated 2 comments.

flags.StringVar(&opts.GrafanaResourceID, "grafana-resource-id", opts.GrafanaResourceID, "Azure Managed Grafana instance resource ID")
flags.StringVar(&opts.OutputFormat, "output", opts.OutputFormat, "Output format: table or json")
flags.BoolVar(&opts.DryRun, "dry-run", opts.DryRun, "Print actions without executing them")
flags.DurationVar(&opts.Timeout, "timeout", opts.Timeout, "Timeout for the operation")
Comment on lines +98 to +101
if o.ZoneRedundancy != "Enabled" && o.ZoneRedundancy != "Disabled" {
return nil, fmt.Errorf("--zone-redundancy must be 'Enabled' or 'Disabled', got: %s", o.ZoneRedundancy)
}

@janboll janboll merged commit e5cce9f into main Jul 1, 2026
3 checks passed
@janboll janboll deleted the grafanactl-add-grafana-reconcile branch July 1, 2026 08:01
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.

4 participants