Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
24 changes: 24 additions & 0 deletions Documentation/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions bundle.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions jsonnet/prometheus-operator/alertmanagerconfigs-crd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2291,6 +2291,10 @@
"description": "Severity of the incident.",
"type": "string"
},
"source": {
"description": "Unique location of the affected system.",
"type": "string"
},
"url": {
"description": "The URL to send requests to.",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,10 @@
description: 'Severity of the incident.',
type: 'string',
},
source: {
description: 'Unique location of the affected system.',
type: 'string',
},
url: {
description: 'The URL to send requests to.',
type: 'string',
Expand Down
4 changes: 4 additions & 0 deletions pkg/alertmanager/amcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,10 @@ func (cb *configBuilder) convertPagerdutyConfig(ctx context.Context, in monitori
out.HTTPConfig = httpConfig
}

if in.Source != nil {
out.Source = *in.Source
}

return out, nil
}

Expand Down
26 changes: 26 additions & 0 deletions pkg/alertmanager/amcfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3833,6 +3833,32 @@ func TestSanitizePagerDutyConfig(t *testing.T) {
},
},
},
{
name: "Test source is added in pagerduty config for supported versions",
againstVersion: semver.Version{Major: 0, Minor: 25},
in: &alertmanagerConfig{
Receivers: []*receiver{
{
PagerdutyConfigs: []*pagerdutyConfig{
{
Source: "foo",
},
},
},
},
},
expect: alertmanagerConfig{
Receivers: []*receiver{
{
PagerdutyConfigs: []*pagerdutyConfig{
{
Source: "foo",
},
},
},
},
},
},
} {
t.Run(tc.name, func(t *testing.T) {
err := tc.in.sanitize(tc.againstVersion, logger)
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/monitoring/v1alpha1/alertmanager_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ type PagerDutyConfig struct {
// HTTP client configuration.
// +optional
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"`
// Unique location of the affected system.
// +optional
Source *string `yaml:"source,omitempty" json:"source,omitempty"`
}

// PagerDutyImageConfig attaches images to an incident
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/monitoring/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/apis/monitoring/v1beta1/alertmanager_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ type PagerDutyConfig struct {
// HTTP client configuration.
// +optional
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"`
// Unique location of the affected system.
// +optional
Source *string `yaml:"source,omitempty" json:"source,omitempty"`
}

// PagerDutyImageConfig attaches images to an incident
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/monitoring/v1beta1/conversion_from.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func convertPagerDutyConfigFrom(in v1alpha1.PagerDutyConfig) PagerDutyConfig {
PagerDutyImageConfigs: convertPagerDutyImageConfigsFrom(in.PagerDutyImageConfigs),
PagerDutyLinkConfigs: convertPagerDutyLinkConfigsFrom(in.PagerDutyLinkConfigs),
HTTPConfig: convertHTTPConfigFrom(in.HTTPConfig),
Source: in.Source,
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/apis/monitoring/v1beta1/conversion_to.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ func convertPagerDutyConfigTo(in PagerDutyConfig) v1alpha1.PagerDutyConfig {
PagerDutyImageConfigs: convertPagerDutyImageConfigsTo(in.PagerDutyImageConfigs),
PagerDutyLinkConfigs: convertPagerDutyLinkConfigsTo(in.PagerDutyLinkConfigs),
HTTPConfig: convertHTTPConfigTo(in.HTTPConfig),
Source: in.Source,
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/monitoring/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.