deckhouse / k8s-image-availability-exporter

Alert if an image used in Kubernetes cannot be pulled from container registry
Apache License 2.0
211 stars 25 forks source link

Add ability to customise pod annotations #170

Open artemiyplotnikov opened 2 months ago

artemiyplotnikov commented 2 months ago

Please add ability to customise pod annotations for deployment k8s-image-availability-exporter for example:

  template:
    metadata:
      {{- if .Values.k8sImageAvailabilityExporter.annotations }}
      annotations:
       {{- include .Values.k8sImageAvailabilityExporter.annotations . | nindent 8 }}
nabokihms commented 2 months ago

@artemiyplotnikov sure, but can you elaborate on why you need this? (This is important to know usescases for features).

artemiyplotnikov commented 2 months ago

First of all we use annotations for filtering and configuring scraping options. For example:

      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: "{{ .Values.env.PROMETHEUS_PORT }}"

I know that there is another options to configure Prometheus scrape but it would multiply configuring options and hardenes

now we use patch for deployment to workaround this problem

kubectl patch deployment k8s-image-availability-exporter -p '{"spec": {"template":{"metadata":{"annotations":{"prometheus.io/scrape":"true","prometheus.io/port":"8080" }}}} }'