github.com/verrazzano/verrazzano@v1.7.0/platform-operator/helm_config/charts/verrazzano-application-operator/templates/metricstemplate.yaml (about)

     1  # Copyright (c) 2020, 2022, Oracle and/or its affiliates.
     2  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  ---
     4  apiVersion: app.verrazzano.io/v1alpha1
     5  kind: MetricsTemplate
     6  metadata:
     7    name: standard-k8s-metrics-template
     8    namespace: {{ .Values.namespace }}
     9  spec:
    10    workloadSelector:
    11      apiGroups: ["apps", ""]
    12      apiVersions: ["v1"]
    13      resources: ["deployment", "statefulset", "replicaset", "pod"]
    14    prometheusConfig:
    15      targetConfigMap:
    16        namespace: {{ .Values.namespace }}
    17        name: vmi-system-prometheus-config
    18      scrapeConfigTemplate: |
    19        kubernetes_sd_configs:
    20          - namespaces:
    21              names:
    22              - {{`{{.workload.metadata.namespace}}`}}
    23            role: pod
    24        relabel_configs:
    25          - action: replace
    26            replacement: local
    27            source_labels: null
    28            target_label: verrazzano_cluster
    29          - action: keep
    30            regex: {{`{{index .workload.metadata.labels "app.verrazzano.io/workload"}}`}};true
    31            source_labels:
    32              - __meta_kubernetes_pod_label_app_verrazzano_io_workload
    33              - __meta_kubernetes_pod_annotation_prometheus_io_scrape
    34          - action: replace
    35            regex: ([^:]+)(?::\d+)?;(\d+)
    36            replacement: $1:$2
    37            source_labels:
    38              - __address__
    39              - __meta_kubernetes_pod_annotation_prometheus_io_port
    40            target_label: __address__
    41          - action: replace
    42            regex: (.*)
    43            source_labels:
    44              - __meta_kubernetes_pod_annotation_prometheus_io_path
    45            target_label: __metrics_path__
    46          - action: replace
    47            regex: (.*)
    48            replacement: $1
    49            source_labels:
    50              - __meta_kubernetes_namespace
    51            target_label: namespace
    52          - action: labelmap
    53            regex: __meta_kubernetes_pod_label_(.+)
    54          - action: replace
    55            source_labels:
    56              - __meta_kubernetes_pod_name
    57            target_label: pod_name
    58          - action: labeldrop
    59            regex: (controller_revision_hash)
    60          - action: replace
    61            regex: .*/(.*)$
    62            replacement: $1
    63            source_labels:
    64              - name
    65            target_label: webapp
    66        {{`{{ if index .namespace.metadata.labels "istio-injection" }}`}}
    67        {{`{{ if eq (index .namespace.metadata.labels "istio-injection" ) "enabled" }}`}}
    68        scheme: https
    69        tls_config:
    70          ca_file: /etc/istio-certs/root-cert.pem
    71          cert_file: /etc/istio-certs/cert-chain.pem
    72          insecure_skip_verify: true
    73          key_file: /etc/istio-certs/key.pem
    74        {{`{{ end }}`}}
    75        {{`{{ end }}`}}