kadet-hub logokadet-hub

thanos

Renders Thanos Operator ThanosQuery, ThanosReceive, ThanosRuler, ThanosStore and ThanosCompact resources from inventory parameters.

kubernetesoperatorsobservability

Latest
1.0.2 ·
License
Apache-2.0
Owners
Moep90
Source
github.com/kadet-hub/generators · 0 repo stars, shared by 35 generators
Thumbs up
👍 0 on GitHub Discussions
Popularity
18 · 438 pulls

Request a feature Report a problem

Badge

Show the latest listed version in your README. shields.io draws the badge from this page's badge.json, which every catalog build updates; once no version is listed, it reads "not listed".

[![kadet-hub](https://img.shields.io/endpoint?url=https://kadet-hub.org/generators/thanos/badge.json)](https://kadet-hub.org/generators/thanos/)

Thanos Generator

Published on kadet-hub (catalog): pin a released version by digest from its catalog page.

Kapitan kadet generator for Thanos Operator resources (monitoring.thanos.io/v1alpha1):

  • ThanosQuery: Thanos Querier, optionally fronted by Query Frontend
  • ThanosReceive: Receive router and ingester hashrings
  • ThanosRuler: rule evaluation against Thanos Query
  • ThanosStore: Store Gateway serving blocks from object storage
  • ThanosCompact: compaction, downsampling and retention of object storage blocks

Built for Thanos Operator main@1b6edfb. The Thanos Operator has no release yet and marks its APIs alpha, so the schemas are pinned to main commit 1b6edfbba0e54af83870b158ee1124e499455b43; expect breaking changes when upstream moves.

monitoring.coreos.com/v1 ThanosRuler (Prometheus Operator) is a different API and belongs to the prometheus-operator generator. The Thanos sidecar is configured on the Prometheus Operator Prometheus resource. The object storage Secret belongs in the kubernetes generator.

Usage

Kapitan Configuration

parameters:
  kapitan:
    dependencies:
      - type: oci
        source: ghcr.io/kadet-hub/thanos@sha256:<digest>
        output_path: lib/thanos
    compile:
      - output_path: manifests/thanos/
        input_type: kadet
        output_type: yml
        input_paths:
          - lib/thanos

Inventory Contract

All keys live under parameters.generators.thanos.

Key Kind Output key
namespace Default namespace. Falls back to parameters.namespace, then default.
object_storage_config Object storage Secret shared by every kind that needs one, as <secret> or {name, key}. See Defaults.
thanos_queries.<name> ThanosQuery <namespace>/<name>-thanosquery
thanos_receives.<name> ThanosReceive <namespace>/<name>-thanosreceive
thanos_rulers.<name> ThanosRuler <namespace>/<name>-thanosruler
thanos_stores.<name> ThanosStore <namespace>/<name>-thanosstore
thanos_compacts.<name> ThanosCompact <namespace>/<name>-thanoscompact

Every resource accepts namespace, labels, annotations and spec. labels and annotations set the custom resource metadata; the CRD fields spec.labels and spec.annotations, which the operator copies to the generated workloads, are set through spec. For the same field, defaults lose to spec, and spec loses to the flat keys and shorthands below; a flat key or shorthand that overrides a spec value logs a warning.

Flat keys are the snake_case spelling of the top-level CRD spec fields; values pass through unchanged.

Common to ThanosQuery, ThanosRuler, ThanosStore and ThanosCompact: additional_args, additional_containers, additional_env, additional_ports, additional_service_ports, additional_volume_mounts, additional_volumes, affinity, base_image, config_maps, image_pull_policy, image_pull_secrets, log_format, log_level, node_selector, paused, pod_disruption_budget_config, resource_requirements, secrets, security_context, tolerations, topology_spread_constraints, version.

StatefulSet fields, on ThanosReceive, ThanosRuler, ThanosStore and ThanosCompact: min_ready_seconds, persistent_volume_claim_retention_policy, pod_management_policy, termination_grace_period_seconds.

Kind Additional flat keys
ThanosQuery replicas, custom_store_label_selector, grpc_proxy_strategy, query_frontend, replica_labels, telemetry_quantiles, web_config
ThanosReceive router_spec, ingester_spec, paused
ThanosRuler replicas, alertmanager_url, alert_label_drop, evaluation_interval, query_label_selector, rule_config_selector, rule_tenancy_config, ruler_mode, storage
ThanosStore replicas, object_storage_config, sharding_strategy, storage, block_config, caching_bucket_config, ignore_deletion_marks_delay, index_cache_config, index_header_config, store_limits_options, time_range_config
ThanosCompact object_storage_config, retention, retention_config, storage, block_config, block_viewer_global_sync, compact_config, debug_config, downsampling_config, sharding_config, time_range_config, vertical_compaction_config

Shorthands:

Input Result
object_storage_config: <secret> (generator, ThanosStore, ThanosCompact) {name: <secret>, key: thanos.yaml}
ThanosCompact retention: <duration> the same retention for raw, fiveMinutes and oneHour; resolutions set in retention_config keep their value

thanos.yaml is the Secret key used throughout the upstream samples and docs. A dict passes through, for a different key. On a ThanosReceive or ThanosRuler, set a different Secret through ingester_spec.defaultObjectStorageConfig or ruler_mode.stateful.objectStorageConfig in the full {name, key} form.

Defaults

A field the inventory leaves out is filled as below. Fields the CRD marks required get the CRD’s own default, so the shortest entry passes offline schema validation and behaves as if the API server had defaulted it. Other CRD defaults (imagePullPolicy: IfNotPresent, logFormat: logfmt and so on) are left to the API server.

Kind Field Default Source
ThanosStore, ThanosCompact objectStorageConfig generator object_storage_config required, no CRD default (store, compact); the samples share one Secret across components
ThanosReceive ingesterSpec.defaultObjectStorageConfig generator object_storage_config required, no CRD default (receive)
ThanosRuler rulerMode.stateful.objectStorageConfig generator object_storage_config required in Stateful mode, no CRD default (ruler)
ThanosQuery replicaLabels [prometheus_replica, replica, rule_replica] upstream sample: the replica labels of Prometheus Operator, ThanosReceive ingesters (receive) and ThanosRuler (ruler); the CRD default [replica] (query) deduplicates only the ingesters
ThanosCompact retentionConfig.{raw,fiveMinutes,oneHour} retention, else 0d (keep forever) CRD default 0d (compact); Thanos recommends no retention, or the same retention for every resolution (Thanos compact docs, downsampling note)
ThanosCompact resourceRequirements requests.cpu = compactConfig.compactConcurrency, else 1 “give --compact.concurrency amount of CPU cores” (Thanos compact docs); the operator passes compactConcurrency as that flag (builder), whose default is 1 (flags). Only set when resource_requirements is absent.
ThanosQuery, ThanosRuler, ThanosStore replicas 1 CRD default (query, ruler, store)
ThanosReceive routerSpec.{replicas,replicationFactor,externalLabels} 1, 1, {receive: "true"} CRD default (receive)
ThanosReceive each hashring’s replicas, externalLabels, tsdbConfig.retention 1, {replica: $(POD_NAME)}, 2h CRD default (receive, TSDB)
ThanosRuler ruleConfigSelector {matchLabels: {operator.thanos.io/prometheus-rule: "true"}} CRD default (ruler)
ThanosRuler rulerMode.type, and in Stateful mode stateful.{retention,externalLabels} Stateful, 2h, {rule_replica: $(NAME)} CRD default (ruler)
ThanosStore shardingStrategy.type block CRD default (store)

The Thanos documentation is the one for v0.42.0, the version the operator deploys by default (options). No other component gets resource requests; neither the operator nor the Thanos docs give sizing values for them. The receive replication factor stays at the CRD default 1, since the Thanos docs give no recommended value; with replicationFactor 3 or 5 every hashring needs at least that many replicas to reach the write quorum (Thanos receive docs). Fields without a default (storage.size, ThanosRuler alertmanagerURL, ThanosReceive hashrings) stay required in the inventory.

Example

parameters:
  generators:
    thanos:
      namespace: monitoring
      object_storage_config: thanos-object-storage
      thanos_queries:
        global:
          replicas: 2
          query_frontend:
            replicas: 2
            logQueriesLongerThan: 10s
      thanos_receives:
        ingest:
          router_spec:
            replicas: 3
            replicationFactor: 3
          ingester_spec:
            hashrings:
              - name: default
                replicas: 3
                storage:
                  size: 10Gi
      thanos_rulers:
        rules:
          alertmanager_url: http://alertmanager.monitoring.svc:9093
          storage:
            size: 1Gi
      thanos_stores:
        gateway:
          replicas: 2
          storage:
            size: 10Gi
      thanos_compacts:
        compactor:
          retention: 1y
          storage:
            size: 50Gi

Every kind reads its object storage from the Secret thanos-object-storage, key thanos.yaml; the query deduplicates on the replica labels of Prometheus, the ingesters and the ruler; the compactor keeps every resolution for one year and requests one CPU.

Versions

Add a version's inventory entry, then compile with the consumer workflow, which verifies the artifact and runs Kapitan in the sandbox.

Free of charge, as is and on a best-effort basis: use at your own risk, and review the compiled output before you apply it. Terms

This catalog was built from index serial 47. Set index_serial: 47 in .kapitan-sandbox.yaml and the consumer workflow refuses any older index, so a rolled-back index cannot bring back a yanked version.

Checks find known patterns; they do not prove a generator safe. What a listing covers

VersionBuilt for (schema-checked)
1.0.2Thanos Operator main@1b6edfb
1.0.1Thanos Operator main@1b6edfb
1.0.0Thanos Operator main@1b6edfb
1.0.2

Inventory

parameters:
  kapitan:
    dependencies:
      - type: oci
        source: ghcr.io/kadet-hub/thanos:1.0.2@sha256:b9c7f815e231172d8c496a497f33736856ee5514ab357a344cdd0cc0874c8ea6
        output_path: lib/thanos

Verify

gh attestation verify \
  oci://ghcr.io/kadet-hub/thanos@sha256:b9c7f815e231172d8c496a497f33736856ee5514ab357a344cdd0cc0874c8ea6 \
  --owner kadet-hub \
  --cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main

Transparency log: Rekor entry 3250470724, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.

Kapitan declared
>=0.36.3,<0.37
Kapitan checked
0.36.3
Backends checked
not recorded
With --cache
not recorded
krab
compatible
Built for (schema-checked)
Thanos Operator main@1b6edfb
Source
thanos-v1.0.2 · e4891e8fd85ca0a19ebf361e8b54fd6473fd8a2f · thanos
Binaries
none
Output capabilities
none
Digest
sha256:b9c7f815e231172d8c496a497f33736856ee5514ab357a344cdd0cc0874c8ea6

Checks

Checked by the release run on , gate at daf634a691aa.

  • Secrets gitleaks 8.30.1
    No secret matched the marketplace's gitleaks rules.
  • Malware ClamAV 1.5.4
    No file matched a ClamAV signature.
  • Malicious package heuristics GuardDog 3.2.0
    No GuardDog threat rule matched.
  • Dangerous code Semgrep 1.180.0
    No marketplace Semgrep rule matched, such as eval, subprocess or network calls.
  • Python errors Ruff 0.17.0
    No syntax error or undefined name (Ruff, error rules only).
  • File tree tree_check.py
    No symlink, executable or banned file; imports within the allowlist.
  • Sandboxed compile gVisor 20261005, Kapitan 0.36.3
    The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read.
  • Output capabilities Conftest 0.71.1
    The compiled output uses only the capabilities the manifest declares.
  • CI detection Kapitan 0.36.3
    The output is the same with CI variables set.

SBOM (SPDX 2.3)

Output diff

No output diff recorded: this version was published before the release run recorded one.

1.0.1

Inventory

parameters:
  kapitan:
    dependencies:
      - type: oci
        source: ghcr.io/kadet-hub/thanos:1.0.1@sha256:7f71e733d2a1d08c8c07d8bf7175d844e26d5d6ccf5eeac758c687b516dc7dd1
        output_path: lib/thanos

Verify

gh attestation verify \
  oci://ghcr.io/kadet-hub/thanos@sha256:7f71e733d2a1d08c8c07d8bf7175d844e26d5d6ccf5eeac758c687b516dc7dd1 \
  --owner kadet-hub \
  --cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main

Transparency log: Rekor entry 3244179001, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.

Kapitan declared
>=0.36.3,<0.37
Kapitan checked
0.36.3
Backends checked
not recorded
With --cache
not recorded
krab
compatible
Built for (schema-checked)
Thanos Operator main@1b6edfb
Source
thanos-v1.0.1 · 9166cb30e0ae4874bc8f229c6a6823eff7451d04 · thanos
Binaries
none
Output capabilities
none
Digest
sha256:7f71e733d2a1d08c8c07d8bf7175d844e26d5d6ccf5eeac758c687b516dc7dd1

Checks

Checked by the release run on , gate at 529dab245f19.

  • Secrets gitleaks 8.30.1
    No secret matched the marketplace's gitleaks rules.
  • Malware ClamAV 1.5.4
    No file matched a ClamAV signature.
  • Malicious package heuristics GuardDog 3.2.0
    No GuardDog threat rule matched.
  • Dangerous code Semgrep 1.180.0
    No marketplace Semgrep rule matched, such as eval, subprocess or network calls.
  • Python errors Ruff 0.17.0
    No syntax error or undefined name (Ruff, error rules only).
  • File tree tree_check.py
    No symlink, executable or banned file; imports within the allowlist.
  • Sandboxed compile gVisor 20261005, Kapitan 0.36.3
    The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read.
  • Output capabilities Conftest 0.71.1
    The compiled output uses only the capabilities the manifest declares.
  • CI detection Kapitan 0.36.3
    The output is the same with CI variables set.

SBOM (SPDX 2.3)

Output diff

No output diff recorded: this version was published before the release run recorded one.

1.0.0

Inventory

parameters:
  kapitan:
    dependencies:
      - type: oci
        source: ghcr.io/kadet-hub/thanos:1.0.0@sha256:587d1dd7688e806e38da23b74db290aef39c4a5e96cfb6314f3f3ca38cc4cf5e
        output_path: lib/thanos

Verify

gh attestation verify \
  oci://ghcr.io/kadet-hub/thanos@sha256:587d1dd7688e806e38da23b74db290aef39c4a5e96cfb6314f3f3ca38cc4cf5e \
  --owner kadet-hub \
  --cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main

Transparency log: Rekor entry 3210093370, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.

Kapitan declared
>=0.36.3,<0.37
Kapitan checked
0.36.3
Backends checked
not recorded
With --cache
not recorded
krab
compatible
Built for (schema-checked)
Thanos Operator main@1b6edfb
Source
thanos-v1.0.0 · cd660d06c2e97a2bc842f0e75475f639a82f128d · thanos
Binaries
none
Output capabilities
none
Digest
sha256:587d1dd7688e806e38da23b74db290aef39c4a5e96cfb6314f3f3ca38cc4cf5e

Checks

Checked by the release run on , gate at a6abb26ac69c.

  • Secrets gitleaks 8.30.1
    No secret matched the marketplace's gitleaks rules.
  • Malware ClamAV 1.5.4
    No file matched a ClamAV signature.
  • Malicious package heuristics GuardDog 3.2.0
    No GuardDog threat rule matched.
  • Dangerous code Semgrep 1.180.0
    No marketplace Semgrep rule matched, such as eval, subprocess or network calls.
  • Python errors Ruff 0.17.0
    No syntax error or undefined name (Ruff, error rules only).
  • File tree tree_check.py
    No symlink, executable or banned file; imports within the allowlist.
  • Sandboxed compile gVisor 20261005, Kapitan 0.36.3
    The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read.
  • Output capabilities Conftest 0.71.1
    The compiled output uses only the capabilities the manifest declares.
  • CI detection Kapitan 0.36.3
    The output is the same with CI variables set.

SBOM (SPDX 2.3)

Output diff

No output diff recorded: this version was published before the release run recorded one.