NAME

IO::K8s::PrometheusOperator - Prometheus Operator CRD resource map provider for IO::K8s

VERSION

version 1.108

SYNOPSIS

my $k8s = IO::K8s->new(with => ['IO::K8s::PrometheusOperator']);

my $prom = $k8s->new_object('Prometheus',
    metadata => { name => 'main', namespace => 'monitoring' },
    spec => {
        serviceAccountName => 'prometheus',
        serviceMonitorSelector => {},
    },
);

print $prom->to_yaml;

DESCRIPTION

Resource map provider for Prometheus Operator Custom Resource Definitions. Registers 7 resource_map entries covering monitoring.coreos.com/v1 (Alertmanager, Prometheus, ServiceMonitor, PodMonitor, Probe, PrometheusRule) and monitoring.coreos.com/v1alpha1 (ScrapeConfig), matching upstream prometheus-operator v0.93.1. All seven Kinds are namespaced.

Every Kind is modeled to full depth: each Kind's spec (and, where upstream declares one, status) is a typed object graph of further IO::K8s::PrometheusOperator::V1::* / ::V1alpha1::* classes, one per upstream Go structure, named after the upstream Go types in github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/{v1,v1alpha1} -- Prometheus's spec is a IO::K8s::PrometheusOperator::V1::PrometheusSpec, whose remoteWrite is an array of IO::K8s::PrometheusOperator::V1::RemoteWriteSpec, and so on down -- rather than an opaque hashref. Embedded core Kubernetes types (Core::V1::Container, Core::V1::Affinity, Meta::V1::LabelSelector, Core::V1::SecretKeySelector, ...) are referenced, not re-modeled.

Upstream defines a number of structures once and embeds the SAME Go type across multiple Kinds and multiple fields within one Kind -- SafeTLSConfig, TLSConfig, BasicAuth, OAuth2, Authorization, SafeAuthorization, RelabelConfig, SecretOrConfigMap, Argument and Sigv4 among them. Each is one shared IO::K8s::PrometheusOperator::V1::* class referenced from every embedding site (verified byte-identical generated schema at every site before sharing), the same pattern IO::K8s::Cilium's Rule uses across CiliumNetworkPolicy/CiliumClusterwideNetworkPolicy -- not a copy per Kind or per field. monitoring.coreos.com/v1alpha1's own ScrapeConfig embeds several of the very same v1 package types (SafeTLSConfig, BasicAuth, OAuth2, SafeAuthorization, RelabelConfig) again across its many service-discovery blocks (KubernetesSDConfig, ConsulSDConfig, DockerSDConfig, ...); those get their own IO::K8s::PrometheusOperator::V1alpha1::* copies rather than reaching across into ::V1::*, matching Cilium's own rule that a Go type is never shared across version directories.

Three upstream types -- Argument (additionalArgs, on Alertmanager, Prometheus and Prometheus's embedded Thanos sidecar spec), ObjectReference (Prometheus's excludedFromEnforcement) and HostPort (Alertmanager's alertmanagerConfiguration.global.smtp.smartHost) -- coincidentally share a JSON key set with an unrelated shipped class (Core::V1::HTTPHeader, GatewayAPI's ParentReference by way of IO::K8s::Api::Networking::V1::ParentReference, and Core::V1::TCPSocketAction respectively) and were hand-written instead of left on IO::K8s::AutoGen's structural reuse match, which does not compare required-ness or the actual upstream type identity -- see IO::K8s::PrometheusOperator::V1::Argument, IO::K8s::PrometheusOperator::V1::ObjectReference and IO::K8s::PrometheusOperator::V1::HostPort.

Not loaded by default -- opt in via the with constructor parameter of IO::K8s or by calling $k8s->add('IO::K8s::PrometheusOperator') at runtime.

Included CRDs (monitoring.coreos.com/v1)

Alertmanager, Prometheus, ServiceMonitor, PodMonitor, Probe, PrometheusRule

Included CRDs (monitoring.coreos.com/v1alpha1)

ScrapeConfig

SEE ALSO

IO::K8s

Prometheus Operator documentation

Prometheus Operator API reference

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/pplu/io-k8s-p5/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHORS

  • Torsten Raudssus <getty@cpan.org>

  • Jose Luis Martinez Torres <jlmartin@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004