Skip to content

Commit

Permalink
look up searchdomain instead view during entity creation
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike committed Aug 14, 2024
1 parent cb10eab commit 8c2c0b2
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 153 deletions.
4 changes: 2 additions & 2 deletions controllers/suite/clusters/humiocluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ var _ = Describe("HumioCluster Controller", func() {

BeforeEach(func() {
// failed test runs that don't clean up leave resources behind.
testHumioClient.ClearHumioClientConnections()
testHumioClient.ClearHumioClientConnections("")
})

AfterEach(func() {
// Add any teardown steps that needs to be executed after each test
testHumioClient.ClearHumioClientConnections()
testHumioClient.ClearHumioClientConnections("")
})

// Add Tests for OpenAPI validation (or additional CRD features) specified in
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite/resources/humioresources_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ import (
var _ = Describe("Humio Resources Controllers", func() {
BeforeEach(func() {
// failed test runs that don't clean up leave resources behind.
humioClient.ClearHumioClientConnections()
humioClient.ClearHumioClientConnections(testRepoName)
})

AfterEach(func() {
// Add any teardown steps that needs to be executed after each test
humioClient.ClearHumioClientConnections()
humioClient.ClearHumioClientConnections(testRepoName)
})

// Add Tests for OpenAPI validation (or additional CRD features) specified in
Expand Down
5 changes: 3 additions & 2 deletions controllers/suite/resources/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var k8sManager ctrl.Manager
var humioClient humio.Client
var testTimeout time.Duration
var testNamespace corev1.Namespace
var testRepoName = "test-repo"
var testRepo corev1alpha1.HumioRepository
var testService1 corev1.Service
var testService2 corev1.Service
Expand Down Expand Up @@ -258,12 +259,12 @@ var _ = BeforeSuite(func() {

testRepo = corev1alpha1.HumioRepository{
ObjectMeta: metav1.ObjectMeta{
Name: "test-repo",
Name: testRepoName,
Namespace: clusterKey.Namespace,
},
Spec: corev1alpha1.HumioRepositorySpec{
ManagedClusterName: clusterKey.Name,
Name: "test-repo",
Name: testRepoName,
AllowDataDeletion: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/go-logr/logr v1.4.2
github.com/go-logr/zapr v1.3.0
github.com/google/go-cmp v0.6.0
github.com/humio/cli v0.36.1-0.20240813114317-eafdd46e889a
github.com/humio/cli v0.36.1-0.20240814103929-aacdf44666ce
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/gomega v1.34.1
github.com/prometheus/client_golang v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQu
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/humio/cli v0.36.1-0.20240813114317-eafdd46e889a h1:1SegzWT5U+6xslFrJgRnMbMVnSkQj19a6tl5u+nRB+A=
github.com/humio/cli v0.36.1-0.20240813114317-eafdd46e889a/go.mod h1:Du1GCeQ65rVrUQX/ge45RFflX+I3ZLU3sdCM8kHpuq8=
github.com/humio/cli v0.36.1-0.20240814103929-aacdf44666ce h1:WRVLad++Yerg08UcQCzAXY9UwV0P7U1lkOvrdMYUjVY=
github.com/humio/cli v0.36.1-0.20240814103929-aacdf44666ce/go.mod h1:Du1GCeQ65rVrUQX/ge45RFflX+I3ZLU3sdCM8kHpuq8=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down
18 changes: 0 additions & 18 deletions pkg/humio/alert_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ func AlertTransform(ha *humiov1alpha1.HumioAlert, actionIdMap map[string]string)
return alert
}

func AlertHydrate(ha *humiov1alpha1.HumioAlert, alert *humioapi.Alert, actionIdMap map[string]string) {
ha.Spec = humiov1alpha1.HumioAlertSpec{
Name: alert.Name,
Query: humiov1alpha1.HumioQuery{
QueryString: alert.QueryString,
Start: alert.QueryStart,
},
Description: alert.Description,
ThrottleTimeMillis: alert.ThrottleTimeMillis,
ThrottleField: alert.ThrottleField,
Silenced: !alert.Enabled,
Actions: actionIdsFromActionMap(ha.Spec.Actions, actionIdMap),
Labels: alert.Labels,
}

return
}

func actionIdsFromActionMap(actionList []string, actionIdMap map[string]string) []string {
var actionIds []string
for _, action := range actionList {
Expand Down
Loading

0 comments on commit 8c2c0b2

Please sign in to comment.