Skip to content

Multiple external labels for ruler in jsonnet #323

@jobinjosem1

Description

@jobinjosem1

I am trying to build manifests using the JSONnet file below. I have added two labels to the ruler, "cluster_name" and "rule_replica", but in the compiled manifests, only one label is being added. Can someone help me add an additional label to thanos-rule?

local t = import 'kube-thanos/thanos.libsonnet';

// For an example with every option and component, please check all.jsonnet

local commonConfig = {
local cfg = self,
logFormat: 'json',
namespace: 'monitoring',
version: 'v0.29.0',
image: 'myregistry.azurecr.io/thanos/thanos:' + cfg.version + '@sha256:abcd',
replicaLabels: ['prometheus_replica', 'rule_replica'],
objectStorageConfig: {
name: 'thanos-objectstorage',
key: 'thanos.yaml',
},
};

local ru = t.rule(commonConfig {
replicas: 1,
rulesConfig: [{ name: 'thanos-rule', key: 'thanos-rule.yaml' }],
replicaLabels: ['cluster_name', 'rule_replica'],
serviceMonitor: true,
volumeClaimTemplate: {
spec: {
accessModes: ['ReadWriteOnce'],
resources: {
requests: {
storage: '100Gi'
}
},
storageClassName: 'managed-csi-premium-zrs'
}
},
reloaderImage: 'myregistry.azurecr.io/configmapreloader/configmap-reload:v0.12.0'
});

local q = t.query(commonConfig {
replicas: 1,
replicaLabels: ['prometheus_replica', 'rule_replica'],
serviceMonitor: true,
queryTimeout: '60s'
});

local finalRu = t.rule(ru.config {
queriers: ['dnssrv+_http._tcp.%s.%s.svc.cluster.local' % [q.service.metadata.name, q.service.metadata.namespace]],
});

{ ['thanos-ruler-' + name]: finalRu[name] for name in std.objectFields(finalRu) }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions