Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HomayoonAlimohammadi committed Jan 6, 2025
1 parent 071cac9 commit 80f1c60
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions charms/worker/k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ def _assemble_bootstrap_config(self):

@on_error(ops.WaitingStatus("Waiting for external load balancer"), ReconcilerError)
def _configure_external_load_balancer(self):
"""
Configure the external load balancer for the application.
"""Configure the external load balancer for the application.
This method checks if the external load balancer is available and then
proceeds to configure it by sending a request with the necessary parameters.
Expand Down Expand Up @@ -1137,14 +1136,14 @@ def _get_external_kubeconfig(self, event: ops.ActionEvent):
if self.is_control_plane and self.external_load_balancer.is_available:
log.info("Using external load balancer port as the public port")
port = str(self.config.get(EXTERNAL_LOAD_BALANCER_PORT_CONFIG))
server = self._format_kube_api_url(server, port)
server = self._format_kube_api_url(server, port)
log.info(f"Formatted server address: {server}")
log.info("Requesting kubeconfig for server=%s", server)
resp = self.api_manager.get_kubeconfig(server)
event.set_results({"kubeconfig": resp})
except (InvalidResponseError, K8sdConnectionError) as e:
event.fail(f"Failed to retrieve kubeconfig: {e}")

def _get_public_address(self) -> Optional[str]:
"""Get public address either from external load balancer or from juju.
Expand Down Expand Up @@ -1181,8 +1180,7 @@ def _get_external_load_balancer_address(self) -> Optional[str]:
return response.address

def _format_kube_api_url(self, addr: str, port: str) -> str:
"""
Format the given Kubernetes API address to ensure it includes the protocol and port.
"""Format the given Kubernetes API address to ensure it includes the protocol and port.
Args:
addr (str): The Kubernetes API address.
Expand All @@ -1201,5 +1199,6 @@ def _format_kube_api_url(self, addr: str, port: str) -> str:
addr = f"{addr}:{port}"
return addr


if __name__ == "__main__": # pragma: nocover
ops.main(K8sCharm)

0 comments on commit 80f1c60

Please sign in to comment.