Skip to content

Commit

Permalink
chore: update charm libraries (#328)
Browse files Browse the repository at this point in the history
Co-authored-by: Github Actions <[email protected]>
  • Loading branch information
observability-noctua-bot and Github Actions authored Jan 10, 2024
1 parent eab0b76 commit 9e3f1ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def setUp(self, *unused):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 5
LIBPATCH = 6


_Decimal = Union[Decimal, float, str, int] # types that are potentially convertible to Decimal
Expand Down Expand Up @@ -366,7 +366,7 @@ def is_patched(self, resource_reqs: ResourceRequirements) -> bool:
"""
return equals_canonically(self.get_templated(), resource_reqs)

def get_templated(self) -> ResourceRequirements:
def get_templated(self) -> Optional[ResourceRequirements]:
"""Returns the resource limits specified in the StatefulSet template."""
statefulset = self.client.get(
StatefulSet, name=self.statefulset_name, namespace=self.namespace
Expand All @@ -377,7 +377,7 @@ def get_templated(self) -> ResourceRequirements:
)
return podspec_tpl.resources

def get_actual(self, pod_name: str) -> ResourceRequirements:
def get_actual(self, pod_name: str) -> Optional[ResourceRequirements]:
"""Return the resource limits that are in effect for the container in the given pod."""
pod = self.client.get(Pod, name=pod_name, namespace=self.namespace)
podspec = self._get_container(
Expand Down
4 changes: 2 additions & 2 deletions lib/charms/observability_libs/v1/kubernetes_service_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def setUp(self, *unused):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 8
LIBPATCH = 9

ServiceType = Literal["ClusterIP", "LoadBalancer"]

Expand Down Expand Up @@ -314,7 +314,7 @@ def _is_patched(self, client: Client) -> bool:
raise

# Construct a list of expected ports, should the patch be applied
expected_ports = [(p.port, p.targetPort) for p in self.service.spec.ports]
expected_ports = [(p.port, p.targetPort) for p in self.service.spec.ports] # type: ignore[attr-defined]
# Construct a list in the same manner, using the fetched service
fetched_ports = [
(p.port, p.targetPort) for p in service.spec.ports # type: ignore[attr-defined]
Expand Down

0 comments on commit 9e3f1ed

Please sign in to comment.