Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions ocp_resources/open_telemetry_collector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md


from typing import Any
from ocp_resources.resource import NamespacedResource
from ocp_resources.exceptions import MissingRequiredArgumentError
Comment thread
myakove marked this conversation as resolved.


class OpenTelemetryCollector(NamespacedResource):
"""
OpenTelemetryCollector is the Schema for the opentelemetrycollectors API
"""

api_group: str = NamespacedResource.ApiGroup.OPENTELEMETRY_IO

def __init__(
self,
config: dict[str, Any] | None = None,
management_state: str | None = None,
mode: str | None = None,
replicas: int | None = None,
resources: dict[str, Any] | None = None,
**kwargs: Any,
) -> None:
"""
Args:
config (dict[str, Any]): Required. Collector pipeline configuration.

management_state (str): Required. Usually "Managed".

mode (str): Deployment mode ("deployment", "daemonset", "sidecar").

replicas (int): Number of collector replicas (when mode=deployment).

resources (dict[str, Any]): Resource requests/limits.
"""
super().__init__(**kwargs)

self.config = config
self.management_state = management_state
self.mode = mode
self.replicas = replicas
self.resources = resources

def to_dict(self) -> None:
super().to_dict()

if not self.kind_dict and not self.yaml_file:
if self.config is None:
raise MissingRequiredArgumentError(argument="self.config")

if self.management_state is None:
raise MissingRequiredArgumentError(argument="self.management_state")

self.res["spec"] = {}
_spec = self.res["spec"]

_spec["config"] = self.config
_spec["managementState"] = self.management_state

if self.mode is not None:
_spec["mode"] = self.mode

if self.replicas is not None:
_spec["replicas"] = self.replicas

if self.resources is not None:
_spec["resources"] = self.resources

Comment thread
myakove marked this conversation as resolved.
# End of generated code
1 change: 1 addition & 0 deletions ocp_resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ class ApiGroup:
NODEMAINTENANCE_KUBEVIRT_IO: str = "nodemaintenance.kubevirt.io"
OBSERVABILITY_OPEN_CLUSTER_MANAGEMENT_IO: str = "observability.open-cluster-management.io"
OCS_OPENSHIFT_IO: str = "ocs.openshift.io"
OPENTELEMETRY_IO: str = "opentelemetry.io"
OPERATOR_AUTHORINO_KUADRANT_IO: str = "operator.authorino.kuadrant.io"
OPERATOR_OPEN_CLUSTER_MANAGEMENT_IO: str = "operator.open-cluster-management.io"
OPERATOR_OPENSHIFT_IO: str = "operator.openshift.io"
Expand Down