Skip to content

Commit c9f0cc9

Browse files
authoredMar 24, 2025··
Generate two compactors for new datahub bucket (#784)
1 parent 64f8782 commit c9f0cc9

File tree

2 files changed

+175
-2
lines changed
  • magefiles
  • resources/services/rhobs-thanos-operator/production

2 files changed

+175
-2
lines changed
 

‎magefiles/cr.go

+104-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package main
22

33
import (
4-
"sort"
5-
64
kghelpers "github.com/observatorium/observatorium/configuration_go/kubegen/helpers"
75
"github.com/observatorium/observatorium/configuration_go/kubegen/openshift"
86
routev1 "github.com/openshift/api/route/v1"
97
templatev1 "github.com/openshift/api/template/v1"
108
"github.com/philipgough/mimic/encoding"
119
"github.com/thanos-community/thanos-operator/api/v1alpha1"
10+
"sort"
1211

1312
corev1 "k8s.io/api/core/v1"
1413
"k8s.io/apimachinery/pkg/api/resource"
@@ -28,6 +27,7 @@ func (p Production) OperatorCR() {
2827

2928
objs = append(objs, queryCR(ns, ProductionMaps, true)...)
3029
objs = append(objs, storeCR(ns, ProductionMaps)...)
30+
objs = append(objs, compactTempProduction()...)
3131

3232
// Sort objects by Kind then Name
3333
sort.Slice(objs, func(i, j int) bool {
@@ -817,6 +817,108 @@ func rulerCR(namespace string, m TemplateMaps) runtime.Object {
817817
}
818818
}
819819

820+
func compactTempProduction() []runtime.Object {
821+
ns := "rhobs-production"
822+
image := currentThanosImageProd
823+
version := currentThanosVersionProd
824+
storageBucket := "TELEMETER"
825+
826+
m := ProductionMaps
827+
828+
recentCompact := &v1alpha1.ThanosCompact{
829+
TypeMeta: metav1.TypeMeta{
830+
APIVersion: "monitoring.thanos.io/v1alpha1",
831+
Kind: "ThanosCompact",
832+
},
833+
ObjectMeta: metav1.ObjectMeta{
834+
Name: "recent",
835+
Namespace: ns,
836+
},
837+
Spec: v1alpha1.ThanosCompactSpec{
838+
CommonFields: v1alpha1.CommonFields{
839+
Image: ptr.To(image),
840+
Version: ptr.To(version),
841+
ImagePullPolicy: ptr.To(corev1.PullIfNotPresent),
842+
LogLevel: ptr.To("info"),
843+
LogFormat: ptr.To("logfmt"),
844+
},
845+
ObjectStorageConfig: TemplateFn(storageBucket, m.ObjectStorageBucket),
846+
RetentionConfig: v1alpha1.RetentionResolutionConfig{
847+
Raw: v1alpha1.Duration("3650d"),
848+
FiveMinutes: v1alpha1.Duration("3650d"),
849+
OneHour: v1alpha1.Duration("3650d"),
850+
},
851+
DownsamplingConfig: &v1alpha1.DownsamplingConfig{
852+
Concurrency: ptr.To(int32(1)),
853+
Disable: ptr.To(true),
854+
},
855+
CompactConfig: &v1alpha1.CompactConfig{
856+
CompactConcurrency: ptr.To(int32(1)),
857+
},
858+
DebugConfig: &v1alpha1.DebugConfig{
859+
AcceptMalformedIndex: ptr.To(true),
860+
HaltOnError: ptr.To(true),
861+
MaxCompactionLevel: ptr.To(int32(3)),
862+
},
863+
StorageSize: v1alpha1.StorageSize("50GB"),
864+
FeatureGates: &v1alpha1.FeatureGates{
865+
ServiceMonitorConfig: &v1alpha1.ServiceMonitorConfig{
866+
Enable: ptr.To(false),
867+
},
868+
},
869+
MaxTime: ptr.To(v1alpha1.Duration("-2w")),
870+
},
871+
}
872+
873+
historic := &v1alpha1.ThanosCompact{
874+
TypeMeta: metav1.TypeMeta{
875+
APIVersion: "monitoring.thanos.io/v1alpha1",
876+
Kind: "ThanosCompact",
877+
},
878+
ObjectMeta: metav1.ObjectMeta{
879+
Name: "historic",
880+
Namespace: ns,
881+
},
882+
Spec: v1alpha1.ThanosCompactSpec{
883+
CommonFields: v1alpha1.CommonFields{
884+
Image: ptr.To(image),
885+
Version: ptr.To(version),
886+
ImagePullPolicy: ptr.To(corev1.PullIfNotPresent),
887+
LogLevel: ptr.To("info"),
888+
LogFormat: ptr.To("logfmt"),
889+
},
890+
ObjectStorageConfig: TemplateFn(storageBucket, m.ObjectStorageBucket),
891+
RetentionConfig: v1alpha1.RetentionResolutionConfig{
892+
Raw: v1alpha1.Duration("3650d"),
893+
FiveMinutes: v1alpha1.Duration("3650d"),
894+
OneHour: v1alpha1.Duration("3650d"),
895+
},
896+
DownsamplingConfig: &v1alpha1.DownsamplingConfig{
897+
Concurrency: ptr.To(int32(1)),
898+
Disable: ptr.To(false),
899+
},
900+
CompactConfig: &v1alpha1.CompactConfig{
901+
CompactConcurrency: ptr.To(int32(1)),
902+
},
903+
DebugConfig: &v1alpha1.DebugConfig{
904+
AcceptMalformedIndex: ptr.To(true),
905+
HaltOnError: ptr.To(true),
906+
MaxCompactionLevel: ptr.To(int32(5)),
907+
},
908+
StorageSize: v1alpha1.StorageSize("500GB"),
909+
FeatureGates: &v1alpha1.FeatureGates{
910+
ServiceMonitorConfig: &v1alpha1.ServiceMonitorConfig{
911+
Enable: ptr.To(false),
912+
},
913+
},
914+
MinTime: ptr.To(v1alpha1.Duration("-3650d")),
915+
MaxTime: ptr.To(v1alpha1.Duration("-2w")),
916+
},
917+
}
918+
919+
return []runtime.Object{recentCompact, historic}
920+
}
921+
820922
func compactCR(namespace string, m TemplateMaps, oauth bool) []runtime.Object {
821923
defaultCompact := &v1alpha1.ThanosCompact{
822924
TypeMeta: metav1.TypeMeta{

‎resources/services/rhobs-thanos-operator/production/rhobs.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,77 @@ objects:
9595
storeLimitsOptions: {}
9696
version: c7c3ef94c51d518bb6056d3ad416d7b4f39559f3
9797
status: {}
98+
- apiVersion: monitoring.thanos.io/v1alpha1
99+
kind: ThanosCompact
100+
metadata:
101+
creationTimestamp: null
102+
name: historic
103+
namespace: rhobs-production
104+
spec:
105+
baseImage: quay.io/redhat-user-workloads/rhobs-mco-tenant/rhobs-thanos
106+
compactConfig:
107+
compactConcurrency: 1
108+
debugConfig:
109+
acceptMalformedIndex: true
110+
haltOnError: true
111+
maxCompactionLevel: 5
112+
downsamplingConfig:
113+
downsamplingConcurrency: 1
114+
downsamplingEnabled: false
115+
featureGates:
116+
serviceMonitor:
117+
enable: false
118+
imagePullPolicy: IfNotPresent
119+
logFormat: logfmt
120+
logLevel: info
121+
maxTime: -2w
122+
minTime: -3650d
123+
objectStorageConfig:
124+
key: thanos.yaml
125+
name: thanos-objectstorage
126+
optional: false
127+
retentionConfig:
128+
fiveMinutes: 3650d
129+
oneHour: 3650d
130+
raw: 3650d
131+
storageSize: 500GB
132+
version: c7c3ef94c51d518bb6056d3ad416d7b4f39559f3
133+
status: {}
134+
- apiVersion: monitoring.thanos.io/v1alpha1
135+
kind: ThanosCompact
136+
metadata:
137+
creationTimestamp: null
138+
name: recent
139+
namespace: rhobs-production
140+
spec:
141+
baseImage: quay.io/redhat-user-workloads/rhobs-mco-tenant/rhobs-thanos
142+
compactConfig:
143+
compactConcurrency: 1
144+
debugConfig:
145+
acceptMalformedIndex: true
146+
haltOnError: true
147+
maxCompactionLevel: 3
148+
downsamplingConfig:
149+
downsamplingConcurrency: 1
150+
downsamplingEnabled: true
151+
featureGates:
152+
serviceMonitor:
153+
enable: false
154+
imagePullPolicy: IfNotPresent
155+
logFormat: logfmt
156+
logLevel: info
157+
maxTime: -2w
158+
objectStorageConfig:
159+
key: thanos.yaml
160+
name: thanos-objectstorage
161+
optional: false
162+
retentionConfig:
163+
fiveMinutes: 3650d
164+
oneHour: 3650d
165+
raw: 3650d
166+
storageSize: 50GB
167+
version: c7c3ef94c51d518bb6056d3ad416d7b4f39559f3
168+
status: {}
98169
- apiVersion: monitoring.thanos.io/v1alpha1
99170
kind: ThanosQuery
100171
metadata:

0 commit comments

Comments
 (0)
Please sign in to comment.