1
1
package main
2
2
3
3
import (
4
- "sort"
5
-
6
4
kghelpers "github.com/observatorium/observatorium/configuration_go/kubegen/helpers"
7
5
"github.com/observatorium/observatorium/configuration_go/kubegen/openshift"
8
6
routev1 "github.com/openshift/api/route/v1"
9
7
templatev1 "github.com/openshift/api/template/v1"
10
8
"github.com/philipgough/mimic/encoding"
11
9
"github.com/thanos-community/thanos-operator/api/v1alpha1"
10
+ "sort"
12
11
13
12
corev1 "k8s.io/api/core/v1"
14
13
"k8s.io/apimachinery/pkg/api/resource"
@@ -28,6 +27,7 @@ func (p Production) OperatorCR() {
28
27
29
28
objs = append (objs , queryCR (ns , ProductionMaps , true )... )
30
29
objs = append (objs , storeCR (ns , ProductionMaps )... )
30
+ objs = append (objs , compactTempProduction ()... )
31
31
32
32
// Sort objects by Kind then Name
33
33
sort .Slice (objs , func (i , j int ) bool {
@@ -817,6 +817,108 @@ func rulerCR(namespace string, m TemplateMaps) runtime.Object {
817
817
}
818
818
}
819
819
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
+
820
922
func compactCR (namespace string , m TemplateMaps , oauth bool ) []runtime.Object {
821
923
defaultCompact := & v1alpha1.ThanosCompact {
822
924
TypeMeta : metav1.TypeMeta {
0 commit comments