Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple external labels for ruler in jsonnet #323

Open
jobinjosem1 opened this issue Jul 3, 2024 · 1 comment
Open

Multiple external labels for ruler in jsonnet #323

jobinjosem1 opened this issue Jul 3, 2024 · 1 comment

Comments

@jobinjosem1
Copy link

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) }

@michael-burt
Copy link
Contributor

replicaLabels isn't a valid arg for the ruler, the label you see is being added here: https://github.com/thanos-io/kube-thanos/blob/main/jsonnet/kube-thanos/kube-thanos-rule.libsonnet#L139

You want to add an additional --label arg to the ruler, and that is not currently supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants