Skip to content

Commit a6b471f

Browse files
Merge pull request #369 from tnierman/rename_investigations
OSD-28725 - Rename investigation structures to standard name 'Investigation'
2 parents 7d50007 + 857dabc commit a6b471f

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

cadctl/cmd/investigate/investigate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func run(_ *cobra.Command, _ []string) error {
122122
customerAwsClient, err := managedcloud.CreateCustomerAWSClient(cluster, ocmClient)
123123
if err != nil {
124124
ccamResources := &investigation.Resources{Name: "ccam", Cluster: cluster, ClusterDeployment: clusterDeployment, AwsClient: customerAwsClient, OcmClient: ocmClient, PdClient: pdClient, AdditionalResources: map[string]interface{}{"error": err}}
125-
inv := ccam.CCAM{}
125+
inv := ccam.Investigation{}
126126
result, err := inv.Run(ccamResources)
127127
updateMetrics(alertInvestigation.Name(), &result)
128128
return err

pkg/investigations/ccam/ccam.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/openshift/configuration-anomaly-detection/pkg/ocm"
1313
)
1414

15-
type CCAM struct{}
15+
type Investigation struct{}
1616

1717
var ccamLimitedSupport = &ocm.LimitedSupportReason{
1818
Summary: "Restore missing cloud credentials",
@@ -21,14 +21,14 @@ var ccamLimitedSupport = &ocm.LimitedSupportReason{
2121

2222
// Evaluate estimates if the awsError is a cluster credentials are missing error. If it determines that it is,
2323
// the cluster is placed into limited support (if the cluster state allows it), otherwise an error is returned.
24-
func (c *CCAM) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
24+
func (c *Investigation) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
2525
result := investigation.InvestigationResult{}
2626
cluster := r.Cluster
2727
ocmClient := r.OcmClient
2828
pdClient := r.PdClient
2929
bpError, ok := r.AdditionalResources["error"].(error)
3030
if !ok {
31-
return result, fmt.Errorf("Missing required CCAM field 'error'")
31+
return result, fmt.Errorf("Missing required Investigation field 'error'")
3232
}
3333
logging.Info("Investigating possible missing cloud credentials...")
3434

@@ -64,19 +64,19 @@ func (c *CCAM) Run(r *investigation.Resources) (investigation.InvestigationResul
6464
}
6565
}
6666

67-
func (c *CCAM) Name() string {
67+
func (c *Investigation) Name() string {
6868
return "Cluster Credentials Are Missing (CCAM)"
6969
}
7070

71-
func (c *CCAM) Description() string {
71+
func (c *Investigation) Description() string {
7272
return "Detects missing cluster credentials"
7373
}
7474

75-
func (c *CCAM) ShouldInvestigateAlert(alert string) bool {
75+
func (c *Investigation) ShouldInvestigateAlert(alert string) bool {
7676
return false
7777
}
7878

79-
func (c *CCAM) IsExperimental() bool {
79+
func (c *Investigation) IsExperimental() bool {
8080
return false
8181
}
8282

pkg/investigations/ccam/ccam_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestEvaluateRandomError(t *testing.T) {
2020
},
2121
}
2222

23-
inv := CCAM{}
23+
inv := Investigation{}
2424

2525
_, err := inv.Run(&input)
2626
if err.Error() != timeoutError.Error() {

pkg/investigations/chgm/chgm.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ var (
3636
}
3737
)
3838

39-
type CHGM struct{}
39+
type Investiation struct{}
4040

4141
// Run runs the investigation for a triggered chgm pagerduty event
42-
func (c *CHGM) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
42+
func (c *Investiation) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
4343
result := investigation.InvestigationResult{}
4444
notes := notewriter.New("CHGM", logging.RawLogger)
4545

@@ -118,19 +118,19 @@ func (c *CHGM) Run(r *investigation.Resources) (investigation.InvestigationResul
118118
return result, r.PdClient.EscalateIncidentWithNote(notes.String())
119119
}
120120

121-
func (c *CHGM) Name() string {
121+
func (c *Investiation) Name() string {
122122
return "Cluster Has Gone Missing (CHGM)"
123123
}
124124

125-
func (c *CHGM) Description() string {
125+
func (c *Investiation) Description() string {
126126
return "Detects reason for clusters that have gone missing"
127127
}
128128

129-
func (c *CHGM) ShouldInvestigateAlert(alert string) bool {
129+
func (c *Investiation) ShouldInvestigateAlert(alert string) bool {
130130
return strings.Contains(alert, "has gone missing")
131131
}
132132

133-
func (c *CHGM) IsExperimental() bool {
133+
func (c *Investiation) IsExperimental() bool {
134134
return false
135135
}
136136

pkg/investigations/chgm/chgm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var _ = Describe("chgm", func() {
9292
mockCtrl.Finish()
9393
})
9494

95-
inv := CHGM{}
95+
inv := Investiation{}
9696

9797
Describe("Triggered", func() {
9898
When("Triggered finds instances stopped by the customer", func() {

pkg/investigations/clustermonitoringerrorbudgetburn/clustermonitoringerrorbudgetburn.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ var uwmMisconfiguredSL = ocm.ServiceLog{
2525
InternalOnly: false,
2626
}
2727

28-
type CMEBB struct{}
28+
type Investigation struct{}
2929

30-
func (c *CMEBB) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
30+
func (c *Investigation) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
3131
// Initialize k8s client
3232
// This would be better suited to be passend in with the investigation resources
3333
// In turn we would need to split out ccam and k8sclient, as those are tied to a cluster
@@ -84,19 +84,19 @@ func (c *CMEBB) Run(r *investigation.Resources) (investigation.InvestigationResu
8484
return result, r.PdClient.EscalateIncidentWithNote(notes.String())
8585
}
8686

87-
func (c *CMEBB) Name() string {
87+
func (c *Investigation) Name() string {
8888
return "clustermonitoringerrorbudgetburn"
8989
}
9090

91-
func (c *CMEBB) Description() string {
91+
func (c *Investigation) Description() string {
9292
return "Investigate the cluster monitoring error budget burn alert"
9393
}
9494

95-
func (c *CMEBB) ShouldInvestigateAlert(alert string) bool {
95+
func (c *Investigation) ShouldInvestigateAlert(alert string) bool {
9696
return strings.Contains(alert, "ClusterMonitoringErrorBudgetBurnSRE")
9797
}
9898

99-
func (c *CMEBB) IsExperimental() bool {
99+
func (c *Investigation) IsExperimental() bool {
100100
return true
101101
}
102102

pkg/investigations/cpd/cpd.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/openshift/configuration-anomaly-detection/pkg/ocm"
1313
)
1414

15-
type CPD struct{}
15+
type Investigation struct{}
1616

1717
// https://raw.githubusercontent.com/openshift/managed-notifications/master/osd/aws/InstallFailed_NoRouteToInternet.json
1818
var byovpcRoutingSL = &ocm.ServiceLog{Severity: "Major", Summary: "Installation blocked: Missing route to internet", Description: "Your cluster's installation is blocked because of the missing route to internet in the route table(s) associated with the supplied subnet(s) for cluster installation. Please review and validate the routes by following documentation and re-install the cluster: https://docs.openshift.com/container-platform/latest/installing/installing_aws/installing-aws-vpc.html#installation-custom-aws-vpc-requirements_installing-aws-vpc.", InternalOnly: false, ServiceName: "SREManualAction"}
@@ -27,7 +27,7 @@ var byovpcRoutingSL = &ocm.ServiceLog{Severity: "Major", Summary: "Installation
2727
// - always escalate the alert to primary
2828
// The reasoning for this is that we don't fully trust network verifier yet.
2929
// In the future, we want to automate service logs based on the network verifier output.
30-
func (c *CPD) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
30+
func (c *Investigation) Run(r *investigation.Resources) (investigation.InvestigationResult, error) {
3131
result := investigation.InvestigationResult{}
3232
notes := notewriter.New("CPD", logging.RawLogger)
3333

@@ -119,19 +119,19 @@ func (c *CPD) Run(r *investigation.Resources) (investigation.InvestigationResult
119119
return result, r.PdClient.EscalateIncident()
120120
}
121121

122-
func (c *CPD) Name() string {
122+
func (c *Investigation) Name() string {
123123
return "ClusterProvisioningDelay"
124124
}
125125

126-
func (c *CPD) Description() string {
126+
func (c *Investigation) Description() string {
127127
return "Investigates the ClusterProvisioningDelay alert"
128128
}
129129

130-
func (c *CPD) ShouldInvestigateAlert(alert string) bool {
130+
func (c *Investigation) ShouldInvestigateAlert(alert string) bool {
131131
return strings.Contains(alert, "ClusterProvisioningDelay -")
132132
}
133133

134-
func (c *CPD) IsExperimental() bool {
134+
func (c *Investigation) IsExperimental() bool {
135135
return false
136136
}
137137

pkg/investigations/registry.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
// availableInvestigations holds all Investigation implementations.
1212
var availableInvestigations = []investigation.Investigation{
13-
&ccam.CCAM{},
14-
&chgm.CHGM{},
15-
&clustermonitoringerrorbudgetburn.CMEBB{},
16-
&cpd.CPD{},
13+
&ccam.Investigation{},
14+
&chgm.Investiation{},
15+
&clustermonitoringerrorbudgetburn.Investigation{},
16+
&cpd.Investigation{},
1717
}
1818

1919
// GetInvestigation returns the first Investigation that applies to the given alert title.

0 commit comments

Comments
 (0)