You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a builder pattern to initialize resources used by investigations.
To allow not all resources to be prefilled as not every investigation
needs everything, this introduces a Builder pattern that is prefilled
with a subset of fields (OCM, PD, Cluster, Logging) that can be extended
by each investigation.
Once everything that is supposed to be build is set, calling Build()
will return the requested resources.
returnfmt.Errorf("could not initialize ocm client: %w", err)
116
115
}
117
116
118
-
cluster, err:=ocmClient.GetClusterInfo(clusterID)
119
-
iferr!=nil {
120
-
ifstrings.Contains(err.Error(), "no cluster found") {
121
-
logging.Warnf("No cluster found with ID '%s'. Exiting.", clusterID)
122
-
returnpdClient.EscalateIncidentWithNote("CAD was unable to find the incident cluster in OCM. An alert for a non-existing cluster is unexpected. Please investigate manually.")
123
-
}
124
-
returnfmt.Errorf("could not retrieve cluster info for %s: %w", clusterID, err)
125
-
}
126
-
127
-
// From this point on, we normalize to internal ID, as this ID always exists.
128
-
// For installing clusters, externalID can be empty.
129
-
internalClusterID:=cluster.ID()
130
-
131
-
// re-initialize logger for the internal-cluster-id context
0 commit comments