diff --git a/addons/tempo/role/defaults/main.yml b/addons/tempo/role/defaults/main.yml index ae32c0f..f84aaaa 100644 --- a/addons/tempo/role/defaults/main.yml +++ b/addons/tempo/role/defaults/main.yml @@ -18,6 +18,13 @@ tempo_receivers_otlp_enabled: true tempo_receivers_jaeger_enabled: true tempo_receivers_zipkin_enabled: false +# Ingress +tempo_ingress_enabled: false +tempo_ingress_host: "tempo.local" +tempo_ingress_class: "{{ ingress_nginx_class_name | default('nginx') }}" +tempo_ingress_tls: false +tempo_ingress_cert_issuer: "{{ cert_manager_default_issuer_name | default('letsencrypt-prod') }}" + # Метрики tempo_metrics_enabled: true # ServiceMonitor создаётся только когда addon_prometheus_stack: true diff --git a/addons/tempo/role/tasks/main.yml b/addons/tempo/role/tasks/main.yml index 92843cf..d112093 100644 --- a/addons/tempo/role/tasks/main.yml +++ b/addons/tempo/role/tasks/main.yml @@ -6,6 +6,12 @@ environment: KUBECONFIG: "{{ k3s_kubeconfig_path }}" +- name: Template Tempo values + ansible.builtin.template: + src: tempo-values.yaml.j2 + dest: /tmp/tempo-values.yaml + mode: '0644' + - name: Install Tempo via Helm kubernetes.core.helm: name: tempo @@ -15,58 +21,8 @@ create_namespace: true wait: true timeout: "5m0s" - values: - tempo: - retention: "{{ tempo_retention_period }}" - - receivers: -{% if tempo_receivers_otlp_enabled %} - otlp: - protocols: - grpc: - endpoint: "0.0.0.0:4317" - http: - endpoint: "0.0.0.0:4318" -{% endif %} -{% if tempo_receivers_jaeger_enabled %} - jaeger: - protocols: - thrift_http: - endpoint: "0.0.0.0:14268" - grpc: - endpoint: "0.0.0.0:14250" -{% endif %} -{% if tempo_receivers_zipkin_enabled %} - zipkin: - endpoint: "0.0.0.0:9411" -{% endif %} - - persistence: - enabled: true - accessModes: - - ReadWriteOnce - size: "{{ tempo_storage_size }}" -{% if tempo_storage_class %} - storageClassName: "{{ tempo_storage_class }}" -{% endif %} - - tolerations: - - key: "node-role.kubernetes.io/control-plane" - operator: "Exists" - effect: "NoSchedule" - - resources: - requests: - cpu: "{{ tempo_resources.requests.cpu }}" - memory: "{{ tempo_resources.requests.memory }}" - limits: - cpu: "{{ tempo_resources.limits.cpu }}" - memory: "{{ tempo_resources.limits.memory }}" - - serviceMonitor: - enabled: "{{ tempo_metrics_enabled | bool and addon_prometheus_stack | default(false) | bool }}" - additionalLabels: - release: kube-prometheus-stack + values_files: + - /tmp/tempo-values.yaml environment: KUBECONFIG: "{{ k3s_kubeconfig_path }}" @@ -98,5 +54,5 @@ - "{% if tempo_receivers_otlp_enabled %}OTLP gRPC: tempo.{{ tempo_namespace }}.svc.cluster.local:4317{% endif %}" - "{% if tempo_receivers_otlp_enabled %}OTLP HTTP: tempo.{{ tempo_namespace }}.svc.cluster.local:4318{% endif %}" - "{% if tempo_receivers_jaeger_enabled %}Jaeger HTTP: tempo.{{ tempo_namespace }}.svc.cluster.local:14268{% endif %}" + - "{% if tempo_ingress_enabled %}UI/API: http{{ 's' if tempo_ingress_tls else '' }}://{{ tempo_ingress_host }}{% else %}Port-forward: kubectl port-forward svc/tempo -n {{ tempo_namespace }} 3200:3200{% endif %}" - "{% if addon_prometheus_stack | default(false) | bool %}Datasource 'Tempo' добавлен в Grafana автоматически{% else %}Добавь datasource в Grafana: тип Tempo, URL http://tempo.{{ tempo_namespace }}.svc.cluster.local:3200{% endif %}" - - "Отправляй трейсы из приложений через OTLP на tempo.{{ tempo_namespace }}.svc.cluster.local:4317" diff --git a/addons/tempo/role/templates/tempo-values.yaml.j2 b/addons/tempo/role/templates/tempo-values.yaml.j2 new file mode 100644 index 0000000..e59374d --- /dev/null +++ b/addons/tempo/role/templates/tempo-values.yaml.j2 @@ -0,0 +1,72 @@ +## Tempo Helm values — Ansible managed + +tempo: + retention: "{{ tempo_retention_period }}" + + receivers: +{% if tempo_receivers_otlp_enabled %} + otlp: + protocols: + grpc: + endpoint: "0.0.0.0:4317" + http: + endpoint: "0.0.0.0:4318" +{% endif %} +{% if tempo_receivers_jaeger_enabled %} + jaeger: + protocols: + thrift_http: + endpoint: "0.0.0.0:14268" + grpc: + endpoint: "0.0.0.0:14250" +{% endif %} +{% if tempo_receivers_zipkin_enabled %} + zipkin: + endpoint: "0.0.0.0:9411" +{% endif %} + +persistence: + enabled: true + accessModes: + - ReadWriteOnce + size: "{{ tempo_storage_size }}" +{% if tempo_storage_class %} + storageClassName: "{{ tempo_storage_class }}" +{% endif %} + +tolerations: + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" + effect: "NoSchedule" + +resources: + requests: + cpu: "{{ tempo_resources.requests.cpu }}" + memory: "{{ tempo_resources.requests.memory }}" + limits: + cpu: "{{ tempo_resources.limits.cpu }}" + memory: "{{ tempo_resources.limits.memory }}" + +serviceMonitor: + enabled: {{ (tempo_metrics_enabled | bool and addon_prometheus_stack | default(false) | bool) | lower }} + additionalLabels: + release: kube-prometheus-stack + +ingress: + enabled: {{ tempo_ingress_enabled | lower }} +{% if tempo_ingress_enabled %} + ingressClassName: "{{ tempo_ingress_class }}" + hosts: + - host: "{{ tempo_ingress_host }}" + paths: + - path: / + pathType: Prefix +{% if tempo_ingress_tls %} + tls: + - secretName: tempo-tls + hosts: + - "{{ tempo_ingress_host }}" + annotations: + cert-manager.io/cluster-issuer: "{{ tempo_ingress_cert_issuer }}" +{% endif %} +{% endif %}