Skip to content

Commit

Permalink
Merge branch 'coralogix:main' into support-prometheus-rule-integratio…
Browse files Browse the repository at this point in the history
…n-name
  • Loading branch information
alexandermarston authored Oct 14, 2024
2 parents 16e7352 + ef690a5 commit ae455fa
Show file tree
Hide file tree
Showing 14 changed files with 475 additions and 1,924 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ jobs:
${{ steps.meta.outputs.tags }}
coralogixrepo/coralogix-operator:${{ steps.fetch-latest-release.outputs.latest-release }}
coralogixrepo/coralogix-operator:latest
build-args: |
LDFLAGS=-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ generate-api-docs: crdoc ## Generate API documentation.

.PHONY: build
build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go
go build -ldflags=$(LDFLAGS) -o bin/manager main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
go run -ldflags=$(LDFLAGS) ./main.go

# If you wish built the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
Expand Down
22 changes: 12 additions & 10 deletions apis/coralogix/v1alpha1/recordingrulegroupset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import (
"fmt"
"reflect"

utils "github.com/coralogix/coralogix-operator/apis"
rrg "github.com/coralogix/coralogix-operator/controllers/clientset/grpc/recording-rules-groups/v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

cxsdk "github.com/coralogix/coralogix-management-sdk/go"

utils "github.com/coralogix/coralogix-operator/apis"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand Down Expand Up @@ -56,16 +58,16 @@ func (in *RecordingRuleGroupSetSpec) DeepEqual(status RecordingRuleGroupSetStatu
return true, utils.Diff{}
}

func (in *RecordingRuleGroupSetSpec) ExtractRecordingRuleGroups() []*rrg.InRuleGroup {
result := make([]*rrg.InRuleGroup, 0, len(in.Groups))
func (in *RecordingRuleGroupSetSpec) ExtractRecordingRuleGroups() []*cxsdk.InRuleGroup {
result := make([]*cxsdk.InRuleGroup, 0, len(in.Groups))
for _, ruleGroup := range in.Groups {
rg := expandRecordingRuleGroup(ruleGroup)
result = append(result, rg)
}
return result
}

func expandRecordingRuleGroup(group RecordingRuleGroup) *rrg.InRuleGroup {
func expandRecordingRuleGroup(group RecordingRuleGroup) *cxsdk.InRuleGroup {
interval := new(uint32)
*interval = uint32(group.IntervalSeconds)

Expand All @@ -74,25 +76,25 @@ func expandRecordingRuleGroup(group RecordingRuleGroup) *rrg.InRuleGroup {

rules := expandRecordingRules(group.Rules)

return &rrg.InRuleGroup{
return &cxsdk.InRuleGroup{
Name: group.Name,
Interval: interval,
Limit: limit,
Rules: rules,
}
}

func expandRecordingRules(rules []RecordingRule) []*rrg.InRule {
result := make([]*rrg.InRule, 0, len(rules))
func expandRecordingRules(rules []RecordingRule) []*cxsdk.InRule {
result := make([]*cxsdk.InRule, 0, len(rules))
for _, r := range rules {
rule := extractRecordingRule(r)
result = append(result, rule)
}
return result
}

func extractRecordingRule(rule RecordingRule) *rrg.InRule {
return &rrg.InRule{
func extractRecordingRule(rule RecordingRule) *cxsdk.InRule {
return &cxsdk.InRule{
Record: rule.Record,
Expr: rule.Expr,
Labels: rule.Labels,
Expand Down
35 changes: 35 additions & 0 deletions charts/coralogix-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,46 @@ rules:
- get
- patch
- update
- apiGroups:
- coralogix.com
resources:
- outboundwebhooks
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- coralogix.com
resources:
- outboundwebhooks/finalizers
verbs:
- update
- apiGroups:
- coralogix.com
resources:
- outboundwebhooks/status
verbs:
- get
- patch
- update
- apiGroups:
- monitoring.coreos.com
resources:
- prometheusrules
- alertmanagerconfigs
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
Loading

0 comments on commit ae455fa

Please sign in to comment.