Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: explicitly apply minio-service with name (#151)" #154

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading