Skip to content

Commit

Permalink
Revert "fix: explicitly apply minio-service with name (#151)" (#154)
Browse files Browse the repository at this point in the history
* Revert "fix: explicitly apply minio-service with name (#151)"
* feat: add alias for minio service name in charm.py

This reverts commit b99aad8.\
  • Loading branch information
ca-scribner authored Nov 21, 2023
1 parent d5d8e89 commit e1be061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 32 deletions.
33 changes: 4 additions & 29 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
from ops.model import ActiveStatus, BlockedStatus, MaintenanceStatus, WaitingStatus
from serialized_data_interface import NoCompatibleVersions, NoVersionsListed, get_interfaces

# The name of the minio service is hardcoded in the
# object store source code of pipelines as "minio-service"
# See https://github.com/kubeflow/pipelines/issues/9689 for more information
MINIO_SERVICE = "minio-service"


class Operator(CharmBase):
_stored = StoredState()
Expand All @@ -33,6 +28,8 @@ def __init__(self, *args):
# Random salt used for hashing config
self._stored.set_default(hash_salt=_gen_pass())

self._minio_service_name = self.app.name

self.image = OCIImageResource(self, "oci-image")

self.prometheus_provider = MetricsEndpointProvider(
Expand Down Expand Up @@ -126,29 +123,7 @@ def main(self, event):
}.items()
},
},
],
"services": [
{
"name": MINIO_SERVICE,
"spec": {
"selector": {"app.kubernetes.io/name": self.model.app.name},
"ports": [
{
"name": "minio",
"port": int(self.model.config["port"]),
"protocol": "TCP",
"targetPort": int(self.model.config["port"]),
},
{
"name": "console",
"port": int(self.model.config["console-port"]),
"protocol": "TCP",
"targetPort": int(self.model.config["console-port"]),
},
],
},
},
],
]
},
}

Expand Down Expand Up @@ -192,7 +167,7 @@ def _send_info(self, interfaces, secret_key):
"port": self.model.config["port"],
"secret-key": secret_key,
"secure": False,
"service": MINIO_SERVICE,
"service": self._minio_service_name,
}
)

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ops.model import ActiveStatus, BlockedStatus, WaitingStatus
from ops.testing import Harness

from charm import MINIO_SERVICE, Operator
from charm import Operator


@pytest.fixture
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_main_with_relation(harness):
assert data["port"] == 9000
assert data["secure"] is False
assert len(data["secret-key"]) == 30
assert data["service"] == MINIO_SERVICE
assert data["service"] == "minio"


def test_main_with_manual_secret(harness):
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_main_with_manual_secret(harness):
"port": 9000,
"secret-key": "test-key",
"secure": False,
"service": MINIO_SERVICE,
"service": "minio",
}
assert harness.charm.model.unit.status == ActiveStatus("")

Expand Down

0 comments on commit e1be061

Please sign in to comment.