Observability Libs

  • Jon Seager
Channel Revision Published Runs on
latest/edge 53 13 Dec 2024
Ubuntu 20.04
juju deploy observability-libs --channel edge
Show information

Platform:

charms.observability_libs.v1.kubernetes_service_patch

[DEPRECATED!] KubernetesServicePatch Library.

The kubernetes_service_patch library is DEPRECATED and will be removed in October 2025.

For patching the Kubernetes service created by Juju during the deployment of a charm, ops.Unit.set_ports functionality should be used instead.


class KubernetesServicePatch

Description

A utility for patching the Kubernetes service set up by Juju. None

Methods

KubernetesServicePatch. __init__( self , charm: CharmBase , ports , service_name , service_type: ServiceType , additional_labels , additional_selectors , additional_annotations )

Constructor for KubernetesServicePatch.

Arguments

charm

the charm that is instantiating the library.

ports

a list of ServicePorts

service_name

allows setting custom name to the patched service. If none given, application name will be used.

service_type

desired type of K8s service. Default value is in line with ServiceSpec's default value.

additional_labels

Labels to be added to the kubernetes service (by default only "app.kubernetes.io/name" is set to the service name)

additional_selectors

Selectors to be added to the kubernetes service (by default only "app.kubernetes.io/name" is set to the service name)

additional_annotations

Annotations to be added to the kubernetes service.

refresh_event

an optional bound event or list of bound events which will be observed to re-apply the patch (e.g. on port change). The install and upgrade-charm events would be observed regardless.

KubernetesServicePatch. is_patched( self )

Reports if the service patch has been applied.

Returns

bool

A boolean indicating if the service patch has been applied.