diff --git a/Makefile b/Makefile
index 5fd733d..bb6a3e8 100644
--- a/Makefile
+++ b/Makefile
@@ -122,7 +122,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
.PHONY: deploy
-deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
+deploy: manifests kustomize install ## Deploy controller to the K8s cluster specified in ~/.kube/config.
# Step 1: Set the image in the manager deployment
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
diff --git a/apis/coralogix/v1alpha1/alert_types.go b/apis/coralogix/v1alpha1/alert_types.go
index ee28ec9..6fc7b2c 100644
--- a/apis/coralogix/v1alpha1/alert_types.go
+++ b/apis/coralogix/v1alpha1/alert_types.go
@@ -1082,116 +1082,6 @@ func expandNotification(notification Notification, webhooksNameToIds map[string]
return result, nil
}
-func (in *AlertSpec) DeepEqual(actualAlert *AlertStatus) (bool, utils.Diff) {
- if actualName := actualAlert.Name; actualName != in.Name {
- return false, utils.Diff{
- Name: "Name",
- Desired: in.Name,
- Actual: actualName,
- }
- }
-
- if actualDescription := actualAlert.Description; actualDescription != in.Description {
- return false, utils.Diff{
- Name: "Description",
- Desired: in.Description,
- Actual: actualDescription,
- }
- }
-
- if actualActive := actualAlert.Active; actualActive != in.Active {
- return false, utils.Diff{
- Name: "Active",
- Desired: in.Active,
- Actual: actualActive,
- }
- }
-
- if actualSeverity := actualAlert.Severity; actualSeverity != in.Severity {
- return false, utils.Diff{
- Name: "Severity",
- Desired: in.Severity,
- Actual: actualSeverity,
- }
- }
-
- if !reflect.DeepEqual(in.Labels, actualAlert.Labels) {
- return false, utils.Diff{
- Name: "Labels",
- Desired: in.Labels,
- Actual: actualAlert.Labels,
- }
- }
-
- if !reflect.DeepEqual(in.ExpirationDate, actualAlert.ExpirationDate) {
- return false, utils.Diff{
- Name: "ExpirationDate",
- Desired: utils.PointerToString(in.ExpirationDate),
- Actual: utils.PointerToString(actualAlert.ExpirationDate),
- }
- }
-
- if equal, diff := in.AlertType.DeepEqual(actualAlert.AlertType); !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("AlertType.%s", diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
-
- notificationGroups, actualNotificationGroups := in.NotificationGroups, actualAlert.NotificationGroups
- {
- if equal, diff := DeepEqualNotificationGroups(notificationGroups, actualNotificationGroups); !equal {
- return false, diff
- }
- }
-
- if !utils.SlicesWithUniqueValuesEqual(in.PayloadFilters, actualAlert.PayloadFilters) {
- return false, utils.Diff{
- Name: "PayloadFilters",
- Desired: in.PayloadFilters,
- Actual: actualAlert.PayloadFilters,
- }
- }
-
- if scheduling, actualScheduling := in.Scheduling, actualAlert.Scheduling; (scheduling == nil && actualScheduling != nil) || (scheduling != nil && actualScheduling == nil) {
- return false, utils.Diff{
- Name: "Scheduling",
- Desired: scheduling,
- Actual: actualScheduling,
- }
- } else if actualScheduling == nil {
-
- } else if equal, diff := scheduling.DeepEqual(*actualScheduling); !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("Scheduling.%s", diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
-
- showInInsight, actualShowInInsight := in.ShowInInsight, actualAlert.ShowInInsight
- {
- if showInInsight != nil {
- if actualShowInInsight == nil {
- return false, utils.Diff{
- Name: "ShowInInsight",
- Desired: *showInInsight,
- Actual: actualShowInInsight,
- }
- } else if equal, diff := showInInsight.DeepEqual(*actualShowInInsight); !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("ShowInInsight.%s", diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
- }
- }
-
- return true, utils.Diff{}
-}
-
func DeepEqualNotificationGroups(notificationGroups []NotificationGroup, actualNotificationGroups []NotificationGroup) (bool, utils.Diff) {
if length, actualLength := len(notificationGroups), len(actualNotificationGroups); length != actualLength {
return false, utils.Diff{
@@ -3078,28 +2968,6 @@ type FlowOperator string
// AlertStatus defines the observed state of Alert
type AlertStatus struct {
ID *string `json:"id"`
-
- Name string `json:"name,omitempty"`
-
- Description string `json:"description,omitempty"`
-
- Active bool `json:"active,omitempty"`
-
- Severity AlertSeverity `json:"severity,omitempty"`
-
- Labels map[string]string `json:"labels,omitempty"`
-
- ExpirationDate *ExpirationDate `json:"expirationDate,omitempty"`
-
- ShowInInsight *ShowInInsight `json:"showInInsight,omitempty"`
-
- NotificationGroups []NotificationGroup `json:"notificationGroups,omitempty"`
-
- PayloadFilters []string `json:"payloadFilters,omitempty"`
-
- Scheduling *Scheduling `json:"scheduling,omitempty"`
-
- AlertType AlertType `json:"alertType,omitempty"`
}
func NewDefaultAlertStatus() *AlertStatus {
diff --git a/apis/coralogix/v1alpha1/outboundwebhook_types.go b/apis/coralogix/v1alpha1/outboundwebhook_types.go
index c6369ae..7cc6476 100644
--- a/apis/coralogix/v1alpha1/outboundwebhook_types.go
+++ b/apis/coralogix/v1alpha1/outboundwebhook_types.go
@@ -71,28 +71,6 @@ type OutboundWebhookType struct {
AwsEventBridge *AwsEventBridge `json:"awsEventBridge,omitempty"`
}
-type OutboundWebhookTypeStatus struct {
- GenericWebhook *GenericWebhookStatus `json:"genericWebhook,omitempty"`
-
- Slack *Slack `json:"slack,omitempty"`
-
- PagerDuty *PagerDuty `json:"pagerDuty,omitempty"`
-
- SendLog *SendLogStatus `json:"sendLog,omitempty"`
-
- EmailGroup *EmailGroup `json:"emailGroup,omitempty"`
-
- MicrosoftTeams *MicrosoftTeams `json:"microsoftTeams,omitempty"`
-
- Jira *Jira `json:"jira,omitempty"`
-
- Opsgenie *Opsgenie `json:"opsgenie,omitempty"`
-
- Demisto *Demisto `json:"demisto,omitempty"`
-
- AwsEventBridge *AwsEventBridge `json:"awsEventBridge,omitempty"`
-}
-
func (in *OutboundWebhookType) appendOutgoingWebhookConfig(data *cxsdk.OutgoingWebhookInputData) (*cxsdk.OutgoingWebhookInputData, error) {
if genericWebhook := in.GenericWebhook; genericWebhook != nil {
data.Config = genericWebhook.extractGenericWebhookConfig()
@@ -138,55 +116,6 @@ func (in *OutboundWebhookType) appendOutgoingWebhookConfig(data *cxsdk.OutgoingW
return data, nil
}
-func (in *OutboundWebhookType) DeepEqual(webhookType *OutboundWebhookTypeStatus) (bool, utils.Diff) {
- if webhookType == nil {
- return false, utils.Diff{
- Name: "OutboundWebhookType",
- Desired: utils.PointerToString(in),
- Actual: nil,
- }
- }
-
- equal, diff := true, utils.Diff{}
- if desiredGenericWebhook, actualGenericWebhook := in.GenericWebhook, webhookType.GenericWebhook; desiredGenericWebhook != nil {
- equal, diff = desiredGenericWebhook.DeepEqual(actualGenericWebhook)
- } else if desiredSlack, actualSlack := in.Slack, webhookType.Slack; desiredSlack != nil {
- equal, diff = desiredSlack.DeepEqual(actualSlack)
- } else if desiredPagerDuty, actualPagerDuty := in.PagerDuty, webhookType.PagerDuty; desiredPagerDuty != nil {
- equal, diff = desiredPagerDuty.DeepEqual(actualPagerDuty)
- } else if desiredSendLog, actualSendLog := in.SendLog, webhookType.SendLog; desiredSendLog != nil {
- equal, diff = desiredSendLog.DeepEqual(actualSendLog)
- } else if desiredEmailGroup, actualEmailGroup := in.EmailGroup, webhookType.EmailGroup; desiredEmailGroup != nil {
- equal, diff = desiredEmailGroup.DeepEqual(actualEmailGroup)
- } else if desiredMicrosoftTeams, actualMicrosoftTeams := in.MicrosoftTeams, webhookType.MicrosoftTeams; desiredMicrosoftTeams != nil {
- equal, diff = desiredMicrosoftTeams.DeepEqual(actualMicrosoftTeams)
- } else if desiredJira, actualJira := in.Jira, webhookType.Jira; desiredJira != nil {
- equal, diff = desiredJira.DeepEqual(actualJira)
- } else if desiredOpsgenie, actualOpsgenie := in.Opsgenie, webhookType.Opsgenie; desiredOpsgenie != nil {
- equal, diff = desiredOpsgenie.DeepEqual(actualOpsgenie)
- } else if desiredDemisto, actualDemisto := in.Demisto, webhookType.Demisto; desiredDemisto != nil {
- equal, diff = desiredDemisto.DeepEqual(actualDemisto)
- } else if desiredAwsEventBridge, actualAwsEventBridge := in.AwsEventBridge, webhookType.AwsEventBridge; desiredAwsEventBridge != nil {
- equal, diff = desiredAwsEventBridge.DeepEqual(actualAwsEventBridge)
- } else {
- return false, utils.Diff{
- Name: "OutboundWebhookType",
- Desired: utils.PointerToString(in),
- Actual: utils.PointerToString(webhookType),
- }
- }
-
- if !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("OutboundWebhookType.%s", diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
-
- return true, utils.Diff{}
-}
-
type GenericWebhook struct {
Url string `json:"url"`
@@ -767,10 +696,6 @@ type OutboundWebhookStatus struct {
// +optional
ExternalID *string `json:"externalId"`
-
- Name string `json:"name"`
-
- OutboundWebhookType *OutboundWebhookTypeStatus `json:"outboundWebhookType"`
}
//+kubebuilder:object:root=true
@@ -812,35 +737,6 @@ func (in *OutboundWebhook) ExtractUpdateOutboundWebhookRequest() (*cxsdk.UpdateO
}, nil
}
-func (in *OutboundWebhookSpec) DeepEqual(status *OutboundWebhookStatus) (bool, utils.Diff) {
- if status == nil {
- return false, utils.Diff{
- Name: "OutboundWebhookStatus",
- Desired: utils.PointerToString(in),
- Actual: nil,
- }
- }
-
- if in.Name != status.Name {
- return false, utils.Diff{
- Name: "OutboundWebhookStatus.Name",
- Desired: in.Name,
- Actual: status.Name,
- }
- }
-
- equal, diff := in.OutboundWebhookType.DeepEqual(status.OutboundWebhookType)
- if !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("OutboundWebhookStatus.OutboundWebhookType.%s", diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
-
- return true, utils.Diff{}
-}
-
func (in *OutboundWebhookSpec) ExtractOutgoingWebhookInputData() (*cxsdk.OutgoingWebhookInputData, error) {
webhookData := &cxsdk.OutgoingWebhookInputData{
Name: wrapperspb.String(in.Name),
diff --git a/apis/coralogix/v1alpha1/recordingrulegroupset_types.go b/apis/coralogix/v1alpha1/recordingrulegroupset_types.go
index e6f7713..d59dd94 100644
--- a/apis/coralogix/v1alpha1/recordingrulegroupset_types.go
+++ b/apis/coralogix/v1alpha1/recordingrulegroupset_types.go
@@ -36,28 +36,6 @@ type RecordingRuleGroupSetSpec struct {
Groups []RecordingRuleGroup `json:"groups"`
}
-func (in *RecordingRuleGroupSetSpec) DeepEqual(status RecordingRuleGroupSetStatus) (bool, utils.Diff) {
- if length, actualLength := len(in.Groups), len(status.Groups); length != actualLength {
- return false, utils.Diff{
- Name: "Groups.Length",
- Desired: length,
- Actual: actualLength,
- }
- }
-
- for i := range in.Groups {
- if equal, diff := in.Groups[i].DeepEqual(status.Groups[i]); !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("Groups.%d.%s", i, diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
- }
-
- return true, utils.Diff{}
-}
-
func (in *RecordingRuleGroupSetSpec) ExtractRecordingRuleGroups() []*cxsdk.InRuleGroup {
result := make([]*cxsdk.InRuleGroup, 0, len(in.Groups))
for _, ruleGroup := range in.Groups {
@@ -208,8 +186,6 @@ type RecordingRule struct {
// RecordingRuleGroupSetStatus defines the observed state of RecordingRuleGroupSet
type RecordingRuleGroupSetStatus struct {
ID *string `json:"id"`
-
- Groups []RecordingRuleGroup `json:"groups,omitempty"`
}
//+kubebuilder:object:root=true
diff --git a/apis/coralogix/v1alpha1/rulegroup_types.go b/apis/coralogix/v1alpha1/rulegroup_types.go
index 89c3dff..c8ab5c1 100644
--- a/apis/coralogix/v1alpha1/rulegroup_types.go
+++ b/apis/coralogix/v1alpha1/rulegroup_types.go
@@ -710,103 +710,6 @@ func (in *RuleGroupSpec) ToString() string {
return string(str)
}
-func (in *RuleGroupSpec) DeepEqual(actualRuleGroup RuleGroupStatus) (bool, utils.Diff) {
- if actualName := actualRuleGroup.Name; in.Name != actualName {
- return false, utils.Diff{
- Name: "Name",
- Desired: in.Name,
- Actual: actualName,
- }
- }
-
- if actualDescription := actualRuleGroup.Description; in.Description != actualDescription {
- return false, utils.Diff{
- Name: "Description",
- Desired: in.Description,
- Actual: actualDescription,
- }
- }
-
- if actualActive := actualRuleGroup.Active; in.Active != actualActive {
- return false, utils.Diff{
- Name: "Active",
- Desired: in.Active,
- Actual: actualActive,
- }
- }
-
- if actualHidden := actualRuleGroup.Hidden; in.Hidden != actualHidden {
- return false, utils.Diff{
- Name: "Hidden",
- Desired: in.Hidden,
- Actual: actualHidden,
- }
- }
-
- if actualCreator := actualRuleGroup.Creator; in.Creator != actualCreator {
- return false, utils.Diff{
- Name: "Creator",
- Desired: in.Creator,
- Actual: actualCreator,
- }
- }
-
- if in.Order == nil {
- in.Order = new(int32)
- *in.Order = *actualRuleGroup.Order
- } else if actualOrder := actualRuleGroup.Order; *in.Order != *actualOrder {
- return false, utils.Diff{
- Name: "Order",
- Desired: *in.Order,
- Actual: actualOrder,
- }
- }
-
- if !utils.SlicesWithUniqueValuesEqual(in.Applications, actualRuleGroup.Applications) {
- return false, utils.Diff{
- Name: "Applications",
- Desired: in.Applications,
- Actual: actualRuleGroup.Applications,
- }
- }
-
- if !utils.SlicesWithUniqueValuesEqual(in.Subsystems, actualRuleGroup.Subsystems) {
- return false, utils.Diff{
- Name: "Subsystems",
- Desired: in.Subsystems,
- Actual: actualRuleGroup.Subsystems,
- }
- }
-
- if !utils.SlicesWithUniqueValuesEqual(in.Severities, actualRuleGroup.Severities) {
- return false, utils.Diff{
- Name: "Severities",
- Desired: in.Severities,
- Actual: actualRuleGroup.Severities,
- }
- }
-
- if len(in.RuleSubgroups) != len(actualRuleGroup.RuleSubgroups) {
- return false, utils.Diff{
- Name: "RuleSubgroups length",
- Desired: len(in.RuleSubgroups),
- Actual: len(actualRuleGroup.RuleSubgroups),
- }
- }
-
- for i := range in.RuleSubgroups {
- if equal, diff := in.RuleSubgroups[i].DeepEqual(actualRuleGroup.RuleSubgroups[i]); !equal {
- return false, utils.Diff{
- Name: fmt.Sprintf("RuleSubgroups[%d].%s", i, diff.Name),
- Desired: diff.Desired,
- Actual: diff.Actual,
- }
- }
- }
-
- return true, utils.Diff{}
-}
-
func (in *RuleGroupSpec) ExtractUpdateRuleGroupRequest(id string) *cxsdk.UpdateRuleGroupRequest {
ruleGroup := in.ExtractCreateRuleGroupRequest()
return &cxsdk.UpdateRuleGroupRequest{
@@ -1051,26 +954,6 @@ type RuleGroupStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
ID *string `json:"id"`
-
- Name string `json:"name,omitempty"`
-
- Description string `json:"description,omitempty"`
-
- Active bool `json:"active,omitempty"`
-
- Applications []string `json:"applications,omitempty"`
-
- Subsystems []string `json:"subsystems,omitempty"`
-
- Severities []RuleSeverity `json:"severities,omitempty"`
-
- Hidden bool `json:"hidden,omitempty"`
-
- Creator string `json:"creator,omitempty"`
-
- Order *int32 `json:"order,omitempty"`
-
- RuleSubgroups []RuleSubGroup `json:"subgroups,omitempty"`
}
//+kubebuilder:object:root=true
diff --git a/apis/coralogix/v1alpha1/zz_generated.deepcopy.go b/apis/coralogix/v1alpha1/zz_generated.deepcopy.go
index 9c4bd2f..3405e81 100644
--- a/apis/coralogix/v1alpha1/zz_generated.deepcopy.go
+++ b/apis/coralogix/v1alpha1/zz_generated.deepcopy.go
@@ -141,41 +141,6 @@ func (in *AlertStatus) DeepCopyInto(out *AlertStatus) {
*out = new(string)
**out = **in
}
- if in.Labels != nil {
- in, out := &in.Labels, &out.Labels
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.ExpirationDate != nil {
- in, out := &in.ExpirationDate, &out.ExpirationDate
- *out = new(ExpirationDate)
- **out = **in
- }
- if in.ShowInInsight != nil {
- in, out := &in.ShowInInsight, &out.ShowInInsight
- *out = new(ShowInInsight)
- **out = **in
- }
- if in.NotificationGroups != nil {
- in, out := &in.NotificationGroups, &out.NotificationGroups
- *out = make([]NotificationGroup, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.PayloadFilters != nil {
- in, out := &in.PayloadFilters, &out.PayloadFilters
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Scheduling != nil {
- in, out := &in.Scheduling, &out.Scheduling
- *out = new(Scheduling)
- (*in).DeepCopyInto(*out)
- }
- in.AlertType.DeepCopyInto(&out.AlertType)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertStatus.
@@ -935,11 +900,6 @@ func (in *OutboundWebhookStatus) DeepCopyInto(out *OutboundWebhookStatus) {
*out = new(string)
**out = **in
}
- if in.OutboundWebhookType != nil {
- in, out := &in.OutboundWebhookType, &out.OutboundWebhookType
- *out = new(OutboundWebhookTypeStatus)
- (*in).DeepCopyInto(*out)
- }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OutboundWebhookStatus.
@@ -1017,71 +977,6 @@ func (in *OutboundWebhookType) DeepCopy() *OutboundWebhookType {
return out
}
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OutboundWebhookTypeStatus) DeepCopyInto(out *OutboundWebhookTypeStatus) {
- *out = *in
- if in.GenericWebhook != nil {
- in, out := &in.GenericWebhook, &out.GenericWebhook
- *out = new(GenericWebhookStatus)
- (*in).DeepCopyInto(*out)
- }
- if in.Slack != nil {
- in, out := &in.Slack, &out.Slack
- *out = new(Slack)
- (*in).DeepCopyInto(*out)
- }
- if in.PagerDuty != nil {
- in, out := &in.PagerDuty, &out.PagerDuty
- *out = new(PagerDuty)
- **out = **in
- }
- if in.SendLog != nil {
- in, out := &in.SendLog, &out.SendLog
- *out = new(SendLogStatus)
- **out = **in
- }
- if in.EmailGroup != nil {
- in, out := &in.EmailGroup, &out.EmailGroup
- *out = new(EmailGroup)
- (*in).DeepCopyInto(*out)
- }
- if in.MicrosoftTeams != nil {
- in, out := &in.MicrosoftTeams, &out.MicrosoftTeams
- *out = new(MicrosoftTeams)
- **out = **in
- }
- if in.Jira != nil {
- in, out := &in.Jira, &out.Jira
- *out = new(Jira)
- **out = **in
- }
- if in.Opsgenie != nil {
- in, out := &in.Opsgenie, &out.Opsgenie
- *out = new(Opsgenie)
- **out = **in
- }
- if in.Demisto != nil {
- in, out := &in.Demisto, &out.Demisto
- *out = new(Demisto)
- **out = **in
- }
- if in.AwsEventBridge != nil {
- in, out := &in.AwsEventBridge, &out.AwsEventBridge
- *out = new(AwsEventBridge)
- **out = **in
- }
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OutboundWebhookTypeStatus.
-func (in *OutboundWebhookTypeStatus) DeepCopy() *OutboundWebhookTypeStatus {
- if in == nil {
- return nil
- }
- out := new(OutboundWebhookTypeStatus)
- in.DeepCopyInto(out)
- return out
-}
-
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PagerDuty) DeepCopyInto(out *PagerDuty) {
*out = *in
@@ -1431,13 +1326,6 @@ func (in *RecordingRuleGroupSetStatus) DeepCopyInto(out *RecordingRuleGroupSetSt
*out = new(string)
**out = **in
}
- if in.Groups != nil {
- in, out := &in.Groups, &out.Groups
- *out = make([]RecordingRuleGroup, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecordingRuleGroupSetStatus.
@@ -1654,33 +1542,6 @@ func (in *RuleGroupStatus) DeepCopyInto(out *RuleGroupStatus) {
*out = new(string)
**out = **in
}
- if in.Applications != nil {
- in, out := &in.Applications, &out.Applications
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Subsystems != nil {
- in, out := &in.Subsystems, &out.Subsystems
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Severities != nil {
- in, out := &in.Severities, &out.Severities
- *out = make([]RuleSeverity, len(*in))
- copy(*out, *in)
- }
- if in.Order != nil {
- in, out := &in.Order, &out.Order
- *out = new(int32)
- **out = **in
- }
- if in.RuleSubgroups != nil {
- in, out := &in.RuleSubgroups, &out.RuleSubgroups
- *out = make([]RuleSubGroup, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleGroupStatus.
diff --git a/charts/coralogix-operator/templates/crds/coralogix.com_alerts.yaml b/charts/coralogix-operator/templates/crds/coralogix.com_alerts.yaml
index d693c86..b2aea4c 100644
--- a/charts/coralogix-operator/templates/crds/coralogix.com_alerts.yaml
+++ b/charts/coralogix-operator/templates/crds/coralogix.com_alerts.yaml
@@ -940,899 +940,8 @@ spec:
status:
description: AlertStatus defines the observed state of Alert
properties:
- active:
- type: boolean
- alertType:
- properties:
- flow:
- properties:
- stages:
- items:
- properties:
- groups:
- items:
- properties:
- innerFlowAlerts:
- properties:
- alerts:
- items:
- properties:
- not:
- default: false
- type: boolean
- userAlertId:
- type: string
- type: object
- type: array
- operator:
- enum:
- - And
- - Or
- type: string
- required:
- - alerts
- - operator
- type: object
- nextOperator:
- enum:
- - And
- - Or
- type: string
- required:
- - innerFlowAlerts
- - nextOperator
- type: object
- type: array
- timeWindow:
- properties:
- hours:
- type: integer
- minutes:
- type: integer
- seconds:
- type: integer
- type: object
- required:
- - groups
- type: object
- type: array
- required:
- - stages
- type: object
- metric:
- properties:
- lucene:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- arithmeticOperator:
- enum:
- - Avg
- - Min
- - Max
- - Sum
- - Count
- - Percentile
- type: string
- arithmeticOperatorModifier:
- type: integer
- groupBy:
- items:
- type: string
- type: array
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- metricField:
- type: string
- minNonNullValuesPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- replaceMissingValueWithZero:
- default: false
- type: boolean
- sampleThresholdPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- required:
- - alertWhen
- - arithmeticOperator
- - metricField
- - threshold
- - timeWindow
- type: object
- searchQuery:
- type: string
- required:
- - conditions
- type: object
- promql:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- - MoreThanUsual
- type: string
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- minNonNullValuesPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- replaceMissingValueWithZero:
- type: boolean
- sampleThresholdPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- required:
- - alertWhen
- - threshold
- - timeWindow
- type: object
- searchQuery:
- type: string
- required:
- - conditions
- type: object
- type: object
- newValue:
- properties:
- conditions:
- properties:
- key:
- type: string
- timeWindow:
- enum:
- - TwelveHours
- - TwentyFourHours
- - FortyEightHours
- - SeventTwoHours
- - Week
- - Month
- - TwoMonths
- - ThreeMonths
- type: string
- required:
- - key
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- ratio:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- groupBy:
- items:
- type: string
- type: array
- groupByFor:
- enum:
- - Q1
- - Q2
- - Both
- type: string
- ignoreInfinity:
- default: false
- type: boolean
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- ratio:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- - ratio
- - timeWindow
- type: object
- q1Filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- q2Filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- standard:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- - Immediately
- - MoreThanUsual
- type: string
- groupBy:
- items:
- type: string
- type: array
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- threshold:
- type: integer
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- timeRelative:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- groupBy:
- items:
- type: string
- type: array
- ignoreInfinity:
- default: false
- type: boolean
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - PreviousHour
- - SameHourYesterday
- - SameHourLastWeek
- - Yesterday
- - SameDayLastWeek
- - SameDayLastMonth
- type: string
- required:
- - alertWhen
- - threshold
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- tracing:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Immediately
- type: string
- groupBy:
- items:
- type: string
- type: array
- threshold:
- type: integer
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- type: object
- filters:
- properties:
- applications:
- items:
- type: string
- type: array
- latencyThresholdMilliseconds:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- services:
- items:
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- tagFilters:
- items:
- properties:
- field:
- type: string
- values:
- items:
- type: string
- type: array
- type: object
- type: array
- type: object
- required:
- - conditions
- type: object
- uniqueCount:
- properties:
- conditions:
- properties:
- groupBy:
- type: string
- key:
- type: string
- maxUniqueValues:
- minimum: 1
- type: integer
- maxUniqueValuesForGroupBy:
- minimum: 1
- type: integer
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - key
- - maxUniqueValues
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- type: object
- description:
- type: string
- expirationDate:
- properties:
- day:
- format: int32
- maximum: 31
- minimum: 1
- type: integer
- month:
- format: int32
- maximum: 12
- minimum: 1
- type: integer
- year:
- format: int32
- maximum: 9999
- minimum: 1
- type: integer
- type: object
id:
type: string
- labels:
- additionalProperties:
- type: string
- type: object
- name:
- type: string
- notificationGroups:
- items:
- properties:
- groupByFields:
- items:
- type: string
- type: array
- notifications:
- items:
- properties:
- emailRecipients:
- items:
- type: string
- type: array
- integrationName:
- type: string
- notifyOn:
- enum:
- - TriggeredOnly
- - TriggeredAndResolved
- type: string
- retriggeringPeriodMinutes:
- format: int32
- type: integer
- type: object
- type: array
- type: object
- type: array
- payloadFilters:
- items:
- type: string
- type: array
- scheduling:
- properties:
- daysEnabled:
- items:
- enum:
- - Sunday
- - Monday
- - Tuesday
- - Wednesday
- - Thursday
- - Friday
- - Saturday
- type: string
- type: array
- endTime:
- pattern: ^(0\d|1\d|2[0-3]):[0-5]\d$
- type: string
- startTime:
- pattern: ^(0\d|1\d|2[0-3]):[0-5]\d$
- type: string
- timeZone:
- default: UTC+00
- pattern: ^UTC[+-]\d{2}$
- type: string
- type: object
- severity:
- enum:
- - Info
- - Warning
- - Critical
- - Error
- type: string
- showInInsight:
- properties:
- notifyOn:
- default: TriggeredOnly
- enum:
- - TriggeredOnly
- - TriggeredAndResolved
- type: string
- retriggeringPeriodMinutes:
- format: int32
- minimum: 1
- type: integer
- type: object
required:
- id
type: object
diff --git a/charts/coralogix-operator/templates/crds/coralogix.com_outboundwebhooks.yaml b/charts/coralogix-operator/templates/crds/coralogix.com_outboundwebhooks.yaml
index af1f86a..22d944a 100644
--- a/charts/coralogix-operator/templates/crds/coralogix.com_outboundwebhooks.yaml
+++ b/charts/coralogix-operator/templates/crds/coralogix.com_outboundwebhooks.yaml
@@ -196,161 +196,8 @@ spec:
type: string
id:
type: string
- name:
- type: string
- outboundWebhookType:
- properties:
- awsEventBridge:
- properties:
- detail:
- type: string
- detailType:
- type: string
- eventBusArn:
- type: string
- roleName:
- type: string
- source:
- type: string
- required:
- - detail
- - detailType
- - eventBusArn
- - roleName
- - source
- type: object
- demisto:
- properties:
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - payload
- - url
- - uuid
- type: object
- emailGroup:
- properties:
- emailAddresses:
- items:
- type: string
- type: array
- required:
- - emailAddresses
- type: object
- genericWebhook:
- properties:
- headers:
- additionalProperties:
- type: string
- type: object
- method:
- enum:
- - Unkown
- - Get
- - Post
- - Put
- type: string
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - method
- - url
- - uuid
- type: object
- jira:
- properties:
- apiToken:
- type: string
- email:
- type: string
- projectKey:
- type: string
- url:
- type: string
- required:
- - apiToken
- - email
- - projectKey
- - url
- type: object
- microsoftTeams:
- properties:
- url:
- type: string
- required:
- - url
- type: object
- opsgenie:
- properties:
- url:
- type: string
- required:
- - url
- type: object
- pagerDuty:
- properties:
- serviceKey:
- type: string
- required:
- - serviceKey
- type: object
- sendLog:
- properties:
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - payload
- - url
- - uuid
- type: object
- slack:
- properties:
- attachments:
- items:
- properties:
- isActive:
- type: boolean
- type:
- type: string
- required:
- - isActive
- - type
- type: object
- type: array
- digests:
- items:
- properties:
- isActive:
- type: boolean
- type:
- type: string
- required:
- - isActive
- - type
- type: object
- type: array
- url:
- type: string
- required:
- - url
- type: object
- type: object
required:
- id
- - name
- - outboundWebhookType
type: object
type: object
served: true
diff --git a/charts/coralogix-operator/templates/crds/coralogix.com_recordingrulegroupsets.yaml b/charts/coralogix-operator/templates/crds/coralogix.com_recordingrulegroupsets.yaml
index 3311b0c..c68ab0b 100644
--- a/charts/coralogix-operator/templates/crds/coralogix.com_recordingrulegroupsets.yaml
+++ b/charts/coralogix-operator/templates/crds/coralogix.com_recordingrulegroupsets.yaml
@@ -78,36 +78,6 @@ spec:
description: RecordingRuleGroupSetStatus defines the observed state of
RecordingRuleGroupSet
properties:
- groups:
- items:
- properties:
- intervalSeconds:
- default: 60
- format: int32
- type: integer
- limit:
- format: int64
- type: integer
- name:
- description: |-
- INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
- Important: Run "make" to regenerate code after modifying this file
- type: string
- rules:
- items:
- properties:
- expr:
- type: string
- labels:
- additionalProperties:
- type: string
- type: object
- record:
- type: string
- type: object
- type: array
- type: object
- type: array
id:
type: string
required:
diff --git a/charts/coralogix-operator/templates/crds/coralogix.com_rulegroups.yaml b/charts/coralogix-operator/templates/crds/coralogix.com_rulegroups.yaml
index 33122cf..150e530 100644
--- a/charts/coralogix-operator/templates/crds/coralogix.com_rulegroups.yaml
+++ b/charts/coralogix-operator/templates/crds/coralogix.com_rulegroups.yaml
@@ -239,201 +239,11 @@ spec:
status:
description: RuleGroupStatus defines the observed state of RuleGroup
properties:
- active:
- type: boolean
- applications:
- items:
- type: string
- type: array
- creator:
- type: string
- description:
- type: string
- hidden:
- type: boolean
id:
description: |-
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Important: Run "make" to regenerate code after modifying this file
type: string
- name:
- type: string
- order:
- format: int32
- type: integer
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Error
- - Critical
- type: string
- type: array
- subgroups:
- items:
- properties:
- active:
- default: true
- type: boolean
- id:
- type: string
- order:
- format: int32
- type: integer
- rules:
- items:
- properties:
- active:
- default: true
- type: boolean
- block:
- properties:
- blockingAllMatchingBlocks:
- default: true
- type: boolean
- keepBlockedLogs:
- default: false
- type: boolean
- regex:
- type: string
- sourceField:
- type: string
- required:
- - regex
- - sourceField
- type: object
- description:
- type: string
- extract:
- properties:
- regex:
- type: string
- sourceField:
- type: string
- required:
- - regex
- - sourceField
- type: object
- extractTimestamp:
- properties:
- fieldFormatStandard:
- enum:
- - Strftime
- - JavaSDF
- - Golang
- - SecondTS
- - MilliTS
- - MicroTS
- - NanoTS
- type: string
- sourceField:
- type: string
- timeFormat:
- type: string
- required:
- - fieldFormatStandard
- - sourceField
- - timeFormat
- type: object
- jsonExtract:
- properties:
- destinationField:
- enum:
- - Category
- - CLASSNAME
- - METHODNAME
- - THREADID
- - SEVERITY
- type: string
- jsonKey:
- type: string
- required:
- - destinationField
- - jsonKey
- type: object
- jsonStringify:
- properties:
- destinationField:
- type: string
- keepSourceField:
- default: false
- type: boolean
- sourceField:
- type: string
- required:
- - destinationField
- - sourceField
- type: object
- name:
- minLength: 0
- type: string
- parse:
- properties:
- destinationField:
- type: string
- regex:
- type: string
- sourceField:
- type: string
- required:
- - destinationField
- - regex
- - sourceField
- type: object
- parseJsonField:
- properties:
- destinationField:
- type: string
- keepDestinationField:
- type: boolean
- keepSourceField:
- type: boolean
- sourceField:
- type: string
- required:
- - destinationField
- - keepDestinationField
- - keepSourceField
- - sourceField
- type: object
- removeFields:
- properties:
- excludedFields:
- items:
- type: string
- type: array
- required:
- - excludedFields
- type: object
- replace:
- properties:
- destinationField:
- type: string
- regex:
- type: string
- replacementString:
- type: string
- sourceField:
- type: string
- required:
- - destinationField
- - regex
- - replacementString
- - sourceField
- type: object
- required:
- - name
- type: object
- type: array
- type: object
- type: array
- subsystems:
- items:
- type: string
- type: array
required:
- id
type: object
diff --git a/config/crd/bases/coralogix.com_alerts.yaml b/config/crd/bases/coralogix.com_alerts.yaml
index d693c86..b2aea4c 100644
--- a/config/crd/bases/coralogix.com_alerts.yaml
+++ b/config/crd/bases/coralogix.com_alerts.yaml
@@ -940,899 +940,8 @@ spec:
status:
description: AlertStatus defines the observed state of Alert
properties:
- active:
- type: boolean
- alertType:
- properties:
- flow:
- properties:
- stages:
- items:
- properties:
- groups:
- items:
- properties:
- innerFlowAlerts:
- properties:
- alerts:
- items:
- properties:
- not:
- default: false
- type: boolean
- userAlertId:
- type: string
- type: object
- type: array
- operator:
- enum:
- - And
- - Or
- type: string
- required:
- - alerts
- - operator
- type: object
- nextOperator:
- enum:
- - And
- - Or
- type: string
- required:
- - innerFlowAlerts
- - nextOperator
- type: object
- type: array
- timeWindow:
- properties:
- hours:
- type: integer
- minutes:
- type: integer
- seconds:
- type: integer
- type: object
- required:
- - groups
- type: object
- type: array
- required:
- - stages
- type: object
- metric:
- properties:
- lucene:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- arithmeticOperator:
- enum:
- - Avg
- - Min
- - Max
- - Sum
- - Count
- - Percentile
- type: string
- arithmeticOperatorModifier:
- type: integer
- groupBy:
- items:
- type: string
- type: array
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- metricField:
- type: string
- minNonNullValuesPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- replaceMissingValueWithZero:
- default: false
- type: boolean
- sampleThresholdPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- required:
- - alertWhen
- - arithmeticOperator
- - metricField
- - threshold
- - timeWindow
- type: object
- searchQuery:
- type: string
- required:
- - conditions
- type: object
- promql:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- - MoreThanUsual
- type: string
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- minNonNullValuesPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- replaceMissingValueWithZero:
- type: boolean
- sampleThresholdPercentage:
- minimum: 0
- multipleOf: 10
- type: integer
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- required:
- - alertWhen
- - threshold
- - timeWindow
- type: object
- searchQuery:
- type: string
- required:
- - conditions
- type: object
- type: object
- newValue:
- properties:
- conditions:
- properties:
- key:
- type: string
- timeWindow:
- enum:
- - TwelveHours
- - TwentyFourHours
- - FortyEightHours
- - SeventTwoHours
- - Week
- - Month
- - TwoMonths
- - ThreeMonths
- type: string
- required:
- - key
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- ratio:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- groupBy:
- items:
- type: string
- type: array
- groupByFor:
- enum:
- - Q1
- - Q2
- - Both
- type: string
- ignoreInfinity:
- default: false
- type: boolean
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- ratio:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- - ratio
- - timeWindow
- type: object
- q1Filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- q2Filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- standard:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- - Immediately
- - MoreThanUsual
- type: string
- groupBy:
- items:
- type: string
- type: array
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- threshold:
- type: integer
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- timeRelative:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Less
- type: string
- groupBy:
- items:
- type: string
- type: array
- ignoreInfinity:
- default: false
- type: boolean
- manageUndetectedValues:
- properties:
- autoRetireRatio:
- default: Never
- enum:
- - Never
- - FiveMinutes
- - TenMinutes
- - Hour
- - TwoHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- type: string
- enableTriggeringOnUndetectedValues:
- default: true
- type: boolean
- type: object
- threshold:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- timeWindow:
- enum:
- - PreviousHour
- - SameHourYesterday
- - SameHourLastWeek
- - Yesterday
- - SameDayLastWeek
- - SameDayLastMonth
- type: string
- required:
- - alertWhen
- - threshold
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- tracing:
- properties:
- conditions:
- properties:
- alertWhen:
- enum:
- - More
- - Immediately
- type: string
- groupBy:
- items:
- type: string
- type: array
- threshold:
- type: integer
- timeWindow:
- enum:
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - alertWhen
- type: object
- filters:
- properties:
- applications:
- items:
- type: string
- type: array
- latencyThresholdMilliseconds:
- anyOf:
- - type: integer
- - type: string
- pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- services:
- items:
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- tagFilters:
- items:
- properties:
- field:
- type: string
- values:
- items:
- type: string
- type: array
- type: object
- type: array
- type: object
- required:
- - conditions
- type: object
- uniqueCount:
- properties:
- conditions:
- properties:
- groupBy:
- type: string
- key:
- type: string
- maxUniqueValues:
- minimum: 1
- type: integer
- maxUniqueValuesForGroupBy:
- minimum: 1
- type: integer
- timeWindow:
- enum:
- - Minute
- - FiveMinutes
- - TenMinutes
- - FifteenMinutes
- - TwentyMinutes
- - ThirtyMinutes
- - Hour
- - TwoHours
- - FourHours
- - SixHours
- - TwelveHours
- - TwentyFourHours
- - ThirtySixHours
- type: string
- required:
- - key
- - maxUniqueValues
- - timeWindow
- type: object
- filters:
- properties:
- alias:
- type: string
- applications:
- items:
- type: string
- type: array
- categories:
- items:
- type: string
- type: array
- classes:
- items:
- type: string
- type: array
- computers:
- items:
- type: string
- type: array
- ips:
- items:
- type: string
- type: array
- methods:
- items:
- type: string
- type: array
- searchQuery:
- type: string
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Critical
- - Error
- type: string
- type: array
- subsystems:
- items:
- type: string
- type: array
- type: object
- required:
- - conditions
- type: object
- type: object
- description:
- type: string
- expirationDate:
- properties:
- day:
- format: int32
- maximum: 31
- minimum: 1
- type: integer
- month:
- format: int32
- maximum: 12
- minimum: 1
- type: integer
- year:
- format: int32
- maximum: 9999
- minimum: 1
- type: integer
- type: object
id:
type: string
- labels:
- additionalProperties:
- type: string
- type: object
- name:
- type: string
- notificationGroups:
- items:
- properties:
- groupByFields:
- items:
- type: string
- type: array
- notifications:
- items:
- properties:
- emailRecipients:
- items:
- type: string
- type: array
- integrationName:
- type: string
- notifyOn:
- enum:
- - TriggeredOnly
- - TriggeredAndResolved
- type: string
- retriggeringPeriodMinutes:
- format: int32
- type: integer
- type: object
- type: array
- type: object
- type: array
- payloadFilters:
- items:
- type: string
- type: array
- scheduling:
- properties:
- daysEnabled:
- items:
- enum:
- - Sunday
- - Monday
- - Tuesday
- - Wednesday
- - Thursday
- - Friday
- - Saturday
- type: string
- type: array
- endTime:
- pattern: ^(0\d|1\d|2[0-3]):[0-5]\d$
- type: string
- startTime:
- pattern: ^(0\d|1\d|2[0-3]):[0-5]\d$
- type: string
- timeZone:
- default: UTC+00
- pattern: ^UTC[+-]\d{2}$
- type: string
- type: object
- severity:
- enum:
- - Info
- - Warning
- - Critical
- - Error
- type: string
- showInInsight:
- properties:
- notifyOn:
- default: TriggeredOnly
- enum:
- - TriggeredOnly
- - TriggeredAndResolved
- type: string
- retriggeringPeriodMinutes:
- format: int32
- minimum: 1
- type: integer
- type: object
required:
- id
type: object
diff --git a/config/crd/bases/coralogix.com_outboundwebhooks.yaml b/config/crd/bases/coralogix.com_outboundwebhooks.yaml
index af1f86a..22d944a 100644
--- a/config/crd/bases/coralogix.com_outboundwebhooks.yaml
+++ b/config/crd/bases/coralogix.com_outboundwebhooks.yaml
@@ -196,161 +196,8 @@ spec:
type: string
id:
type: string
- name:
- type: string
- outboundWebhookType:
- properties:
- awsEventBridge:
- properties:
- detail:
- type: string
- detailType:
- type: string
- eventBusArn:
- type: string
- roleName:
- type: string
- source:
- type: string
- required:
- - detail
- - detailType
- - eventBusArn
- - roleName
- - source
- type: object
- demisto:
- properties:
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - payload
- - url
- - uuid
- type: object
- emailGroup:
- properties:
- emailAddresses:
- items:
- type: string
- type: array
- required:
- - emailAddresses
- type: object
- genericWebhook:
- properties:
- headers:
- additionalProperties:
- type: string
- type: object
- method:
- enum:
- - Unkown
- - Get
- - Post
- - Put
- type: string
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - method
- - url
- - uuid
- type: object
- jira:
- properties:
- apiToken:
- type: string
- email:
- type: string
- projectKey:
- type: string
- url:
- type: string
- required:
- - apiToken
- - email
- - projectKey
- - url
- type: object
- microsoftTeams:
- properties:
- url:
- type: string
- required:
- - url
- type: object
- opsgenie:
- properties:
- url:
- type: string
- required:
- - url
- type: object
- pagerDuty:
- properties:
- serviceKey:
- type: string
- required:
- - serviceKey
- type: object
- sendLog:
- properties:
- payload:
- type: string
- url:
- type: string
- uuid:
- type: string
- required:
- - payload
- - url
- - uuid
- type: object
- slack:
- properties:
- attachments:
- items:
- properties:
- isActive:
- type: boolean
- type:
- type: string
- required:
- - isActive
- - type
- type: object
- type: array
- digests:
- items:
- properties:
- isActive:
- type: boolean
- type:
- type: string
- required:
- - isActive
- - type
- type: object
- type: array
- url:
- type: string
- required:
- - url
- type: object
- type: object
required:
- id
- - name
- - outboundWebhookType
type: object
type: object
served: true
diff --git a/config/crd/bases/coralogix.com_recordingrulegroupsets.yaml b/config/crd/bases/coralogix.com_recordingrulegroupsets.yaml
index 3311b0c..c68ab0b 100644
--- a/config/crd/bases/coralogix.com_recordingrulegroupsets.yaml
+++ b/config/crd/bases/coralogix.com_recordingrulegroupsets.yaml
@@ -78,36 +78,6 @@ spec:
description: RecordingRuleGroupSetStatus defines the observed state of
RecordingRuleGroupSet
properties:
- groups:
- items:
- properties:
- intervalSeconds:
- default: 60
- format: int32
- type: integer
- limit:
- format: int64
- type: integer
- name:
- description: |-
- INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
- Important: Run "make" to regenerate code after modifying this file
- type: string
- rules:
- items:
- properties:
- expr:
- type: string
- labels:
- additionalProperties:
- type: string
- type: object
- record:
- type: string
- type: object
- type: array
- type: object
- type: array
id:
type: string
required:
diff --git a/config/crd/bases/coralogix.com_rulegroups.yaml b/config/crd/bases/coralogix.com_rulegroups.yaml
index 33122cf..150e530 100644
--- a/config/crd/bases/coralogix.com_rulegroups.yaml
+++ b/config/crd/bases/coralogix.com_rulegroups.yaml
@@ -239,201 +239,11 @@ spec:
status:
description: RuleGroupStatus defines the observed state of RuleGroup
properties:
- active:
- type: boolean
- applications:
- items:
- type: string
- type: array
- creator:
- type: string
- description:
- type: string
- hidden:
- type: boolean
id:
description: |-
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Important: Run "make" to regenerate code after modifying this file
type: string
- name:
- type: string
- order:
- format: int32
- type: integer
- severities:
- items:
- enum:
- - Debug
- - Verbose
- - Info
- - Warning
- - Error
- - Critical
- type: string
- type: array
- subgroups:
- items:
- properties:
- active:
- default: true
- type: boolean
- id:
- type: string
- order:
- format: int32
- type: integer
- rules:
- items:
- properties:
- active:
- default: true
- type: boolean
- block:
- properties:
- blockingAllMatchingBlocks:
- default: true
- type: boolean
- keepBlockedLogs:
- default: false
- type: boolean
- regex:
- type: string
- sourceField:
- type: string
- required:
- - regex
- - sourceField
- type: object
- description:
- type: string
- extract:
- properties:
- regex:
- type: string
- sourceField:
- type: string
- required:
- - regex
- - sourceField
- type: object
- extractTimestamp:
- properties:
- fieldFormatStandard:
- enum:
- - Strftime
- - JavaSDF
- - Golang
- - SecondTS
- - MilliTS
- - MicroTS
- - NanoTS
- type: string
- sourceField:
- type: string
- timeFormat:
- type: string
- required:
- - fieldFormatStandard
- - sourceField
- - timeFormat
- type: object
- jsonExtract:
- properties:
- destinationField:
- enum:
- - Category
- - CLASSNAME
- - METHODNAME
- - THREADID
- - SEVERITY
- type: string
- jsonKey:
- type: string
- required:
- - destinationField
- - jsonKey
- type: object
- jsonStringify:
- properties:
- destinationField:
- type: string
- keepSourceField:
- default: false
- type: boolean
- sourceField:
- type: string
- required:
- - destinationField
- - sourceField
- type: object
- name:
- minLength: 0
- type: string
- parse:
- properties:
- destinationField:
- type: string
- regex:
- type: string
- sourceField:
- type: string
- required:
- - destinationField
- - regex
- - sourceField
- type: object
- parseJsonField:
- properties:
- destinationField:
- type: string
- keepDestinationField:
- type: boolean
- keepSourceField:
- type: boolean
- sourceField:
- type: string
- required:
- - destinationField
- - keepDestinationField
- - keepSourceField
- - sourceField
- type: object
- removeFields:
- properties:
- excludedFields:
- items:
- type: string
- type: array
- required:
- - excludedFields
- type: object
- replace:
- properties:
- destinationField:
- type: string
- regex:
- type: string
- replacementString:
- type: string
- sourceField:
- type: string
- required:
- - destinationField
- - regex
- - replacementString
- - sourceField
- type: object
- required:
- - name
- type: object
- type: array
- type: object
- type: array
- subsystems:
- items:
- type: string
- type: array
required:
- id
type: object
diff --git a/controllers/alphacontrollers/alert_controller.go b/controllers/alphacontrollers/alert_controller.go
index 2e8295f..e8bd4d0 100644
--- a/controllers/alphacontrollers/alert_controller.go
+++ b/controllers/alphacontrollers/alert_controller.go
@@ -20,8 +20,6 @@ import (
"context"
stdErr "errors"
"fmt"
- "time"
-
"github.com/go-logr/logr"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -36,8 +34,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/log"
- cxsdk "github.com/coralogix/coralogix-management-sdk/go"
-
utils "github.com/coralogix/coralogix-operator/apis"
coralogixv1alpha1 "github.com/coralogix/coralogix-operator/apis/coralogix/v1alpha1"
"github.com/coralogix/coralogix-operator/controllers/clientset"
@@ -45,16 +41,8 @@ import (
)
var (
- alertProtoSeverityToSchemaSeverity = utils.ReverseMap(coralogixv1alpha1.AlertSchemaSeverityToProtoSeverity)
- alertProtoDayToSchemaDay = utils.ReverseMap(coralogixv1alpha1.AlertSchemaDayToProtoDay)
- alertProtoTimeWindowToSchemaTimeWindow = utils.ReverseMap(coralogixv1alpha1.AlertSchemaTimeWindowToProtoTimeWindow)
- alertProtoAutoRetireRatioToSchemaAutoRetireRatio = utils.ReverseMap(coralogixv1alpha1.AlertSchemaAutoRetireRatioToProtoAutoRetireRatio)
- alertProtoFiltersLogSeverityToSchemaFiltersLogSeverity = utils.ReverseMap(coralogixv1alpha1.AlertSchemaFiltersLogSeverityToProtoFiltersLogSeverity)
- alertProtoRelativeTimeFrameToSchemaTimeFrameAndRelativeTimeFrame = utils.ReverseMap(coralogixv1alpha1.AlertSchemaRelativeTimeFrameToProtoTimeFrameAndRelativeTimeFrame)
- alertProtoArithmeticOperatorToSchemaArithmeticOperator = utils.ReverseMap(coralogixv1alpha1.AlertSchemaArithmeticOperatorToProtoArithmeticOperator)
- alertProtoNotifyOn = utils.ReverseMap(coralogixv1alpha1.AlertSchemaNotifyOnToProtoNotifyOn)
- alertProtoFlowOperatorToProtoFlowOperator = utils.ReverseMap(coralogixv1alpha1.AlertSchemaFlowOperatorToProtoFlowOperator)
- alertFinalizerName = "alert.coralogix.com/finalizer"
+ alertProtoSeverityToSchemaSeverity = utils.ReverseMap(coralogixv1alpha1.AlertSchemaSeverityToProtoSeverity)
+ alertFinalizerName = "alert.coralogix.com/finalizer"
)
// AlertReconciler reconciles a Alert object
@@ -244,818 +232,9 @@ func getStatus(ctx context.Context, log logr.Logger, actualAlert *alerts.Alert,
status.ID = utils.WrapperspbStringToStringPointer(actualAlert.GetUniqueIdentifier())
- status.Name = actualAlert.GetName().GetValue()
-
- status.Description = actualAlert.GetDescription().GetValue()
-
- status.Active = actualAlert.GetIsActive().GetValue()
-
- status.Severity = alertProtoSeverityToSchemaSeverity[actualAlert.GetSeverity()]
-
- status.Labels = flattenMetaLabels(actualAlert.GetMetaLabels())
-
- status.ExpirationDate = flattenExpirationDate(actualAlert.GetExpiration())
-
- var timeZone coralogixv1alpha1.TimeZone
- if spec.Scheduling != nil {
- timeZone = spec.Scheduling.TimeZone
- }
-
- status.Scheduling = flattenScheduling(actualAlert.GetActiveWhen(), timeZone)
-
- status.AlertType = flattenAlertType(actualAlert)
-
- if notificationGroups, flattenErr := flattenNotificationGroups(ctx, log, actualAlert.GetNotificationGroups()); flattenErr != nil {
- err = stdErr.Join(err, fmt.Errorf("error on flatten alert - %w", flattenErr))
- } else {
- status.NotificationGroups = notificationGroups
- }
-
- status.ShowInInsight = flattenShowInInsight(actualAlert.GetShowInInsight())
-
- status.PayloadFilters = utils.WrappedStringSliceToStringSlice(actualAlert.GetNotificationPayloadFilters())
-
return status, err
}
-func flattenAlertType(actualAlert *alerts.Alert) coralogixv1alpha1.AlertType {
- actualFilters := actualAlert.GetFilters()
- actualCondition := actualAlert.GetCondition()
-
- var alertType coralogixv1alpha1.AlertType
- switch actualFilters.GetFilterType() {
- case alerts.AlertFilters_FILTER_TYPE_TEXT_OR_UNSPECIFIED:
- if newValueCondition, ok := actualCondition.GetCondition().(*alerts.AlertCondition_NewValue); ok {
- alertType.NewValue = flattenNewValueAlert(actualFilters, newValueCondition)
- } else {
- alertType.Standard = flattenStandardAlert(actualFilters, actualCondition)
- }
- case alerts.AlertFilters_FILTER_TYPE_RATIO:
- alertType.Ratio = flattenRatioAlert(actualFilters, actualCondition)
- case alerts.AlertFilters_FILTER_TYPE_UNIQUE_COUNT:
- alertType.UniqueCount = flattenUniqueCountAlert(actualFilters, actualCondition)
- case alerts.AlertFilters_FILTER_TYPE_TIME_RELATIVE:
- alertType.TimeRelative = flattenTimeRelativeAlert(actualFilters, actualCondition)
- case alerts.AlertFilters_FILTER_TYPE_METRIC:
- alertType.Metric = flattenMetricAlert(actualFilters, actualCondition)
- case alerts.AlertFilters_FILTER_TYPE_TRACING:
- alertType.Tracing = flattenTracingAlert(actualAlert.GetTracingAlert(), actualCondition)
- case alerts.AlertFilters_FILTER_TYPE_FLOW:
- alertType.Flow = flattenFlowAlert(actualCondition.GetFlow())
- }
-
- return alertType
-}
-
-func flattenNewValueAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition_NewValue) *coralogixv1alpha1.NewValue {
- flattenedFilters := flattenFilters(filters)
- newValueCondition := flattenNewValueCondition(condition.NewValue.GetParameters())
-
- newValue := &coralogixv1alpha1.NewValue{
- Filters: flattenedFilters,
- Conditions: newValueCondition,
- }
-
- return newValue
-}
-
-func flattenFilters(filters *alerts.AlertFilters) *coralogixv1alpha1.Filters {
- if filters == nil {
- return nil
- }
-
- var flattenedFilters = &coralogixv1alpha1.Filters{}
-
- flattenedFilters.SearchQuery = utils.WrapperspbStringToStringPointer(filters.GetText())
-
- flattenedFilters.Alias = utils.WrapperspbStringToStringPointer(filters.GetAlias())
-
- flattenedFilters.Severities = flattenSeverities(filters.GetSeverities())
-
- if metaData := filters.Metadata; metaData != nil {
- flattenedFilters.Subsystems = utils.WrappedStringSliceToStringSlice(metaData.Subsystems)
- flattenedFilters.Categories = utils.WrappedStringSliceToStringSlice(metaData.Categories)
- flattenedFilters.Applications = utils.WrappedStringSliceToStringSlice(metaData.Applications)
- flattenedFilters.Computers = utils.WrappedStringSliceToStringSlice(metaData.Computers)
- flattenedFilters.Classes = utils.WrappedStringSliceToStringSlice(metaData.Classes)
- flattenedFilters.Methods = utils.WrappedStringSliceToStringSlice(metaData.Methods)
- flattenedFilters.IPs = utils.WrappedStringSliceToStringSlice(metaData.IpAddresses)
- }
-
- return flattenedFilters
-}
-
-func flattenSeverities(severities []alerts.AlertFilters_LogSeverity) []coralogixv1alpha1.FiltersLogSeverity {
- flattenedSeverities := make([]coralogixv1alpha1.FiltersLogSeverity, 0, len(severities))
- for _, severity := range severities {
- sev := alertProtoFiltersLogSeverityToSchemaFiltersLogSeverity[severity]
- flattenedSeverities = append(flattenedSeverities, sev)
- }
- return flattenedSeverities
-}
-
-func flattenNewValueCondition(conditionParams *alerts.ConditionParameters) coralogixv1alpha1.NewValueConditions {
- var key string
- if actualKeys := conditionParams.GetGroupBy(); len(actualKeys) != 0 {
- key = actualKeys[0].GetValue()
- }
- timeWindow := coralogixv1alpha1.NewValueTimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
-
- newValueCondition := coralogixv1alpha1.NewValueConditions{
- Key: key,
- TimeWindow: timeWindow,
- }
-
- return newValueCondition
-}
-
-func flattenStandardAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition) *coralogixv1alpha1.Standard {
- flattenedFilters := flattenFilters(filters)
- standardCondition := flattenStandardCondition(condition)
-
- standard := &coralogixv1alpha1.Standard{
- Filters: flattenedFilters,
- Conditions: standardCondition,
- }
-
- return standard
-}
-
-func flattenStandardCondition(condition *alerts.AlertCondition) coralogixv1alpha1.StandardConditions {
- var standardCondition coralogixv1alpha1.StandardConditions
- var conditionParams *alerts.ConditionParameters
-
- switch condition := condition.GetCondition().(type) {
- case *alerts.AlertCondition_LessThan:
- conditionParams = condition.LessThan.GetParameters()
- standardCondition.AlertWhen = coralogixv1alpha1.StandardAlertWhenLessThan
- standardCondition.Threshold = new(int)
- standardCondition.TimeWindow = new(coralogixv1alpha1.TimeWindow)
- *standardCondition.Threshold = int(conditionParams.GetThreshold().GetValue())
- *standardCondition.TimeWindow = coralogixv1alpha1.TimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
-
- if actualManageUndetectedValues := conditionParams.GetRelatedExtendedData(); actualManageUndetectedValues != nil {
- actualShouldTriggerDeadman, actualCleanupDeadmanDuration := actualManageUndetectedValues.GetShouldTriggerDeadman().GetValue(), actualManageUndetectedValues.GetCleanupDeadmanDuration()
- autoRetireRatio := alertProtoAutoRetireRatioToSchemaAutoRetireRatio[actualCleanupDeadmanDuration]
- standardCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: actualShouldTriggerDeadman,
- AutoRetireRatio: &autoRetireRatio,
- }
- } else {
- autoRetireRatio := coralogixv1alpha1.AutoRetireRatioNever
- standardCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: false,
- AutoRetireRatio: &autoRetireRatio,
- }
- }
- case *alerts.AlertCondition_MoreThan:
- conditionParams = condition.MoreThan.GetParameters()
- standardCondition.AlertWhen = coralogixv1alpha1.StandardAlertWhenMoreThan
- standardCondition.Threshold = new(int)
- standardCondition.TimeWindow = new(coralogixv1alpha1.TimeWindow)
- *standardCondition.Threshold = int(conditionParams.GetThreshold().GetValue())
- *standardCondition.TimeWindow = coralogixv1alpha1.TimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
- case *alerts.AlertCondition_MoreThanUsual:
- conditionParams = condition.MoreThanUsual.GetParameters()
- standardCondition.AlertWhen = coralogixv1alpha1.StandardAlertWhenMoreThanUsual
- standardCondition.Threshold = new(int)
- *standardCondition.Threshold = int(conditionParams.GetThreshold().GetValue())
- case *alerts.AlertCondition_Immediate:
- standardCondition.AlertWhen = coralogixv1alpha1.StandardAlertWhenImmediately
- return standardCondition
- }
-
- standardCondition.GroupBy = utils.WrappedStringSliceToStringSlice(conditionParams.GetGroupBy())
-
- return standardCondition
-}
-
-func flattenRatioAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition) *coralogixv1alpha1.Ratio {
- query1Filters := flattenFilters(filters)
- q2Filters := filters.GetRatioAlerts()[0]
- query2Filters := flattenRatioFilters(q2Filters)
- ratioCondition := flattenRatioCondition(condition, q2Filters.GetGroupBy())
-
- ratio := &coralogixv1alpha1.Ratio{
- Query1Filters: *query1Filters,
- Query2Filters: query2Filters,
- Conditions: ratioCondition,
- }
-
- return ratio
-}
-
-func flattenRatioFilters(filters *alerts.AlertFilters_RatioAlert) coralogixv1alpha1.RatioQ2Filters {
- var flattenedFilters coralogixv1alpha1.RatioQ2Filters
- if filters == nil {
- return flattenedFilters
- }
-
- flattenedFilters.SearchQuery = utils.WrapperspbStringToStringPointer(filters.GetText())
-
- flattenedFilters.Alias = utils.WrapperspbStringToStringPointer(filters.GetAlias())
-
- flattenedFilters.Severities = flattenSeverities(filters.GetSeverities())
- flattenedFilters.Subsystems = utils.WrappedStringSliceToStringSlice(filters.GetSubsystems())
- flattenedFilters.Applications = utils.WrappedStringSliceToStringSlice(filters.GetApplications())
-
- return flattenedFilters
-}
-
-func flattenRatioCondition(condition *alerts.AlertCondition, groupByQ2 []*wrapperspb.StringValue) coralogixv1alpha1.RatioConditions {
- var ratioCondition coralogixv1alpha1.RatioConditions
- var conditionParams *alerts.ConditionParameters
-
- switch condition := condition.GetCondition().(type) {
- case *alerts.AlertCondition_LessThan:
- conditionParams = condition.LessThan.GetParameters()
- ratioCondition.AlertWhen = coralogixv1alpha1.AlertWhenLessThan
-
- if actualManageUndetectedValues := conditionParams.GetRelatedExtendedData(); actualManageUndetectedValues != nil {
- actualShouldTriggerDeadman, actualCleanupDeadmanDuration := actualManageUndetectedValues.GetShouldTriggerDeadman().GetValue(), actualManageUndetectedValues.GetCleanupDeadmanDuration()
- autoRetireRatio := alertProtoAutoRetireRatioToSchemaAutoRetireRatio[actualCleanupDeadmanDuration]
- ratioCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: actualShouldTriggerDeadman,
- AutoRetireRatio: &autoRetireRatio,
- }
- } else {
- autoRetireRatio := coralogixv1alpha1.AutoRetireRatioNever
- ratioCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: false,
- AutoRetireRatio: &autoRetireRatio,
- }
- }
- case *alerts.AlertCondition_MoreThan:
- conditionParams = condition.MoreThan.GetParameters()
- ratioCondition.AlertWhen = coralogixv1alpha1.AlertWhenMoreThan
- }
-
- ratioCondition.Ratio = utils.FloatToQuantity(conditionParams.GetThreshold().GetValue())
- ratioCondition.TimeWindow = coralogixv1alpha1.TimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
-
- if groupByQ1 := conditionParams.GetGroupBy(); len(groupByQ1) > 0 && len(groupByQ2) == 0 {
- ratioCondition.GroupBy = utils.WrappedStringSliceToStringSlice(groupByQ1)
- ratioCondition.GroupByFor = new(coralogixv1alpha1.GroupByFor)
- *ratioCondition.GroupByFor = coralogixv1alpha1.GroupByForQ1
- } else if len(groupByQ2) > 0 && len(groupByQ1) == 0 {
- ratioCondition.GroupBy = utils.WrappedStringSliceToStringSlice(groupByQ2)
- ratioCondition.GroupByFor = new(coralogixv1alpha1.GroupByFor)
- *ratioCondition.GroupByFor = coralogixv1alpha1.GroupByForQ2
- } else if len(groupByQ1) > 0 && len(groupByQ2) > 0 {
- ratioCondition.GroupBy = utils.WrappedStringSliceToStringSlice(groupByQ2)
- ratioCondition.GroupByFor = new(coralogixv1alpha1.GroupByFor)
- *ratioCondition.GroupByFor = coralogixv1alpha1.GroupByForBoth
- }
-
- return ratioCondition
-}
-
-func flattenUniqueCountAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition) *coralogixv1alpha1.UniqueCount {
- flattenedFilters := flattenFilters(filters)
- uniqueCountCondition := flattenUniqueCountCondition(condition)
-
- ratio := &coralogixv1alpha1.UniqueCount{
- Filters: flattenedFilters,
- Conditions: uniqueCountCondition,
- }
-
- return ratio
-}
-
-func flattenUniqueCountCondition(condition *alerts.AlertCondition) coralogixv1alpha1.UniqueCountConditions {
- conditionParams := condition.GetCondition().(*alerts.AlertCondition_UniqueCount).UniqueCount.GetParameters()
- var uniqueCountCondition coralogixv1alpha1.UniqueCountConditions
-
- uniqueCountCondition.Key = conditionParams.GetCardinalityFields()[0].GetValue()
- uniqueCountCondition.MaxUniqueValues = int(conditionParams.GetThreshold().GetValue())
- uniqueCountCondition.TimeWindow = coralogixv1alpha1.UniqueValueTimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
- if actualGroupBy := conditionParams.GetGroupBy(); len(actualGroupBy) > 0 {
- uniqueCountCondition.GroupBy = new(string)
- *uniqueCountCondition.GroupBy = actualGroupBy[0].GetValue()
-
- uniqueCountCondition.MaxUniqueValuesForGroupBy = new(int)
- *uniqueCountCondition.MaxUniqueValuesForGroupBy = int(conditionParams.GetMaxUniqueCountValuesForGroupByKey().GetValue())
- }
-
- return uniqueCountCondition
-}
-
-func flattenTimeRelativeAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition) *coralogixv1alpha1.TimeRelative {
- flattenedFilters := flattenFilters(filters)
- timeRelativeCondition := flattenTimeRelativeCondition(condition)
-
- timeRelative := &coralogixv1alpha1.TimeRelative{
- Filters: flattenedFilters,
- Conditions: timeRelativeCondition,
- }
-
- return timeRelative
-}
-
-func flattenTimeRelativeCondition(condition *alerts.AlertCondition) coralogixv1alpha1.TimeRelativeConditions {
- var conditionParams *alerts.ConditionParameters
- var timeRelativeCondition coralogixv1alpha1.TimeRelativeConditions
-
- switch condition := condition.GetCondition().(type) {
- case *alerts.AlertCondition_LessThan:
- conditionParams = condition.LessThan.GetParameters()
- timeRelativeCondition.AlertWhen = coralogixv1alpha1.AlertWhenLessThan
-
- if actualManageUndetectedValues := conditionParams.GetRelatedExtendedData(); actualManageUndetectedValues != nil {
- actualShouldTriggerDeadman, actualCleanupDeadmanDuration := actualManageUndetectedValues.GetShouldTriggerDeadman().GetValue(), actualManageUndetectedValues.GetCleanupDeadmanDuration()
- autoRetireRatio := alertProtoAutoRetireRatioToSchemaAutoRetireRatio[actualCleanupDeadmanDuration]
- timeRelativeCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: actualShouldTriggerDeadman,
- AutoRetireRatio: &autoRetireRatio,
- }
- } else {
- autoRetireRatio := coralogixv1alpha1.AutoRetireRatioNever
- timeRelativeCondition.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: false,
- AutoRetireRatio: &autoRetireRatio,
- }
- }
- case *alerts.AlertCondition_MoreThan:
- conditionParams = condition.MoreThan.GetParameters()
- timeRelativeCondition.AlertWhen = coralogixv1alpha1.AlertWhenMoreThan
- }
-
- timeRelativeCondition.Threshold = utils.FloatToQuantity(conditionParams.GetThreshold().GetValue())
- relativeTimeFrame := coralogixv1alpha1.ProtoTimeFrameAndRelativeTimeFrame{TimeFrame: conditionParams.GetTimeframe(), RelativeTimeFrame: conditionParams.GetRelativeTimeframe()}
- timeRelativeCondition.TimeWindow = alertProtoRelativeTimeFrameToSchemaTimeFrameAndRelativeTimeFrame[relativeTimeFrame]
- timeRelativeCondition.IgnoreInfinity = conditionParams.GetIgnoreInfinity().GetValue()
- timeRelativeCondition.GroupBy = utils.WrappedStringSliceToStringSlice(conditionParams.GetGroupBy())
-
- return timeRelativeCondition
-}
-
-func flattenMetricAlert(filters *alerts.AlertFilters, condition *alerts.AlertCondition) *coralogixv1alpha1.Metric {
- metric := new(coralogixv1alpha1.Metric)
-
- var conditionParams *alerts.ConditionParameters
- var promqlAlertWhen coralogixv1alpha1.PromqlAlertWhen
- var luceneAlertWhen coralogixv1alpha1.AlertWhen
- switch condition := condition.GetCondition().(type) {
- case *alerts.AlertCondition_LessThan:
- promqlAlertWhen = coralogixv1alpha1.PromqlAlertWhenLessThan
- luceneAlertWhen = coralogixv1alpha1.AlertWhenLessThan
- conditionParams = condition.LessThan.GetParameters()
- case *alerts.AlertCondition_MoreThan:
- conditionParams = condition.MoreThan.GetParameters()
- promqlAlertWhen = coralogixv1alpha1.PromqlAlertWhenMoreThan
- luceneAlertWhen = coralogixv1alpha1.AlertWhenMoreThan
- case *alerts.AlertCondition_MoreThanUsual:
- conditionParams = condition.MoreThanUsual.GetParameters()
- promqlAlertWhen = coralogixv1alpha1.PromqlAlertWhenMoreThanUsual
- }
-
- if promqlParams := conditionParams.GetMetricAlertPromqlParameters(); promqlParams != nil {
- metric.Promql = flattenPromqlAlert(conditionParams, promqlParams, promqlAlertWhen)
- } else {
- metric.Lucene = flattenLuceneAlert(conditionParams, filters.GetText(), luceneAlertWhen)
- }
-
- return metric
-}
-
-func flattenPromqlAlert(conditionParams *alerts.ConditionParameters, promqlParams *alerts.MetricAlertPromqlConditionParameters, alertWhen coralogixv1alpha1.PromqlAlertWhen) *coralogixv1alpha1.Promql {
- promql := new(coralogixv1alpha1.Promql)
-
- promql.SearchQuery = promqlParams.GetPromqlText().GetValue()
- promql.Conditions = coralogixv1alpha1.PromqlConditions{
- AlertWhen: alertWhen,
- Threshold: utils.FloatToQuantity(conditionParams.GetThreshold().GetValue()),
- SampleThresholdPercentage: int(promqlParams.GetSampleThresholdPercentage().GetValue()),
- TimeWindow: coralogixv1alpha1.MetricTimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()]),
- ReplaceMissingValueWithZero: promqlParams.GetSwapNullValues().GetValue(),
- }
-
- if minNonNullValuesPercentage := promqlParams.GetNonNullPercentage(); minNonNullValuesPercentage != nil {
- promql.Conditions.MinNonNullValuesPercentage = new(int)
- *promql.Conditions.MinNonNullValuesPercentage = int(minNonNullValuesPercentage.GetValue())
- }
-
- if alertWhen == coralogixv1alpha1.PromqlAlertWhenLessThan {
- if actualManageUndetectedValues := conditionParams.GetRelatedExtendedData(); actualManageUndetectedValues != nil {
- actualShouldTriggerDeadman, actualCleanupDeadmanDuration := actualManageUndetectedValues.GetShouldTriggerDeadman().GetValue(), actualManageUndetectedValues.GetCleanupDeadmanDuration()
- autoRetireRatio := alertProtoAutoRetireRatioToSchemaAutoRetireRatio[actualCleanupDeadmanDuration]
- promql.Conditions.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: actualShouldTriggerDeadman,
- AutoRetireRatio: &autoRetireRatio,
- }
- } else {
- autoRetireRatio := coralogixv1alpha1.AutoRetireRatioNever
- promql.Conditions.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: false,
- AutoRetireRatio: &autoRetireRatio,
- }
- }
- }
-
- return promql
-}
-
-func flattenLuceneAlert(conditionParams *alerts.ConditionParameters, searchQuery *wrapperspb.StringValue, alertWhen coralogixv1alpha1.AlertWhen) *coralogixv1alpha1.Lucene {
- lucene := new(coralogixv1alpha1.Lucene)
- metricParams := conditionParams.GetMetricAlertParameters()
-
- if searchQuery != nil {
- lucene.SearchQuery = new(string)
- *lucene.SearchQuery = searchQuery.GetValue()
- }
-
- lucene.Conditions = coralogixv1alpha1.LuceneConditions{
- MetricField: metricParams.GetMetricField().GetValue(),
- ArithmeticOperator: alertProtoArithmeticOperatorToSchemaArithmeticOperator[metricParams.GetArithmeticOperator()],
- AlertWhen: alertWhen,
- Threshold: utils.FloatToQuantity(conditionParams.GetThreshold().GetValue()),
- SampleThresholdPercentage: int(metricParams.GetSampleThresholdPercentage().GetValue()),
- TimeWindow: coralogixv1alpha1.MetricTimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()]),
- GroupBy: utils.WrappedStringSliceToStringSlice(conditionParams.GetGroupBy()),
- ReplaceMissingValueWithZero: metricParams.GetSwapNullValues().GetValue(),
- MinNonNullValuesPercentage: int(metricParams.GetNonNullPercentage().GetValue()),
- }
-
- if arithmeticOperatorModifier := metricParams.GetArithmeticOperatorModifier(); arithmeticOperatorModifier != nil {
- lucene.Conditions.ArithmeticOperatorModifier = new(int)
- *lucene.Conditions.ArithmeticOperatorModifier = int(arithmeticOperatorModifier.GetValue())
- }
-
- if alertWhen == coralogixv1alpha1.AlertWhenLessThan {
- if actualManageUndetectedValues := conditionParams.GetRelatedExtendedData(); actualManageUndetectedValues != nil {
- actualShouldTriggerDeadman, actualCleanupDeadmanDuration := actualManageUndetectedValues.GetShouldTriggerDeadman().GetValue(), actualManageUndetectedValues.GetCleanupDeadmanDuration()
- autoRetireRatio := alertProtoAutoRetireRatioToSchemaAutoRetireRatio[actualCleanupDeadmanDuration]
- lucene.Conditions.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: actualShouldTriggerDeadman,
- AutoRetireRatio: &autoRetireRatio,
- }
- } else {
- autoRetireRatio := coralogixv1alpha1.AutoRetireRatioNever
- lucene.Conditions.ManageUndetectedValues = &coralogixv1alpha1.ManageUndetectedValues{
- EnableTriggeringOnUndetectedValues: false,
- AutoRetireRatio: &autoRetireRatio,
- }
- }
- }
-
- return lucene
-}
-
-func flattenTracingAlert(tracingAlert *alerts.TracingAlert, condition *alerts.AlertCondition) *coralogixv1alpha1.Tracing {
- latencyThresholdMS := float64(tracingAlert.GetConditionLatency()) / float64(time.Millisecond.Microseconds())
- tracingFilters := flattenTracingAlertFilters(tracingAlert)
- tracingFilters.LatencyThresholdMilliseconds = utils.FloatToQuantity(latencyThresholdMS)
-
- tracingCondition := flattenTracingCondition(condition)
-
- return &coralogixv1alpha1.Tracing{
- Filters: tracingFilters,
- Conditions: tracingCondition,
- }
-}
-
-func flattenTracingCondition(condition *alerts.AlertCondition) coralogixv1alpha1.TracingCondition {
- var tracingCondition coralogixv1alpha1.TracingCondition
- switch condition := condition.GetCondition().(type) {
- case *alerts.AlertCondition_Immediate:
- tracingCondition.AlertWhen = coralogixv1alpha1.TracingAlertWhenImmediately
- case *alerts.AlertCondition_MoreThan:
- conditionParams := condition.MoreThan.GetParameters()
- tracingCondition.AlertWhen = coralogixv1alpha1.TracingAlertWhenMore
-
- tracingCondition.Threshold = new(int)
- *tracingCondition.Threshold = int(conditionParams.GetThreshold().GetValue())
-
- tracingCondition.TimeWindow = new(coralogixv1alpha1.TimeWindow)
- *tracingCondition.TimeWindow = coralogixv1alpha1.TimeWindow(alertProtoTimeWindowToSchemaTimeWindow[conditionParams.GetTimeframe()])
-
- tracingCondition.GroupBy = utils.WrappedStringSliceToStringSlice(conditionParams.GetGroupBy())
- }
-
- return tracingCondition
-}
-
-func flattenTracingAlertFilters(tracingAlert *alerts.TracingAlert) coralogixv1alpha1.TracingFilters {
- applications, subsystems, services := flattenTracingFilters(tracingAlert.GetFieldFilters())
- tagFilters := flattenTagFiltersData(tracingAlert.GetTagFilters())
-
- return coralogixv1alpha1.TracingFilters{
- TagFilters: tagFilters,
- Applications: applications,
- Subsystems: subsystems,
- Services: services,
- }
-}
-
-func flattenTracingFilters(tracingFilters []*alerts.FilterData) (applications, subsystems, services []string) {
- filtersData := flattenFiltersData(tracingFilters)
- applications = filtersData["applicationName"]
- subsystems = filtersData["subsystemName"]
- services = filtersData["serviceName"]
- return
-}
-
-func flattenTagFiltersData(filtersData []*alerts.FilterData) []coralogixv1alpha1.TagFilter {
- fieldToFilters := flattenFiltersData(filtersData)
- result := make([]coralogixv1alpha1.TagFilter, 0, len(fieldToFilters))
- for field, filters := range fieldToFilters {
- filterSchema := coralogixv1alpha1.TagFilter{
- Field: field,
- Values: filters,
- }
- result = append(result, filterSchema)
- }
- return result
-}
-
-func flattenFiltersData(filtersData []*alerts.FilterData) map[string][]string {
- result := make(map[string][]string, len(filtersData))
- for _, filter := range filtersData {
- field := filter.GetField()
- result[field] = flattenTracingFilter(filter.GetFilters())
- }
- return result
-}
-
-func flattenTracingFilter(filters []*alerts.Filters) []string {
- result := make([]string, 0)
- for _, f := range filters {
- values := f.GetValues()
- switch operator := f.GetOperator(); operator {
- case "notEquals", "contains", "startsWith", "endsWith":
- for i, val := range values {
- values[i] = fmt.Sprintf("filter:%s:%s", operator, val)
- }
- }
- result = append(result, values...)
- }
- return result
-}
-
-func flattenFlowAlert(flow *alerts.FlowCondition) *coralogixv1alpha1.Flow {
- stages := flattenFlowStages(flow.Stages)
- return &coralogixv1alpha1.Flow{
- Stages: stages,
- }
-}
-
-func flattenFlowStages(stages []*alerts.FlowStage) []coralogixv1alpha1.FlowStage {
- result := make([]coralogixv1alpha1.FlowStage, 0, len(stages))
- for _, s := range stages {
- stage := flattenFlowStage(s)
- result = append(result, stage)
- }
- return result
-}
-
-func flattenFlowStage(stage *alerts.FlowStage) coralogixv1alpha1.FlowStage {
- groups := flattenFlowStageGroups(stage.Groups)
-
- var timeFrame *coralogixv1alpha1.FlowStageTimeFrame
- if timeWindow := stage.GetTimeframe(); timeWindow != nil {
- timeFrame = convertMillisecondToTime(int(timeWindow.GetMs().GetValue()))
- }
-
- return coralogixv1alpha1.FlowStage{
- Groups: groups,
- TimeWindow: timeFrame,
- }
-}
-
-func convertMillisecondToTime(timeMS int) *coralogixv1alpha1.FlowStageTimeFrame {
- if timeMS == 0 {
- return nil
- }
-
- msInHour := int(time.Hour.Milliseconds())
- msInMinute := int(time.Minute.Milliseconds())
- msInSecond := int(time.Second.Milliseconds())
-
- hours := timeMS / msInHour
- timeMS -= hours * msInHour
-
- minutes := timeMS / msInMinute
- timeMS -= minutes * msInMinute
-
- seconds := timeMS / msInSecond
-
- return &coralogixv1alpha1.FlowStageTimeFrame{
- Hours: hours,
- Minutes: minutes,
- Seconds: seconds,
- }
-}
-
-func flattenFlowStageGroups(groups []*alerts.FlowGroup) []coralogixv1alpha1.FlowStageGroup {
- result := make([]coralogixv1alpha1.FlowStageGroup, 0, len(groups))
- for _, g := range groups {
- group := flattenFlowStageGroup(g)
- result = append(result, group)
- }
- return result
-}
-
-func flattenFlowStageGroup(group *alerts.FlowGroup) coralogixv1alpha1.FlowStageGroup {
- subAlerts := expandFlowSubgroupAlerts(group.GetAlerts())
- nextOp := alertProtoFlowOperatorToProtoFlowOperator[group.GetNextOp()]
- return coralogixv1alpha1.FlowStageGroup{
- InnerFlowAlerts: subAlerts,
- NextOperator: nextOp,
- }
-}
-
-func expandFlowSubgroupAlerts(subgroup *alerts.FlowAlerts) coralogixv1alpha1.InnerFlowAlerts {
- return coralogixv1alpha1.InnerFlowAlerts{
- Operator: alertProtoFlowOperatorToProtoFlowOperator[subgroup.GetOp()],
- Alerts: expandFlowInnerAlerts(subgroup.GetValues()),
- }
-}
-
-func expandFlowInnerAlerts(innerAlerts []*alerts.FlowAlert) []coralogixv1alpha1.InnerFlowAlert {
- result := make([]coralogixv1alpha1.InnerFlowAlert, 0, len(innerAlerts))
- for _, a := range innerAlerts {
- alert := expandFlowInnerAlert(a)
- result = append(result, alert)
- }
- return result
-}
-
-func expandFlowInnerAlert(alert *alerts.FlowAlert) coralogixv1alpha1.InnerFlowAlert {
- return coralogixv1alpha1.InnerFlowAlert{
- UserAlertId: alert.GetId().GetValue(),
- Not: alert.GetNot().GetValue(),
- }
-}
-
-func flattenMetaLabels(labels []*alerts.MetaLabel) map[string]string {
- if len(labels) == 0 {
- return nil
- }
-
- result := make(map[string]string)
- for _, label := range labels {
- result[label.GetKey().GetValue()] = label.GetValue().GetValue()
- }
- return result
-}
-
-func flattenExpirationDate(expirationDate *alerts.Date) *coralogixv1alpha1.ExpirationDate {
- if expirationDate == nil {
- return nil
- }
-
- return &coralogixv1alpha1.ExpirationDate{
- Day: expirationDate.Day,
- Month: expirationDate.Month,
- Year: expirationDate.Year,
- }
-}
-
-func flattenScheduling(scheduling *alerts.AlertActiveWhen, timeZone coralogixv1alpha1.TimeZone) *coralogixv1alpha1.Scheduling {
- if scheduling == nil || len(scheduling.GetTimeframes()) == 0 {
- return nil
- }
-
- utc := coralogixv1alpha1.ExtractUTC(timeZone)
- timeframe := scheduling.GetTimeframes()[0]
- timeRange := timeframe.GetRange()
- activityStartGMT, activityEndGMT := timeRange.GetStart(), timeRange.GetEnd()
- daysOffset := getDaysOffsetFromGMT(activityStartGMT, utc)
- daysEnabled := flattenDaysOfWeek(timeframe.GetDaysOfWeek(), daysOffset)
- activityStartUTC := flattenTimeInDay(activityStartGMT, utc)
- activityEndUTC := flattenTimeInDay(activityEndGMT, utc)
-
- return &coralogixv1alpha1.Scheduling{
- TimeZone: timeZone,
- DaysEnabled: daysEnabled,
- StartTime: activityStartUTC,
- EndTime: activityEndUTC,
- }
-}
-
-func getDaysOffsetFromGMT(activityStartGMT *alerts.Time, utc int32) int32 {
- daysOffset := int32(activityStartGMT.GetHours()+utc) / 24
- if daysOffset < 0 {
- daysOffset += 7
- }
-
- return daysOffset
-}
-
-func flattenTimeInDay(time *alerts.Time, utc int32) *coralogixv1alpha1.Time {
- hours := convertGmtToUtc(time.GetHours(), utc)
- hoursStr := toTwoDigitsFormat(hours)
- minStr := toTwoDigitsFormat(time.GetMinutes())
- result := coralogixv1alpha1.Time(fmt.Sprintf("%s:%s", hoursStr, minStr))
- return &result
-}
-
-func convertGmtToUtc(hours, utc int32) int32 {
- hours += utc
- if hours < 0 {
- hours += 24
- } else if hours >= 24 {
- hours -= 24
- }
-
- return hours
-}
-
-func toTwoDigitsFormat(digit int32) string {
- digitStr := fmt.Sprintf("%d", digit)
- if len(digitStr) == 1 {
- digitStr = "0" + digitStr
- }
- return digitStr
-}
-
-func flattenDaysOfWeek(daysOfWeek []alerts.DayOfWeek, daysOffset int32) []coralogixv1alpha1.Day {
- result := make([]coralogixv1alpha1.Day, 0, len(daysOfWeek))
- for _, d := range daysOfWeek {
- dayConvertedFromGmtToUtc := alerts.DayOfWeek((int32(d) + daysOffset) % 7)
- day := alertProtoDayToSchemaDay[dayConvertedFromGmtToUtc]
- result = append(result, day)
- }
- return result
-}
-
-func flattenNotificationGroups(ctx context.Context, log logr.Logger, notificationGroups []*alerts.AlertNotificationGroups) ([]coralogixv1alpha1.NotificationGroup, error) {
- result := make([]coralogixv1alpha1.NotificationGroup, 0, len(notificationGroups))
- webhooksIdsToNames, err := getWebhooksIdsToNames(ctx, log)
- if err != nil {
- return nil, fmt.Errorf("error on get webhooks ids to names - %w", err)
- }
-
- for _, ng := range notificationGroups {
- notificationGroup := flattenNotificationGroup(ng, webhooksIdsToNames)
- result = append(result, *notificationGroup)
- }
-
- return result, err
-}
-
-func getWebhooksIdsToNames(ctx context.Context, log logr.Logger) (map[uint32]string, error) {
- log.V(1).Info("get all webhooks")
- webhooks, err := coralogixv1alpha1.WebhooksClient.List(ctx, &cxsdk.ListAllOutgoingWebhooksRequest{})
- if err != nil {
- return nil, fmt.Errorf("error on get all webhooks - %w", err)
- }
- webhooksIdsToNames := make(map[uint32]string)
- for _, webhook := range webhooks.Deployed {
- webhooksIdsToNames[webhook.GetExternalId().GetValue()] = webhook.GetName().GetValue()
- }
- return webhooksIdsToNames, nil
-}
-
-func flattenNotificationGroup(notificationGroup *alerts.AlertNotificationGroups, webhooksIdsToNames map[uint32]string) *coralogixv1alpha1.NotificationGroup {
- return &coralogixv1alpha1.NotificationGroup{
- GroupByFields: utils.WrappedStringSliceToStringSlice(notificationGroup.GroupByFields),
- Notifications: flattenNotifications(notificationGroup.Notifications, webhooksIdsToNames),
- }
-}
-
-func flattenNotifications(notifications []*alerts.AlertNotification, webhooksIdsToNames map[uint32]string) []coralogixv1alpha1.Notification {
- result := make([]coralogixv1alpha1.Notification, 0, len(notifications))
- for _, notification := range notifications {
- flattenedNotification := flattenNotification(notification, webhooksIdsToNames)
- result = append(result, flattenedNotification)
- }
- return result
-}
-
-func flattenNotification(notification *alerts.AlertNotification, webhooksIdsToNames map[uint32]string) coralogixv1alpha1.Notification {
- notifyOn := alertProtoNotifyOn[notification.GetNotifyOn()]
- retriggeringPeriodMinutes := int32(notification.GetRetriggeringPeriodSeconds().GetValue()) / 60
- flattenedNotification := coralogixv1alpha1.Notification{
- NotifyOn: notifyOn,
- RetriggeringPeriodMinutes: retriggeringPeriodMinutes,
- }
-
- switch integration := notification.GetIntegrationType().(type) {
- case *alerts.AlertNotification_IntegrationId:
- webhookName, _ := webhooksIdsToNames[integration.IntegrationId.GetValue()]
- flattenedNotification.IntegrationName = pointer.String(webhookName)
- case *alerts.AlertNotification_Recipients:
- flattenedNotification.EmailRecipients = utils.WrappedStringSliceToStringSlice(integration.Recipients.Emails)
- }
-
- return flattenedNotification
-}
-
-func flattenShowInInsight(showInInsight *alerts.ShowInInsight) *coralogixv1alpha1.ShowInInsight {
- if showInInsight == nil {
- return nil
- }
-
- retriggeringPeriodMinutes := int32(showInInsight.GetRetriggeringPeriodSeconds().GetValue()) / 60
- notifyOn := alertProtoNotifyOn[showInInsight.GetNotifyOn()]
-
- return &coralogixv1alpha1.ShowInInsight{
- RetriggeringPeriodMinutes: retriggeringPeriodMinutes,
- NotifyOn: notifyOn,
- }
-}
-
// SetupWithManager sets up the controller with the Manager.
func (r *AlertReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
diff --git a/controllers/alphacontrollers/alert_controller_test.go b/controllers/alphacontrollers/alert_controller_test.go
index aaed4a5..a36c1ff 100644
--- a/controllers/alphacontrollers/alert_controller_test.go
+++ b/controllers/alphacontrollers/alert_controller_test.go
@@ -336,11 +336,7 @@ func TestAlertUpdate(t *testing.T) {
AlertType: defaultAlertType,
},
Status: coralogixv1alpha1.AlertStatus{
- ID: pointer.String("AlertUpdateSuccess"),
- Name: "AlertUpdateSuccess",
- Description: "AlertUpdateSuccess",
- Active: true,
- Severity: "Critical",
+ ID: pointer.String("AlertUpdateSuccess"),
},
},
remoteAlert: &alerts.Alert{
@@ -404,11 +400,7 @@ func TestAlertUpdate(t *testing.T) {
AlertType: defaultAlertType,
},
Status: coralogixv1alpha1.AlertStatus{
- ID: pointer.String("AlertUpdateCleanStatus"),
- Name: "AlertUpdateCleanStatus",
- Description: "AlertUpdateCleanStatus",
- Active: true,
- Severity: "Critical",
+ ID: pointer.String("AlertUpdateCleanStatus"),
},
},
remoteAlert: &alerts.Alert{
@@ -618,11 +610,7 @@ func TestAlertDelete(t *testing.T) {
AlertType: defaultAlertType,
},
Status: coralogixv1alpha1.AlertStatus{
- ID: pointer.String("AlertDeleteSuccess"),
- Name: "AlertDeleteSuccess",
- Description: "AlertDeleteSuccess",
- Active: true,
- Severity: "Critical",
+ ID: pointer.String("AlertDeleteSuccess"),
},
},
remoteAlert: &alerts.Alert{
@@ -793,28 +781,7 @@ func TestFlattenAlerts(t *testing.T) {
assert.NoError(t, err)
expected := &coralogixv1alpha1.AlertStatus{
- ID: pointer.String("id1"),
- Name: "name",
- Description: "description",
- Active: true,
- Severity: "Critical",
- Labels: map[string]string{"key": "value"},
- AlertType: coralogixv1alpha1.AlertType{
- Metric: &coralogixv1alpha1.Metric{
- Promql: &coralogixv1alpha1.Promql{
- SearchQuery: "http_requests_total{status!~\"4..\"}",
- Conditions: coralogixv1alpha1.PromqlConditions{
- AlertWhen: "MoreThanUsual",
- Threshold: utils.FloatToQuantity(3.0),
- TimeWindow: coralogixv1alpha1.MetricTimeWindow("TwelveHours"),
- MinNonNullValuesPercentage: pointer.Int(10),
- ReplaceMissingValueWithZero: false,
- },
- },
- },
- },
- NotificationGroups: []coralogixv1alpha1.NotificationGroup{},
- PayloadFilters: []string{},
+ ID: pointer.String("id1"),
}
assert.EqualValues(t, expected, &status)
diff --git a/controllers/alphacontrollers/outboundwebhook_controller.go b/controllers/alphacontrollers/outboundwebhook_controller.go
index 44905b3..d7fc607 100644
--- a/controllers/alphacontrollers/outboundwebhook_controller.go
+++ b/controllers/alphacontrollers/outboundwebhook_controller.go
@@ -127,9 +127,7 @@ func (r *OutboundWebhookReconciler) create(ctx context.Context, log logr.Logger,
log.V(int(zapcore.DebugLevel)).Info(fmt.Sprintf("outbound-webhook was created- %s", protojson.Format(createResponse)))
webhook.Status = coralogixv1alpha1.OutboundWebhookStatus{
- ID: ptr.To(createResponse.Id.GetValue()),
- Name: webhook.Name,
- OutboundWebhookType: &coralogixv1alpha1.OutboundWebhookTypeStatus{},
+ ID: ptr.To(createResponse.Id.GetValue()),
}
if err = r.Status().Update(ctx, webhook); err != nil {
return fmt.Errorf("error to update outbound-webhook status -\n%v", webhook)
@@ -168,194 +166,14 @@ func getOutboundWebhookStatus(webhook *cxsdk.OutgoingWebhook) (*coralogixv1alpha
return nil, fmt.Errorf("outbound-webhook is nil")
}
- outboundWebhookType, err := getOutboundWebhookTypeStatus(webhook)
- if err != nil {
- return nil, err
- }
-
status := &coralogixv1alpha1.OutboundWebhookStatus{
- ID: ptr.To(webhook.Id.GetValue()),
- ExternalID: ptr.To(strconv.Itoa(int(webhook.ExternalId.GetValue()))),
- Name: webhook.Name.GetValue(),
- OutboundWebhookType: outboundWebhookType,
+ ID: ptr.To(webhook.Id.GetValue()),
+ ExternalID: ptr.To(strconv.Itoa(int(webhook.ExternalId.GetValue()))),
}
return status, nil
}
-func getOutboundWebhookTypeStatus(webhook *cxsdk.OutgoingWebhook) (*coralogixv1alpha1.OutboundWebhookTypeStatus, error) {
- if webhook == nil {
- return nil, fmt.Errorf("outbound-webhook is nil")
- }
-
- outboundWebhooks := &coralogixv1alpha1.OutboundWebhookTypeStatus{}
- switch webhookType := webhook.Config.(type) {
- case *cxsdk.GenericWebhook:
- outboundWebhooks.GenericWebhook = getOutboundWebhookGenericTypeStatus(webhookType.GenericWebhook, webhook.Url)
- case *cxsdk.SlackWebhook:
- outboundWebhooks.Slack = getOutgoingWebhookSlackStatus(webhookType.Slack, webhook.Url)
- case *cxsdk.PagerDutyWebhook:
- outboundWebhooks.PagerDuty = getOutgoingWebhookPagerDutyStatus(webhookType.PagerDuty)
- case *cxsdk.SendLogWebhook:
- outboundWebhooks.SendLog = getOutgoingWebhookSendLogStatus(webhookType.SendLog, webhook.Url)
- case *cxsdk.EmailGroupWebhook:
- outboundWebhooks.EmailGroup = getOutgoingWebhookEmailGroupStatus(webhookType.EmailGroup)
- case *cxsdk.MicrosoftTeamsWebhook:
- outboundWebhooks.MicrosoftTeams = getOutgoingWebhookMicrosoftTeamsStatus(webhookType.MicrosoftTeams, webhook.Url)
- case *cxsdk.JiraWebhook:
- outboundWebhooks.Jira = getOutboundWebhookJiraStatus(webhookType.Jira, webhook.Url)
- case *cxsdk.OpsgenieWebhook:
- outboundWebhooks.Opsgenie = getOutboundWebhookOpsgenieStatus(webhookType.Opsgenie, webhook.Url)
- case *cxsdk.DemistoWebhook:
- outboundWebhooks.Demisto = getOutboundWebhookDemistoStatus(webhookType.Demisto, webhook.Url)
- case *cxsdk.AwsEventBridgeWebhook:
- outboundWebhooks.AwsEventBridge = getOutboundWebhookAwsEventBridgeStatus(webhookType.AwsEventBridge)
- default:
- return nil, fmt.Errorf("unsupported outbound-webhook type %T", webhookType)
- }
-
- return outboundWebhooks, nil
-}
-
-func getOutboundWebhookAwsEventBridgeStatus(awsEventBridge *cxsdk.AwsEventBridgeConfig) *coralogixv1alpha1.AwsEventBridge {
- if awsEventBridge == nil {
- return nil
- }
-
- return &coralogixv1alpha1.AwsEventBridge{
- EventBusArn: awsEventBridge.EventBusArn.GetValue(),
- Detail: awsEventBridge.Detail.GetValue(),
- DetailType: awsEventBridge.DetailType.GetValue(),
- Source: awsEventBridge.Source.GetValue(),
- RoleName: awsEventBridge.RoleName.GetValue(),
- }
-}
-
-func getOutboundWebhookGenericTypeStatus(generic *cxsdk.GenericWebhookConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.GenericWebhookStatus {
- if generic == nil {
- return nil
- }
-
- return &coralogixv1alpha1.GenericWebhookStatus{
- Uuid: generic.Uuid.GetValue(),
- Url: url.GetValue(),
- Method: coralogixv1alpha1.GenericWebhookMethodTypeFromProto[generic.Method],
- Headers: generic.Headers,
- Payload: utils.WrapperspbStringToStringPointer(generic.Payload),
- }
-}
-
-func getOutgoingWebhookSlackStatus(slack *cxsdk.SlackConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.Slack {
- if slack == nil {
- return nil
- }
-
- return &coralogixv1alpha1.Slack{
- Url: url.GetValue(),
- Digests: flattenSlackDigests(slack.Digests),
- Attachments: flattenSlackConfigAttachments(slack.Attachments),
- }
-}
-
-func getOutgoingWebhookPagerDutyStatus(pagerDuty *cxsdk.PagerDutyConfig) *coralogixv1alpha1.PagerDuty {
- if pagerDuty == nil {
- return nil
- }
-
- return &coralogixv1alpha1.PagerDuty{
- ServiceKey: pagerDuty.ServiceKey.GetValue(),
- }
-}
-
-func getOutgoingWebhookMicrosoftTeamsStatus(teams *cxsdk.MicrosoftTeamsConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.MicrosoftTeams {
- if teams == nil {
- return nil
- }
-
- return &coralogixv1alpha1.MicrosoftTeams{
- Url: url.GetValue(),
- }
-}
-
-func getOutboundWebhookJiraStatus(jira *cxsdk.JiraConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.Jira {
- if jira == nil {
- return nil
- }
-
- return &coralogixv1alpha1.Jira{
- ApiToken: jira.ApiToken.GetValue(),
- Email: jira.Email.GetValue(),
- ProjectKey: jira.ProjectKey.GetValue(),
- Url: url.GetValue(),
- }
-}
-
-func getOutboundWebhookOpsgenieStatus(opsgenie *cxsdk.OpsgenieConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.Opsgenie {
- if opsgenie == nil {
- return nil
- }
-
- return &coralogixv1alpha1.Opsgenie{
- Url: url.GetValue(),
- }
-}
-
-func getOutboundWebhookDemistoStatus(demisto *cxsdk.DemistoConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.Demisto {
- if demisto == nil {
- return nil
- }
-
- return &coralogixv1alpha1.Demisto{
- Uuid: demisto.Uuid.GetValue(),
- Payload: demisto.Payload.GetValue(),
- Url: url.GetValue(),
- }
-}
-
-func flattenSlackDigests(digests []*cxsdk.SlackConfigDigest) []coralogixv1alpha1.SlackConfigDigest {
- flattenedSlackDigests := make([]coralogixv1alpha1.SlackConfigDigest, 0, len(digests))
- for _, digest := range digests {
- flattenedSlackDigests = append(flattenedSlackDigests, coralogixv1alpha1.SlackConfigDigest{
- Type: coralogixv1alpha1.SlackConfigDigestTypeFromProto[digest.Type],
- IsActive: digest.IsActive.GetValue(),
- })
- }
- return flattenedSlackDigests
-}
-
-func flattenSlackConfigAttachments(attachments []*cxsdk.SlackConfigAttachment) []coralogixv1alpha1.SlackConfigAttachment {
- flattenedSlackConfigAttachments := make([]coralogixv1alpha1.SlackConfigAttachment, 0, len(attachments))
- for _, attachment := range attachments {
- flattenedSlackConfigAttachments = append(flattenedSlackConfigAttachments, coralogixv1alpha1.SlackConfigAttachment{
- Type: coralogixv1alpha1.SlackConfigAttachmentTypeFromProto[attachment.Type],
- IsActive: attachment.IsActive.GetValue(),
- })
- }
- return flattenedSlackConfigAttachments
-}
-
-func getOutgoingWebhookSendLogStatus(sendLog *cxsdk.SendLogConfig, url *wrapperspb.StringValue) *coralogixv1alpha1.SendLogStatus {
- if sendLog == nil {
- return nil
- }
-
- return &coralogixv1alpha1.SendLogStatus{
- Payload: sendLog.Payload.GetValue(),
- Uuid: sendLog.Payload.GetValue(),
- Url: url.GetValue(),
- }
-}
-
-func getOutgoingWebhookEmailGroupStatus(group *cxsdk.EmailGroupConfig) *coralogixv1alpha1.EmailGroup {
- if group == nil {
- return nil
- }
-
- return &coralogixv1alpha1.EmailGroup{
- EmailAddresses: utils.WrappedStringSliceToStringSlice(group.EmailAddresses),
- }
-}
-
func (r *OutboundWebhookReconciler) update(ctx context.Context, log logr.Logger, webhook *coralogixv1alpha1.OutboundWebhook) error {
updateReq, err := webhook.ExtractUpdateOutboundWebhookRequest()
if err != nil {
diff --git a/controllers/alphacontrollers/rulegroup_controller.go b/controllers/alphacontrollers/rulegroup_controller.go
index 8289305..ab247e9 100644
--- a/controllers/alphacontrollers/rulegroup_controller.go
+++ b/controllers/alphacontrollers/rulegroup_controller.go
@@ -18,7 +18,6 @@ package alphacontrollers
import (
"context"
- "fmt"
cxsdk "github.com/coralogix/coralogix-management-sdk/go"
"github.com/coralogix/coralogix-operator/controllers/clientset"
@@ -129,16 +128,15 @@ func (r *RuleGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}
var (
- notFound bool
- err error
- actualState *coralogixv1alpha1.RuleGroupStatus
+ notFound bool
+ err error
)
if id := ruleGroupCRD.Status.ID; id == nil {
log.V(1).Info("ruleGroup wasn't created")
notFound = true
} else {
- getRuleGroupResp, err := rulesGroupsClient.Get(ctx, &cxsdk.GetRuleGroupRequest{GroupId: *id})
+ _, err := rulesGroupsClient.Get(ctx, &cxsdk.GetRuleGroupRequest{GroupId: *id})
switch {
case status.Code(err) == codes.NotFound:
log.V(1).Info("ruleGroup doesn't exist in Coralogix backend")
@@ -146,12 +144,6 @@ func (r *RuleGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
case err != nil:
log.Error(err, "Received an error while getting RuleGroup")
return ctrl.Result{RequeueAfter: defaultErrRequeuePeriod}, err
- case err == nil:
- actualState, err = flattenRuleGroup(getRuleGroupResp.GetRuleGroup())
- if err != nil {
- log.Error(err, "Error mapping coralogix API response", "Name", ruleGroupCRD.Name, "Namespace", ruleGroupCRD.Namespace)
- return ctrl.Result{RequeueAfter: defaultErrRequeuePeriod}, err
- }
}
}
@@ -190,17 +182,15 @@ func (r *RuleGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
return ctrl.Result{RequeueAfter: defaultErrRequeuePeriod}, err
}
- if equal, diff := ruleGroupCRD.Spec.DeepEqual(*actualState); !equal {
- log.V(1).Info("Find diffs between spec and the actual state", "Diff", diff)
- updateRuleGroupReq := ruleGroupCRD.Spec.ExtractUpdateRuleGroupRequest(*ruleGroupCRD.Status.ID)
- updateRuleGroupResp, err := rulesGroupsClient.Update(ctx, updateRuleGroupReq)
- if err != nil {
- log.Error(err, "Received an error while updating a Rule-Group", "ruleGroup", updateRuleGroupReq)
- return ctrl.Result{RequeueAfter: defaultErrRequeuePeriod}, err
- }
- jstr, _ := jsm.MarshalToString(updateRuleGroupResp)
- log.V(1).Info("Rule-Group was updated", "ruleGroup", jstr)
+ log.V(1).Info("Updating Rule-Group", "ruleGroup")
+ updateRuleGroupReq := ruleGroupCRD.Spec.ExtractUpdateRuleGroupRequest(*ruleGroupCRD.Status.ID)
+ updateRuleGroupResp, err := rulesGroupsClient.Update(ctx, updateRuleGroupReq)
+ if err != nil {
+ log.Error(err, "Received an error while updating a Rule-Group", "ruleGroup", updateRuleGroupReq)
+ return ctrl.Result{RequeueAfter: defaultErrRequeuePeriod}, err
}
+ jstr, _ := jsm.MarshalToString(updateRuleGroupResp)
+ log.V(1).Info("Rule-Group was updated", "ruleGroup", jstr)
return ctrl.Result{}, nil
}
@@ -211,177 +201,9 @@ func flattenRuleGroup(ruleGroup *cxsdk.RuleGroup) (*coralogixv1alpha1.RuleGroupS
status.ID = new(string)
*status.ID = ruleGroup.GetId().GetValue()
- status.Name = ruleGroup.GetName().GetValue()
-
- status.Active = ruleGroup.GetEnabled().GetValue()
-
- var err error
- status.Applications, status.Subsystems, status.Severities, err = flattenRuleMatcher(ruleGroup.GetRuleMatchers())
- if err != nil {
- return nil, fmt.Errorf("flattenRuleGroup name: %s: %w", ruleGroup.GetName().GetValue(), err)
- }
-
- status.Description = ruleGroup.Description.GetValue()
-
- status.Order = new(int32)
- *status.Order = int32(ruleGroup.GetOrder().GetValue())
-
- status.Creator = ruleGroup.GetCreator().GetValue()
-
- status.Hidden = ruleGroup.GetHidden().GetValue()
-
- subGroups, err := flattenRuleSubGroups(ruleGroup.GetRuleSubgroups())
- if err != nil {
- return nil, fmt.Errorf("flattenRuleGroup name: %s: %w", ruleGroup.GetName().GetValue(), err)
- }
- status.RuleSubgroups = subGroups
return &status, nil
}
-func flattenRuleSubGroups(subgroups []*cxsdk.RuleSubgroup) ([]coralogixv1alpha1.RuleSubGroup, error) {
- result := make([]coralogixv1alpha1.RuleSubGroup, 0, len(subgroups))
- for _, sg := range subgroups {
- subgroup, err := flattenRuleSubGroup(sg)
- if err != nil {
- return nil, fmt.Errorf("flattenRuleSubGroups subGroupId: %s: %w", sg.GetId().GetValue(), err)
- }
- result = append(result, subgroup)
- }
- return result, nil
-}
-
-func flattenRuleSubGroup(subGroup *cxsdk.RuleSubgroup) (coralogixv1alpha1.RuleSubGroup, error) {
- var result coralogixv1alpha1.RuleSubGroup
-
- result.ID = new(string)
- *result.ID = subGroup.Id.GetValue()
-
- result.Active = subGroup.GetEnabled().GetValue()
-
- result.Order = new(int32)
- *result.Order = int32(subGroup.GetOrder().GetValue())
-
- rules, err := flattenRules(subGroup.Rules)
- if err != nil {
- return coralogixv1alpha1.RuleSubGroup{}, fmt.Errorf("flattenRuleSubGroup: %w", err)
- }
- result.Rules = rules
- return result, nil
-}
-
-func flattenRules(rules []*cxsdk.Rule) ([]coralogixv1alpha1.Rule, error) {
- result := make([]coralogixv1alpha1.Rule, 0, len(rules))
- for _, r := range rules {
- rule, err := flattenRule(r)
- if err != nil {
- return nil, fmt.Errorf("flattenRules: %w", err)
- }
- result = append(result, rule)
- }
- return result, nil
-}
-
-func flattenRule(rule *cxsdk.Rule) (coralogixv1alpha1.Rule, error) {
- var result coralogixv1alpha1.Rule
- result.Name = rule.GetName().GetValue()
- result.Active = rule.GetEnabled().GetValue()
- result.Description = rule.GetDescription().GetValue()
-
- switch ruleParams := rule.GetParameters().GetRuleParameters().(type) {
- case *cxsdk.RuleParametersExtractParameters:
- extractParameters := ruleParams.ExtractParameters
- result.Extract = &coralogixv1alpha1.Extract{
- Regex: extractParameters.GetRule().GetValue(),
- SourceField: rule.GetSourceField().GetValue(),
- }
- case *cxsdk.RuleParametersJSONExtractParameters:
- jsonExtractParameters := ruleParams.JsonExtractParameters
- result.JsonExtract = &coralogixv1alpha1.JsonExtract{
- JsonKey: jsonExtractParameters.GetRule().GetValue(),
- DestinationField: coralogixv1alpha1.RulesProtoSeverityDestinationFieldToSchemaDestinationField[jsonExtractParameters.GetDestinationField()],
- }
- case *cxsdk.RuleParametersReplaceParameters:
- replaceParameters := ruleParams.ReplaceParameters
- result.Replace = &coralogixv1alpha1.Replace{
- SourceField: rule.GetSourceField().GetValue(),
- DestinationField: replaceParameters.GetDestinationField().GetValue(),
- Regex: replaceParameters.GetRule().GetValue(),
- ReplacementString: replaceParameters.GetReplaceNewVal().GetValue(),
- }
- case *cxsdk.RuleParametersParseParameters:
- parseParameters := ruleParams.ParseParameters
- result.Parse = &coralogixv1alpha1.Parse{
- SourceField: rule.GetSourceField().GetValue(),
- DestinationField: parseParameters.GetDestinationField().GetValue(),
- Regex: parseParameters.GetRule().GetValue(),
- }
- case *cxsdk.RuleParametersAllowParameters:
- allowParameters := ruleParams.AllowParameters
- result.Block = &coralogixv1alpha1.Block{
- SourceField: rule.GetSourceField().GetValue(),
- Regex: allowParameters.GetRule().GetValue(),
- KeepBlockedLogs: allowParameters.GetKeepBlockedLogs().GetValue(),
- BlockingAllMatchingBlocks: false,
- }
- case *cxsdk.RuleParametersBlockParameters:
- blockParameters := ruleParams.BlockParameters
- result.Block = &coralogixv1alpha1.Block{
- SourceField: rule.GetSourceField().GetValue(),
- Regex: blockParameters.GetRule().GetValue(),
- KeepBlockedLogs: blockParameters.GetKeepBlockedLogs().GetValue(),
- BlockingAllMatchingBlocks: true,
- }
- case *cxsdk.RuleParametersExtractTimestampParameters:
- extractTimestampParameters := ruleParams.ExtractTimestampParameters
- result.ExtractTimestamp = &coralogixv1alpha1.ExtractTimestamp{
- SourceField: rule.GetSourceField().GetValue(),
- TimeFormat: extractTimestampParameters.GetFormat().GetValue(),
- FieldFormatStandard: coralogixv1alpha1.RulesProtoFormatStandardToSchemaFormatStandard[extractTimestampParameters.GetStandard()],
- }
- case *cxsdk.RuleParametersRemoveFieldsParameters:
- removeFieldsParameters := ruleParams.RemoveFieldsParameters
- result.RemoveFields = &coralogixv1alpha1.RemoveFields{
- ExcludedFields: removeFieldsParameters.GetFields(),
- }
- case *cxsdk.RuleParametersJSONStringifyParameters:
- jsonStringifyParameters := ruleParams.JsonStringifyParameters
- result.JsonStringify = &coralogixv1alpha1.JsonStringify{
- SourceField: rule.GetSourceField().GetValue(),
- DestinationField: jsonStringifyParameters.GetDestinationField().GetValue(),
- KeepSourceField: !(jsonStringifyParameters.GetDeleteSource().GetValue()),
- }
- case *cxsdk.RuleParametersJSONParseParameters:
- jsonParseParameters := ruleParams.JsonParseParameters
- result.ParseJsonField = &coralogixv1alpha1.ParseJsonField{
- SourceField: rule.GetSourceField().GetValue(),
- DestinationField: jsonParseParameters.GetDestinationField().GetValue(),
- KeepSourceField: !(jsonParseParameters.GetDeleteSource().GetValue()),
- KeepDestinationField: !(jsonParseParameters.GetOverrideDest().GetValue()),
- }
- default:
- return coralogixv1alpha1.Rule{}, fmt.Errorf("unexpected type %T for rule parameters, name: %s", ruleParams, rule.GetName().GetValue())
- }
- return result, nil
-}
-
-func flattenRuleMatcher(ruleMatchers []*cxsdk.RuleMatcher) (applications, subsystems []string, severities []coralogixv1alpha1.RuleSeverity, err error) {
- for _, ruleMatcher := range ruleMatchers {
- switch matcher := ruleMatcher.Constraint.(type) {
- case *cxsdk.RuleMatcherApplicationName:
- applications = append(applications, matcher.ApplicationName.GetValue().GetValue())
- case *cxsdk.RuleMatcherSubsystemName:
- subsystems = append(subsystems, matcher.SubsystemName.GetValue().GetValue())
- case *cxsdk.RuleMatcherSeverity:
- severity := matcher.Severity.GetValue()
- severities = append(severities, coralogixv1alpha1.RulesProtoSeverityToSchemaSeverity[severity])
- default:
- return nil, nil, nil, fmt.Errorf("unexpected type %T for rule matcher", ruleMatcher)
- }
- }
-
- return
-}
-
// SetupWithManager sets up the controller with the Manager.
func (r *RuleGroupReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
diff --git a/controllers/alphacontrollers/rulegroup_controller_test.go b/controllers/alphacontrollers/rulegroup_controller_test.go
index d02445d..a6e50cd 100644
--- a/controllers/alphacontrollers/rulegroup_controller_test.go
+++ b/controllers/alphacontrollers/rulegroup_controller_test.go
@@ -129,38 +129,8 @@ func TestFlattenRuleGroups(t *testing.T) {
assert.NoError(t, err)
id := "id"
- subgroupId := "subgroup_id"
expectedStatus := &coralogixv1alpha1.RuleGroupStatus{
- ID: &id,
- Name: "name",
- Description: "description",
- Active: true,
- Applications: nil,
- Subsystems: nil,
- Severities: nil,
- Hidden: false,
- Creator: "creator",
- Order: pointer.Int32(1),
- RuleSubgroups: []coralogixv1alpha1.RuleSubGroup{
- {
- ID: &subgroupId,
- Active: false,
- Order: pointer.Int32(1),
- Rules: []coralogixv1alpha1.Rule{
- {
- Name: "rule_name",
- Description: "rule_description",
- Active: true,
- Parse: nil,
- Block: nil,
- JsonExtract: &coralogixv1alpha1.JsonExtract{
- DestinationField: coralogixv1alpha1.DestinationFieldRuleSeverity,
- JsonKey: "{\"severity\": \"info\"}",
- },
- },
- },
- },
- },
+ ID: &id,
}
assert.Equal(t, expectedStatus, actualStatus)
diff --git a/docs/api.md b/docs/api.md
index f125d05..b19d8fd 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -2353,91 +2353,99 @@ AlertStatus defines the observed state of Alert
Name | +Type | +Description | +Required | +|
---|---|---|---|---|
apiVersion | +string | +coralogix.com/v1alpha1 | +true | +|
kind | +string | +OutboundWebhook | +true | +|
metadata | +object | +Refer to the Kubernetes API documentation for the fields of the `metadata` field. | +true | |
active | -boolean | -
- - |
- false | -|
alertType | +spec | object |
- - |
- false | -
description | -string | -
- + OutboundWebhookSpec defines the desired state of OutboundWebhook |
false | |
expirationDate | +status | object |
- - |
- false | -
labels | -map[string]string | -
- + OutboundWebhookStatus defines the observed state of OutboundWebhook |
false | -|
Name | +Type | +Description | +Required | +||
---|---|---|---|---|---|
name | string |
|
- false | -||
notificationGroups | -[]object | -
- - |
- false | -||
payloadFilters | -[]string | -
- - |
- false | -||
scheduling | -object | -
- - |
- false | -||
severity | -enum | -
- - - Enum: Info, Warning, Critical, Error - |
- false | +true | |
showInInsight | +outboundWebhookType | object |
|
- false | +true |
Name | -Type | -Description | -Required | -|||
---|---|---|---|---|---|---|
groups | -[]object | +|||||
detailType | +string |
|
true | |||
timeWindow | -object | +eventBusArn | +string |
|
- false | +true | +
roleName | +string | +
+ + |
+ true | +|||
source | +string | +
+ + |
+ true |
conditions | -object | +id | +string |
|
true |
filters | -object | +externalId | +string |
|
@@ -3121,13 +3012,15 @@ AlertStatus defines the observed state of Alert
key | -string | -
- - |
- true | -
timeWindow | -enum | -
- - - Enum: TwelveHours, TwentyFourHours, FortyEightHours, SeventTwoHours, Week, Month, TwoMonths, ThreeMonths - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
categories | -[]string | -
- - |
- false | -
classes | -[]string | -
- - |
- false | -
computers | -[]string | -
- - |
- false | -
ips | -[]string | -
- - |
- false | -
methods | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
conditions | -object | -
- - |
- true | -
q1Filters | -object | -
- - |
- false | -
q2Filters | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alertWhen | -enum | -
- - - Enum: More, Less - |
- true | -
ratio | -int or string | -
- - |
- true | -
timeWindow | -enum | -
- - - Enum: FiveMinutes, TenMinutes, FifteenMinutes, TwentyMinutes, ThirtyMinutes, Hour, TwoHours, FourHours, SixHours, TwelveHours, TwentyFourHours, ThirtySixHours - |
- true | -
groupBy | -[]string | -
- - |
- false | -
groupByFor | -enum | -
- - - Enum: Q1, Q2, Both - |
- false | -
ignoreInfinity | -boolean | -
- - - Default: false - |
- false | -
manageUndetectedValues | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
autoRetireRatio | -enum | -
- - - Enum: Never, FiveMinutes, TenMinutes, Hour, TwoHours, SixHours, TwelveHours, TwentyFourHours - Default: Never - |
- false | -
enableTriggeringOnUndetectedValues | -boolean | -
- - - Default: true - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
categories | -[]string | -
- - |
- false | -
classes | -[]string | -
- - |
- false | -
computers | -[]string | -
- - |
- false | -
ips | -[]string | -
- - |
- false | -
methods | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
conditions | -object | -
- - |
- true | -
filters | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alertWhen | -enum | -
- - - Enum: More, Less, Immediately, MoreThanUsual - |
- true | -
groupBy | -[]string | -
- - |
- false | -
manageUndetectedValues | -object | -
- - |
- false | -
threshold | -integer | -
- - |
- false | -
timeWindow | -enum | -
- - - Enum: FiveMinutes, TenMinutes, FifteenMinutes, TwentyMinutes, ThirtyMinutes, Hour, TwoHours, FourHours, SixHours, TwelveHours, TwentyFourHours, ThirtySixHours - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
autoRetireRatio | -enum | -
- - - Enum: Never, FiveMinutes, TenMinutes, Hour, TwoHours, SixHours, TwelveHours, TwentyFourHours - Default: Never - |
- false | -
enableTriggeringOnUndetectedValues | -boolean | -
- - - Default: true - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
categories | -[]string | -
- - |
- false | -
classes | -[]string | -
- - |
- false | -
computers | -[]string | -
- - |
- false | -
ips | -[]string | -
- - |
- false | -
methods | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
conditions | -object | -
- - |
- true | -
filters | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alertWhen | -enum | -
- - - Enum: More, Less - |
- true | -
threshold | -int or string | -
- - |
- true | -
timeWindow | -enum | -
- - - Enum: PreviousHour, SameHourYesterday, SameHourLastWeek, Yesterday, SameDayLastWeek, SameDayLastMonth - |
- true | -
groupBy | -[]string | -
- - |
- false | -
ignoreInfinity | -boolean | -
- - - Default: false - |
- false | -
manageUndetectedValues | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
autoRetireRatio | -enum | -
- - - Enum: Never, FiveMinutes, TenMinutes, Hour, TwoHours, SixHours, TwelveHours, TwentyFourHours - Default: Never - |
- false | -
enableTriggeringOnUndetectedValues | -boolean | -
- - - Default: true - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
categories | -[]string | -
- - |
- false | -
classes | -[]string | -
- - |
- false | -
computers | -[]string | -
- - |
- false | -
ips | -[]string | -
- - |
- false | -
methods | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
conditions | -object | -
- - |
- true | -
filters | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alertWhen | -enum | -
- - - Enum: More, Immediately - |
- true | -
groupBy | -[]string | -
- - |
- false | -
threshold | -integer | -
- - |
- false | -
timeWindow | -enum | -
- - - Enum: FiveMinutes, TenMinutes, FifteenMinutes, TwentyMinutes, ThirtyMinutes, Hour, TwoHours, FourHours, SixHours, TwelveHours, TwentyFourHours, ThirtySixHours - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
applications | -[]string | -
- - |
- false | -
latencyThresholdMilliseconds | -int or string | -
- - |
- false | -
services | -[]string | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
tagFilters | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
field | -string | -
- - |
- false | -
values | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
conditions | -object | -
- - |
- true | -
filters | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
key | -string | -
- - |
- true | -
maxUniqueValues | -integer | -
- - - Minimum: 1 - |
- true | -
timeWindow | -enum | -
- - - Enum: Minute, FiveMinutes, TenMinutes, FifteenMinutes, TwentyMinutes, ThirtyMinutes, Hour, TwoHours, FourHours, SixHours, TwelveHours, TwentyFourHours, ThirtySixHours - |
- true | -
groupBy | -string | -
- - |
- false | -
maxUniqueValuesForGroupBy | -integer | -
- - - Minimum: 1 - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
alias | -string | -
- - |
- false | -
applications | -[]string | -
- - |
- false | -
categories | -[]string | -
- - |
- false | -
classes | -[]string | -
- - |
- false | -
computers | -[]string | -
- - |
- false | -
ips | -[]string | -
- - |
- false | -
methods | -[]string | -
- - |
- false | -
searchQuery | -string | -
- - |
- false | -
severities | -[]enum | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
day | -integer | -
- - - Format: int32 - Minimum: 1 - Maximum: 31 - |
- false | -
month | -integer | -
- - - Format: int32 - Minimum: 1 - Maximum: 12 - |
- false | -
year | -integer | -
- - - Format: int32 - Minimum: 1 - Maximum: 9999 - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
groupByFields | -[]string | -
- - |
- false | -
notifications | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
emailRecipients | -[]string | -
- - |
- false | -
integrationName | -string | -
- - |
- false | -
notifyOn | -enum | -
- - - Enum: TriggeredOnly, TriggeredAndResolved - |
- false | -
retriggeringPeriodMinutes | -integer | -
- - - Format: int32 - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
daysEnabled | -[]enum | -
- - |
- false | -
endTime | -string | -
- - |
- false | -
startTime | -string | -
- - |
- false | -
timeZone | -string | -
- - - Default: UTC+00 - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
notifyOn | -enum | -
- - - Enum: TriggeredOnly, TriggeredAndResolved - Default: TriggeredOnly - |
- false | -
retriggeringPeriodMinutes | -integer | -
- - - Format: int32 - Minimum: 1 - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
apiVersion | -string | -coralogix.com/v1alpha1 | -true | -
kind | -string | -OutboundWebhook | -true | -
metadata | -object | -Refer to the Kubernetes API documentation for the fields of the `metadata` field. | -true | -
spec | -object | -
- OutboundWebhookSpec defines the desired state of OutboundWebhook - |
- false | -
status | -object | -
- OutboundWebhookStatus defines the observed state of OutboundWebhook - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
name | -string | -
- - |
- true | -
outboundWebhookType | -object | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
awsEventBridge | -object | -
- - |
- false | -
demisto | -object | -
- - |
- false | -
emailGroup | -object | -
- - |
- false | -
genericWebhook | -object | -
- - |
- false | -
jira | -object | -
- - |
- false | -
microsoftTeams | -object | -
- - |
- false | -
opsgenie | -object | -
- - |
- false | -
pagerDuty | -object | -
- - |
- false | -
sendLog | -object | -
- - |
- false | -
slack | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
detail | -string | -
- - |
- true | -
detailType | -string | -
- - |
- true | -
eventBusArn | -string | -
- - |
- true | -
roleName | -string | -
- - |
- true | -
source | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
payload | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
uuid | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
emailAddresses | -[]string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
method | -enum | -
- - - Enum: Unkown, Get, Post, Put - |
- true | -
url | -string | -
- - |
- true | -
headers | -map[string]string | -
- - |
- false | -
payload | -string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
apiToken | -string | -
- - |
- true | -
string | -
- - |
- true | -|
projectKey | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
serviceKey | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
payload | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
attachments | -[]object | -
- - |
- false | -
digests | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
isActive | -boolean | -
- - |
- true | -
type | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
isActive | -boolean | -
- - |
- true | -
type | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
id | -string | -
- - |
- true | -
name | -string | -
- - |
- true | -
outboundWebhookType | -object | -
- - |
- true | -
externalId | -string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
awsEventBridge | -object | -
- - |
- false | -
demisto | -object | -
- - |
- false | -
emailGroup | -object | -
- - |
- false | -
genericWebhook | -object | -
- - |
- false | -
jira | -object | -
- - |
- false | -
microsoftTeams | -object | -
- - |
- false | -
opsgenie | -object | -
- - |
- false | -
pagerDuty | -object | -
- - |
- false | -
sendLog | -object | -
- - |
- false | -
slack | -object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
detail | -string | -
- - |
- true | -
detailType | -string | -
- - |
- true | -
eventBusArn | -string | -
- - |
- true | -
roleName | -string | -
- - |
- true | -
source | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
payload | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
uuid | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
emailAddresses | -[]string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
method | -enum | -
- - - Enum: Unkown, Get, Post, Put - |
- true | -
url | -string | -
- - |
- true | -
uuid | -string | -
- - |
- true | -
headers | -map[string]string | -
- - |
- false | -
payload | -string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
apiToken | -string | -
- - |
- true | -
string | -
- - |
- true | -|
projectKey | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
serviceKey | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
payload | -string | -
- - |
- true | -
url | -string | -
- - |
- true | -
uuid | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
url | -string | -
- - |
- true | -
attachments | -[]object | -
- - |
- false | -
digests | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
isActive | -boolean | -
- - |
- true | -
type | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
isActive | -boolean | -
- - |
- true | -
type | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
apiVersion | -string | -coralogix.com/v1alpha1 | -true | -
kind | -string | -RecordingRuleGroupSet | -true | -
metadata | -object | -Refer to the Kubernetes API documentation for the fields of the `metadata` field. | -true | -
spec | -object | -
- RecordingRuleGroupSetSpec defines the desired state of RecordingRuleGroupSet - |
- false | -
status | -object | -
- RecordingRuleGroupSetStatus defines the observed state of RecordingRuleGroupSet - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
groups | -[]object | -
- - |
- true | -
Name | -Type | -Description | -Required | -
---|---|---|---|
intervalSeconds | -integer | -
- - - Format: int32 - Default: 60 - |
- false | -
limit | -integer | -
- - - Format: int64 - |
- false | -
name | -string | -
- INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
-Important: Run "make" to regenerate code after modifying this file - |
- false | -
rules | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
expr | -string | -
- - |
- false | -
labels | -map[string]string | -
- - |
- false | -
record | -string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
id | -string | -
- - |
- true | -
groups | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
intervalSeconds | -integer | -
- - - Format: int32 - Default: 60 - |
- false | -
limit | -integer | -
- - - Format: int64 - |
- false | -
name | -string | -
- INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
-Important: Run "make" to regenerate code after modifying this file - |
- false | -
rules | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
expr | -string | -
- - |
- false | -
labels | -map[string]string | -
- - |
- false | -
record | -string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
apiVersion | -string | -coralogix.com/v1alpha1 | -true | -
kind | -string | -RuleGroup | -true | -
metadata | -object | -Refer to the Kubernetes API documentation for the fields of the `metadata` field. | -true | -
spec | -object | -
- RuleGroupSpec defines the Desired state of RuleGroup - |
- false | -
status | -object | -
- RuleGroupStatus defines the observed state of RuleGroup - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
name | -string | -
- - |
- true | -
active | -boolean | -
- - - Default: true - |
- false | -
applications | -[]string | -
- - |
- false | -
creator | -string | -
- - |
- false | -
description | -string | -
- - |
- false | -
hidden | -boolean | -
- - - Default: false - |
- false | -
order | -integer | -
- - - Format: int32 - Minimum: 1 - |
- false | -
severities | -[]enum | -
- - |
- false | -
subgroups | -[]object | -
- - |
- false | -
subsystems | -[]string | -
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
active | -boolean | -
- - - Default: true - |
- false | -
id | -string | -
- - |
- false | -
order | -integer | -
- - - Format: int32 - |
- false | -
rules | -[]object | -
- - |
- false | -
Name | -Type | -Description | -Required | -||||
---|---|---|---|---|---|---|---|
name | -string | -
- - |
- true | -||||
active | -boolean | -
- - - Default: true - |
- false | -||||
block | -object | -
- - |
- false | -||||
description | -string | -
- - |
- false | -||||
extract | -object | -
- - |
- false | -||||
extractTimestamp | -object | -
- - |
- false | -||||
jsonExtract | -object | -
- - |
- false | -||||
jsonStringify | -object | -
- - |
- false | -||||
parse | -object | -
- - |
- false | -||||
parseJsonField | -object | -
- - |
- false | -||||
removeFields | -object | -
- - |
- false | +apiVersion | +string | +coralogix.com/v1alpha1 | +true | +
kind | +string | +RecordingRuleGroupSet | +true | +||||
metadata | +object | +Refer to the Kubernetes API documentation for the fields of the `metadata` field. | +true | ||||
replace | +spec | object |
- - |
- false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
regex | -string | -
- - |
- true | -
sourceField | -string | -
- - |
- true | -
blockingAllMatchingBlocks | -boolean | -
- - - Default: true - |
- false | -
keepBlockedLogs | -boolean | -
- - - Default: false + RecordingRuleGroupSetSpec defines the desired state of RecordingRuleGroupSet |
false | -
Name | -Type | -Description | -Required | -
---|---|---|---|
regex | -string | -
- - |
- true | -
sourceField | -string | -
- - |
- true | -
Name | -Type | -Description | -Required | -|
---|---|---|---|---|
fieldFormatStandard | -enum | -
- - - Enum: Strftime, JavaSDF, Golang, SecondTS, MilliTS, MicroTS, NanoTS - |
- true | -|
sourceField | -string | -
- - |
- true | -|
timeFormat | -string | +|||
status | +object |
- + RecordingRuleGroupSetStatus defines the observed state of RecordingRuleGroupSet |
- true | +false |
destinationField | -enum | -
- - - Enum: Category, CLASSNAME, METHODNAME, THREADID, SEVERITY - |
- true | -|
jsonKey | -string | +groups | +[]object |
|
@@ -6588,8 +3093,8 @@ RuleGroupSpec defines the Desired state of RuleGroup
Name | -Type | -Description | -Required | -|||
---|---|---|---|---|---|---|
destinationField | -string | -
- - |
- true | |||
regex | +name | string |
- + INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +Important: Run "make" to regenerate code after modifying this file |
- true | +false | |
sourceField | -string | +rules | +[]object |
|
- true | +false |
excludedFields | -[]string | +id | +string |
|
@@ -6746,13 +3214,15 @@ RuleGroupSpec defines the Desired state of RuleGroup
destinationField | -string | -
- - |
- true | -||||
regex | -string | -
- - |
- true | +apiVersion | +string | +coralogix.com/v1alpha1 | +true | +
kind | +string | +RuleGroup | +true | +||||
metadata | +object | +Refer to the Kubernetes API documentation for the fields of the `metadata` field. | +true | ||||
replacementString | -string | +spec | +object |
- + RuleGroupSpec defines the Desired state of RuleGroup |
- true | +false | |
sourceField | -string | +status | +object |
- + RuleGroupStatus defines the observed state of RuleGroup |
- true | +false |
id | +name | string |
- INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
-Important: Run "make" to regenerate code after modifying this file + |
true |
boolean |
+ + Default: true |
false | ||
boolean |
- |
- false | -||
name | -string | -
+ Default: false |
false | |
false | ||||
false | ||||
subgroups | +subgroups | []object |
@@ -6895,8 +3365,8 @@ Important: Run "make" to regenerate code after modifying this file |
Name | +Type | +Description | +Required | +
---|---|---|---|
id | +string | +
+ INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
+Important: Run "make" to regenerate code after modifying this file + |
+ true | +