k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/config/prow/cluster/monitoring/mixins/lib/config_util.libsonnet (about)

     1  {
     2    local default(obj, field, value)= {[field]: if field in obj then obj[field] else value},
     3  
     4    consts+:: {
     5      // Grafana dashboard IDs are necessary for stable links for dashboards
     6      grafanaDashboardIDs: {
     7        'boskos-http.json': 'eec46c579cbf4a518e5bbcbbf4913de9',
     8        'ghproxy.json': 'd72fe8d0400b2912e319b1e95d0ab1b3',
     9        'slo.json': 'ea313af4b7904c7c983d20d9572235a5',
    10      },
    11      // Component name constants
    12      components: {
    13        // Values should be lowercase for use with prometheus 'job' label.
    14        crier: 'crier',
    15        deck: 'deck',
    16        ghproxy: 'ghproxy',
    17        hook: 'hook',
    18        horologium: 'horologium',
    19        monitoring: 'monitoring', // Aggregate of prometheus, alertmanager, and grafana.
    20        plank: 'plank', // Mutually exclusive with prowControllerManager
    21        prowControllerManager: 'prow-controller-manager',
    22        sinker: 'sinker',
    23        tide: 'tide',
    24      },
    25    },
    26  
    27    defaultConfig(config): (
    28      self.consts +
    29      config +
    30      // Add defaulting logic to the struct below by using '+:' to deeply override fields.
    31      {
    32        instance+: default(config.instance, 'botName', '(Prow bot name)')
    33          + {
    34            monitoringLink(path, text): (
    35              if 'monitoringURL' in config.instance then
    36                '<%s%s|%s>' % [config.instance.monitoringURL, path, text]
    37              else
    38                '%s (Requires <https://github.com/kubernetes/test-infra/tree/master/config/prow/cluster/monitoring#access-components-web-page|port-forwarding the grafana service> and accessing path "%s")' % [text, path]
    39            ),
    40          },
    41        prowImageStaleByDays+: default(config.prowImageStaleByDays, 'daysStale', 7)
    42          + default(config.prowImageStaleByDays, 'eventDuration', '24h'),
    43      }
    44    ),
    45  }