k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/pkg/prometheus/manifests/prometheus-prometheus.yaml (about)

     1  {{$PROMETHEUS_SCRAPE_KUBELETS := DefaultParam .PROMETHEUS_SCRAPE_KUBELETS false}}
     2  {{$PROMETHEUS_SCRAPE_WINDOWS_NODES := DefaultParam .PROMETHEUS_SCRAPE_WINDOWS_NODES false}}
     3  {{$PROMETHEUS_CPU_SCALE_FACTOR := DefaultParam .CL2_PROMETHEUS_CPU_SCALE_FACTOR 1}}
     4  {{$PROMETHEUS_MEMORY_LIMIT_FACTOR := DefaultParam .CL2_PROMETHEUS_MEMORY_LIMIT_FACTOR 2}}
     5  {{$PROMETHEUS_MEMORY_SCALE_FACTOR := DefaultParam .CL2_PROMETHEUS_MEMORY_SCALE_FACTOR $PROMETHEUS_MEMORY_LIMIT_FACTOR}}
     6  {{$PROMETHEUS_NODE_SELECTOR := DefaultParam .CL2_PROMETHEUS_NODE_SELECTOR ""}}
     7  {{$PROMETHEUS_TOLERATE_MASTER := DefaultParam .CL2_PROMETHEUS_TOLERATE_MASTER false}}
     8  {{$PROMETHEUS_PVC_ENABLED := DefaultParam .CL2_PROMETHEUS_PVC_ENABLED (not $PROMETHEUS_TOLERATE_MASTER)}}
     9  {{$PROMETHEUS_PVC_STORAGE_CLASS := DefaultParam .PROMETHEUS_PVC_STORAGE_CLASS "ssd"}}
    10  {{$PROMETHEUS_MEMORY_REQUEST := DefaultParam .PROMETHEUS_MEMORY_REQUEST "10Gi"}}
    11  
    12  apiVersion: monitoring.coreos.com/v1
    13  kind: Prometheus
    14  metadata:
    15    labels:
    16      prometheus: k8s
    17    name: k8s
    18    namespace: monitoring
    19  spec:
    20    logLevel: debug
    21    enableAdminAPI: true
    22    baseImage: gcr.io/k8s-testimages/quay.io/prometheus/prometheus
    23    nodeSelector:
    24      kubernetes.io/os: linux
    25      {{StructuralData $PROMETHEUS_NODE_SELECTOR}}
    26    replicas: 1
    27    resources:
    28      requests:
    29        cpu: {{AddInt 200 (MultiplyInt $PROMETHEUS_CPU_SCALE_FACTOR 500 (DivideInt .Nodes 1000))}}m
    30        {{if $PROMETHEUS_SCRAPE_KUBELETS}}
    31        memory: {{$PROMETHEUS_MEMORY_REQUEST}}
    32        {{else}}
    33        # Start with 2Gi and add 2Gi for each 1K nodes.
    34        memory: {{MultiplyInt $PROMETHEUS_MEMORY_SCALE_FACTOR (AddInt 1 (DivideInt .Nodes 1000))}}Gi
    35        {{end}}
    36      limits:
    37        {{if $PROMETHEUS_SCRAPE_KUBELETS}}
    38        memory: 10Gi
    39        {{else}}
    40        # Default: Start with 2Gi and add 2Gi for each 1K nodes.
    41        memory: {{MultiplyInt $PROMETHEUS_MEMORY_SCALE_FACTOR (AddInt 1 (DivideInt .Nodes 1000))}}Gi
    42        {{end}}
    43    ruleSelector:
    44      matchLabels:
    45        prometheus: k8s
    46    securityContext:
    47      fsGroup: 2000
    48      runAsNonRoot: true
    49      runAsUser: 1000
    50    tolerations:
    51    - key: "monitoring"
    52      operator: "Exists"
    53      effect: "NoSchedule"
    54    {{if $PROMETHEUS_TOLERATE_MASTER}}
    55    - key: node-role.kubernetes.io/master
    56      operator: Exists
    57      effect: NoSchedule
    58    - key: node-role.kubernetes.io/control-plane
    59      operator: Exists
    60      effect: NoSchedule
    61    {{end}}
    62    serviceAccountName: prometheus-k8s
    63    serviceMonitorNamespaceSelector: {}
    64    serviceMonitorSelector: {}
    65    podMonitorNamespaceSelector: {}
    66    podMonitorSelector: {}
    67    priorityClassName: prometheus-priorityclass
    68    version: v2.25.0
    69    retention: 7d
    70    {{if $PROMETHEUS_PVC_ENABLED}}
    71    # We add node tolerations for control-plane nodes in Azure Windows test jobs which do not support Google PD
    72    storage:
    73      volumeClaimTemplate:
    74        spec:
    75          storageClassName: {{$PROMETHEUS_PVC_STORAGE_CLASS}}
    76          resources:
    77            requests:
    78              # Start with 10Gi, add 10Gi for each 1K nodes.
    79              storage: {{MultiplyInt 10 (AddInt 1 (DivideInt .Nodes 1000))}}Gi
    80    {{ end }}
    81    query:
    82      maxSamples: 100000000
    83    {{if $PROMETHEUS_SCRAPE_WINDOWS_NODES}}
    84    additionalScrapeConfigs:
    85      name: windows-scrape-configs
    86      key: windows-scrape-configs.yaml
    87    {{end}}