Skip to content

Commit

Permalink
Remove external-load-balancer-port config
Browse files Browse the repository at this point in the history
  • Loading branch information
HomayoonAlimohammadi committed Jan 8, 2025
1 parent 3aa9688 commit a809297
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions charms/worker/k8s/charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,6 @@ config:
description: |
Labels can be used to organize and to select subsets of nodes in the
cluster. Declare node labels in key=value format, separated by spaces.
external-load-balancer-port:
description: |
Port exposed by the external load balancer to direct traffic to this charm.
The external load balancer should be related to this charm on the `external-load-balancer` relation.
type: int
default: 443
resources:
snap-installation:
Expand Down
6 changes: 3 additions & 3 deletions charms/worker/k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
ENDPOINT_HAS_PORT_REGEX,
ETC_KUBERNETES,
ETCD_RELATION,
EXTERNAL_LOAD_BALANCER_PORT,
EXTERNAL_LOAD_BALANCER_RELATION,
EXTERNAL_LOAD_BALANCER_PORT_CONFIG,
EXTERNAL_LOAD_BALANCER_REQUEST_NAME,
EXTERNAL_LOAD_BALANCER_RESPONSE_NAME,
HTTP_SCHEME,
Expand Down Expand Up @@ -423,7 +423,7 @@ def _configure_external_load_balancer(self):

req = self.external_load_balancer.get_request(EXTERNAL_LOAD_BALANCER_REQUEST_NAME)
req.protocol = req.protocols.tcp
req.port_mapping = {self.config.get(EXTERNAL_LOAD_BALANCER_PORT_CONFIG): APISERVER_PORT}
req.port_mapping = {EXTERNAL_LOAD_BALANCER_PORT: APISERVER_PORT}
req.public = True
if not req.health_checks:
req.add_health_check(protocol=req.protocols.http, port=APISERVER_PORT, path="/livez")
Expand Down Expand Up @@ -1142,7 +1142,7 @@ def _get_external_kubeconfig(self, event: ops.ActionEvent):
port = str(APISERVER_PORT)
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))
port = str(EXTERNAL_LOAD_BALANCER_PORT)
server = self._format_kube_api_url(server, port)
log.info("Formatted server address: %s", server)
log.info("Requesting kubeconfig for server=%s", server)
Expand Down
2 changes: 1 addition & 1 deletion charms/worker/k8s/src/literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
HTTPS_SCHEME = "https://"
EXTERNAL_LOAD_BALANCER_REQUEST_NAME = "api-server-external"
EXTERNAL_LOAD_BALANCER_RESPONSE_NAME = EXTERNAL_LOAD_BALANCER_REQUEST_NAME
EXTERNAL_LOAD_BALANCER_PORT_CONFIG = "external-load-balancer-port"
EXTERNAL_LOAD_BALANCER_PORT = 443
ENDPOINT_HAS_PORT_REGEX = r":\d+$"
APISERVER_PORT = 6443

Expand Down

0 comments on commit a809297

Please sign in to comment.