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

Feature request - Allow AnnotationsTobeSkipped to be configurable #1525

Open
nidhik opened this issue Oct 10, 2024 · 3 comments
Open

Feature request - Allow AnnotationsTobeSkipped to be configurable #1525

nidhik opened this issue Oct 10, 2024 · 3 comments

Comments

@nidhik
Copy link

nidhik commented Oct 10, 2024

We use internal tooling to update the ClickHouseInstallation when we would like to kick off a reconcile task. This internal tooling inserts a number of custom build annotations into the resource for internal tracking purposes which includes unique hashes and timestamps.

An unfortunate consequence of this is that a new prometheus series is created by the exporter for each reconcile that the operator initiates since these annotations are read by the exporter from the CHI and added as prometheus labels:

func getLabelsFromAnnotations(chi BaseInfoGetter) (labels []string, values []string) {

Digging deeper, looks like some annotations can be skipped but this is currently a hardcoded list:

var AnnotationsTobeSkipped = []string{

We would appreciate the ability to configure custom annotations to ignore.

@chengjoey
Copy link
Contributor

/assign

@chengjoey
Copy link
Contributor

hi @nidhik ,try modify etc-clickhouse-operator-files configmap, and add excludeFromPropagationAnnotations,
like this:

apiVersion: v1
data:
  config.yaml: |
    excludeFromPropagationAnnotations: ["skipped-a", "skipped-b"]

this should help

@stephenmcrowe
Copy link

Hello! I work with @nidhik.

Unfortunately that does not seem to solve our problem as it only ignores propagating annotations to the Kubernetes resources. The annotations are still scraped as part of the ClickHouse operator metrics.

Although I add
################################################
##
## Annotations management section
##
################################################
annotation:
  # Applied when:
  #  1. Propagating annotations from the CHI's `metadata.annotations` to child objects' `metadata.annotations`,
  #  2. Propagating annotations from the CHI Template's `metadata.annotations` to CHI's `metadata.annotations`,
  # Include annotations from the following list:
  # Applied only when not empty. Empty list means "include all, no selection"
  include: []
  # Exclude annotations from the following list:
  exclude: [mux.com/styri-bazel-label,
          mux.com/styri-bazel-short-label,
          mux.com/styri-build-host,
          mux.com/styri-build-timestamp,
          mux.com/styri-build-user,
          mux.com/styri-buildkite,
          mux.com/styri-git-branch,
          mux.com/styri-git-commit,
          mux.com/styri-git-timestamp,
          mux.com/styri-update-timestamp,
          mux.com/styri-version
          ]

I also tried with excludeFromPropagationAnnotations. annotation.exclude seems equivalent.

Resulting kubernetes resources
kubectl describe chi realtime-secon-install
Name:         realtime-secon-install
Namespace:    aws-us-east-1-dos1
Labels:       app=realtime-secon
              mux.com/ch=realtime-secon
Annotations:  mux.com/styri-argo: false
              mux.com/styri-bazel-label: @//data/servers/ch-realtime-operator/secon:secon_styri.aws-us-east-1-dos1.update
              mux.com/styri-bazel-short-label: @//data/servers/ch-realtime-operator/secon:secon_styri
              mux.com/styri-build-host: stephens-mbp.lan
              mux.com/styri-build-timestamp: 2024-10-10 14:33:27 -0700
              mux.com/styri-build-user: scrowe
              mux.com/styri-buildkite: false
              mux.com/styri-git-branch: master
              mux.com/styri-git-commit: f6828cacdd8a2447a16d11199c3ffae7a47969ae
              mux.com/styri-git-timestamp: 2024-10-10 18:01:00 +0000
              mux.com/styri-update-timestamp: 2024-10-10 14:33:31 -0700
              mux.com/styri-version: 1728583260-local-f6828cacdd
API Version:  clickhouse.altinity.com/v1
Kind:         ClickHouseInstallation
...
k describe pod ch-realtime-secon-0-0-0
Name:             ch-realtime-secon-0-0-0
Namespace:        aws-us-east-1-dos1
Priority:         0
Service Account:  default
Node:             redacted
Start Time:       Tue, 15 Oct 2024 10:15:18 -0700
Labels:           app=realtime-secon
                  clickhouse.altinity.com/app=chop
                  clickhouse.altinity.com/chi=realtime-secon-install
                  clickhouse.altinity.com/cluster=realtime-secon
                  clickhouse.altinity.com/namespace=aws-us-east-1-dos1
                  clickhouse.altinity.com/ready=yes
                  clickhouse.altinity.com/replica=0
                  clickhouse.altinity.com/shard=0
                  controller-revision-hash=ch-realtime-secon-0-0-594b868f5b
                  mux.com/ch=realtime-secon
                  statefulset.kubernetes.io/pod-name=ch-realtime-secon-0-0-0
Annotations:      mux.com/styri-argo: false
Status:           Running
...
Snippet of scraped clickhouse operator metrics
# HELP clickhouse_operator_chi_reconciles_completed number of CHI reconciles completed successfully
# TYPE clickhouse_operator_chi_reconciles_completed counter
clickhouse_operator_chi_reconciles_completed{app="realtime-secon",chi="realtime-secon-install",mux_com_ch="realtime-secon",mux_com_styri_argo="false",mux_com_styri_bazel_label="@//data/servers/ch-realtime-operator/secon:secon_styri.aws-us-east-1-dos1.update",mux_com_styri_bazel_short_label="@//data/servers/ch-realtime-operator/secon:secon_styri",mux_com_styri_build_host="stephens-mbp.lan",mux_com_styri_build_timestamp="2024-10-10 14:33:27 -0700",mux_com_styri_build_user="scrowe",mux_com_styri_buildkite="false",mux_com_styri_git_branch="master",mux_com_styri_git_commit="f6828cacdd8a2447a16d11199c3ffae7a47969ae",mux_com_styri_git_timestamp="2024-10-10 18:01:00 +0000",mux_com_styri_update_timestamp="2024-10-10 14:33:31 -0700",mux_com_styri_version="1728583260-local-f6828cacdd",namespace="aws-us-east-1-dos1"} 1
# HELP clickhouse_operator_chi_reconciles_started number of CHI reconciles started
# TYPE clickhouse_operator_chi_reconciles_started counter
clickhouse_operator_chi_reconciles_started{app="realtime-secon",chi="realtime-secon-install",mux_com_ch="realtime-secon",mux_com_styri_argo="false",mux_com_styri_bazel_label="@//data/servers/ch-realtime-operator/secon:secon_styri.aws-us-east-1-dos1.update",mux_com_styri_bazel_short_label="@//data/servers/ch-realtime-operator/secon:secon_styri",mux_com_styri_build_host="stephens-mbp.lan",mux_com_styri_build_timestamp="2024-10-10 14:33:27 -0700",mux_com_styri_build_user="scrowe",mux_com_styri_buildkite="false",mux_com_styri_git_branch="master",mux_com_styri_git_commit="f6828cacdd8a2447a16d11199c3ffae7a47969ae",mux_com_styri_git_timestamp="2024-10-10 18:01:00 +0000",mux_com_styri_update_timestamp="2024-10-10 14:33:31 -0700",mux_com_styri_version="1728583260-local-f6828cacdd",namespace="aws-us-east-1-dos1"} 1

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

3 participants