Skip to content

Commit

Permalink
fix: Explicitly set KATIB_DB_MANAGER_SERVICE_PORT (#192)
Browse files Browse the repository at this point in the history
* fix: Explicitly set `KATIB_DB_MANAGER_SERVICE_PORT` in katib-controller
* katib-db-manager: Remove port config option

Closes canonical/bundle-kubeflow#893, #108
Addressed also part of #184
  • Loading branch information
orfeas-k authored Jun 13, 2024
1 parent 7ff9e1b commit f401c7a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 7 additions & 1 deletion charms/katib-controller/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,13 @@ def set_pod_spec(self, event):
"containerPort": self.model.config["metrics-port"],
},
],
"envConfig": {"KATIB_CORE_NAMESPACE": self.model.name},
"envConfig": {
"KATIB_CORE_NAMESPACE": self.model.name,
# We hardcode the envvar's value due to
# https://github.com/canonical/katib-operators/issues/108
# Its value comes from `SERVICE_PORT` constant of katib-db-manager charm
"KATIB_DB_MANAGER_SERVICE_PORT": "6789",
},
"volumeConfig": [
{
"name": "certs",
Expand Down
5 changes: 0 additions & 5 deletions charms/katib-db-manager/config.yaml

This file was deleted.

6 changes: 4 additions & 2 deletions charms/katib-db-manager/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
]
MYSQL_WARNING = "Relation mysql is deprecated."
UNBLOCK_MESSAGE = "Remove deprecated mysql relation to unblock."
# Value is hardcoded in upstream
# https://github.com/kubeflow/katib/blob/release-0.16/cmd/db-manager/v1beta1/main.go#L38
SERVICE_PORT = "6789"


class KatibDBManagerOperator(CharmBase):
Expand All @@ -37,7 +40,6 @@ def __init__(self, framework):
self._database_name = "katib"
self._container = self.unit.get_container(self._container_name)
self._exec_command = "./katib-db-manager"
self._port = self.model.config["port"]
self._lightkube_field_manager = "lightkube"
self._namespace = self.model.name
self._name = self.model.app.name
Expand Down Expand Up @@ -76,7 +78,7 @@ def __init__(self, framework):
self.framework.observe(self.database.on.database_created, self._on_relational_db_relation)
self.framework.observe(self.database.on.endpoints_changed, self._on_relational_db_relation)

port = ServicePort(int(self._port), name="api")
port = ServicePort(int(SERVICE_PORT), name="api")
self.service_patcher = KubernetesServicePatch(
self,
[port],
Expand Down

0 comments on commit f401c7a

Please sign in to comment.