Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions pipelines/types/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,13 @@ const StepActionGrafanaManage = "GrafanaManage"
type GrafanaManageStep struct {
StepMeta `json:",inline"`

GrafanaName string `json:"grafanaName"`
Location string `json:"location"`
SKU string `json:"sku,omitempty"`
MajorVersion string `json:"majorVersion,omitempty"`
ZoneRedundancy string `json:"zoneRedundancy,omitempty"`
CrossTenantSecurityGroup string `json:"crossTenantSecurityGroup,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Timeout string `json:"timeout,omitempty"`
GrafanaName Value `json:"grafanaName"`
Location Value `json:"location"`
SKU Value `json:"sku,omitempty"`
MajorVersion Value `json:"majorVersion,omitempty"`
ZoneRedundancy Value `json:"zoneRedundancy,omitempty"`
CrossTenantSecurityGroup Value `json:"crossTenantSecurityGroup,omitempty"`
Timeout string `json:"timeout,omitempty"`

// IdentityFrom specifies the managed identity with which this deployment will run in Ev2.
IdentityFrom Input `json:"identityFrom,omitempty"`
Expand All @@ -786,10 +785,12 @@ func (s *GrafanaManageStep) Description() string {

func (s *GrafanaManageStep) RequiredInputs() []StepDependency {
var deps []StepDependency
for _, val := range []Input{s.IdentityFrom} {
deps = append(deps, val.StepDependency)
for _, val := range []Value{s.GrafanaName, s.Location, s.SKU, s.MajorVersion, s.ZoneRedundancy, s.CrossTenantSecurityGroup} {
if val.Input != nil {
deps = append(deps, val.Input.StepDependency)
}
}

deps = append(deps, s.IdentityFrom.StepDependency)
slices.SortFunc(deps, SortDependencies)
deps = slices.Compact(deps)
return deps
Expand Down
8 changes: 6 additions & 2 deletions pipelines/types/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,14 @@ func TestRequiredInputs(t *testing.T) {
{
name: "grafana manage full",
input: &GrafanaManageStep{
IdentityFrom: Input{StepDependency: StepDependency{ResourceGroup: "rg", Step: "step"}},
GrafanaName: Value{Input: &Input{StepDependency: StepDependency{ResourceGroup: "rg", Step: "step1"}}},
Location: Value{Input: &Input{StepDependency: StepDependency{ResourceGroup: "rg", Step: "step2"}}},
IdentityFrom: Input{StepDependency: StepDependency{ResourceGroup: "rg", Step: "step3"}},
},
expected: []StepDependency{
{ResourceGroup: "rg", Step: "step"},
{ResourceGroup: "rg", Step: "step1"},
{ResourceGroup: "rg", Step: "step2"},
{ResourceGroup: "rg", Step: "step3"},
},
},
{
Expand Down
23 changes: 6 additions & 17 deletions pipelines/types/pipeline.schema.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -752,33 +752,22 @@
"const": "GrafanaManage"
},
"grafanaName": {
"type": "string"
"$ref": "#/definitions/value"
},
"location": {
"type": "string"
"$ref": "#/definitions/value"
},
"sku": {
"type": "string"
"$ref": "#/definitions/value"
Comment on lines 754 to +761
},
"majorVersion": {
"type": "string"
"$ref": "#/definitions/value"
},
"zoneRedundancy": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
]
"$ref": "#/definitions/value"
},
Comment on lines 766 to 768
Comment on lines 763 to 768
"crossTenantSecurityGroup": {
"type": "string"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Azure resource tags for the Grafana instance"
"$ref": "#/definitions/value"
},
"timeout": {
"$ref": "#/definitions/durationString"
Expand Down
4 changes: 0 additions & 4 deletions tools/grafanactl/cmd/manage/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ func (o *CompletedReconcileOptions) Run(ctx context.Context) error {
if o.CrossTenantSecurityGroup != "" {
tags["AMG.CrossTenant.SecurityGroup"] = &o.CrossTenantSecurityGroup
}
for k, v := range o.Tags {
vCopy := v
tags[k] = &vCopy
}

discoveredIDs, err := o.ResourceGraphDiscoveryClient.DiscoverMonitorWorkspaceIDs(ctx)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions tools/grafanactl/cmd/manage/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type RawReconcileOptions struct {
MajorVersion string
ZoneRedundancy string
CrossTenantSecurityGroup string
Tags map[string]string
}

type validatedReconcileOptions struct {
Expand Down Expand Up @@ -75,7 +74,6 @@ func BindReconcileOptions(opts *RawReconcileOptions, cmd *cobra.Command) error {
flags.StringVar(&opts.MajorVersion, "major-version", opts.MajorVersion, "Grafana major version (e.g. 11)")
flags.StringVar(&opts.ZoneRedundancy, "zone-redundancy", opts.ZoneRedundancy, "Zone redundancy mode: Enabled or Disabled")
flags.StringVar(&opts.CrossTenantSecurityGroup, "cross-tenant-security-group", opts.CrossTenantSecurityGroup, "Cross-tenant security group (format: GroupObjectId;TenantId)")
flags.StringToStringVar(&opts.Tags, "tags", opts.Tags, "Additional Azure resource tags for the Grafana instance (key=value,key2=value2)")

return nil
}
Expand Down
Loading