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

update kfp-api's apiserver configuration #375

Merged
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
20 changes: 15 additions & 5 deletions charms/kfp-api/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def _generate_environment(self) -> dict:
raise error

env_vars = {
# Configurations that are also defined in the upstream manifests
"AUTO_UPDATE_PIPELINE_DEFAULT_VERSION": self.model.config[
"auto-update-default-version"
],
Expand All @@ -231,11 +232,6 @@ def _generate_environment(self) -> dict:
"POD_NAMESPACE": self.model.name,
"OBJECTSTORECONFIG_SECURE": "false",
"OBJECTSTORECONFIG_BUCKETNAME": self.model.config["object-store-bucket-name"],
"DBCONFIG_USER": db_data["db_username"],
"DBCONFIG_PASSWORD": db_data["db_password"],
"DBCONFIG_DBNAME": db_data["db_name"],
"DBCONFIG_HOST": db_data["db_host"],
"DBCONFIG_PORT": db_data["db_port"],
"DBCONFIG_CONMAXLIFETIME": "120s",
"DB_DRIVER_NAME": "mysql",
"DBCONFIG_MYSQLCONFIG_USER": db_data["db_username"],
Expand All @@ -252,6 +248,20 @@ def _generate_environment(self) -> dict:
"ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_HOST": viz_data["service-name"],
"ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_PORT": viz_data["service-port"],
"CACHE_IMAGE": self.model.config["cache-image"],
# Configurations charmed-kubeflow adds to those of upstream
"ARCHIVE_CONFIG_LOG_FILE_NAME": self.model.config["log-archive-filename"],
"ARCHIVE_CONFIG_LOG_PATH_PREFIX": self.model.config["log-archive-prefix"],
# OBJECTSTORECONFIG_HOST and _PORT set the object storage configurations,
# taking precedence over configuration in the config.json or
# MINIO_SERVICE_SERVICE_* environment variables.
# NOTE: While OBJECTSTORECONFIG_HOST and _PORT control the object store
# that the apiserver connects to, other parts of kfp currently cannot use
# object stores with arbitrary names. See
# https://github.com/kubeflow/pipelines/issues/9689 and
# https://github.com/canonical/minio-operator/pull/151 for more details.
"OBJECTSTORECONFIG_HOST": f"{object_storage['service']}.{object_storage['namespace']}",
"OBJECTSTORECONFIG_PORT": str(object_storage["port"]),
"OBJECTSTORECONFIG_REGION": "",
}

return env_vars
Expand Down
16 changes: 11 additions & 5 deletions charms/kfp-api/tests/unit/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,6 @@ def test_install_with_all_inputs_and_pebble(
"POD_NAMESPACE": harness.charm.model.name,
"OBJECTSTORECONFIG_SECURE": "false",
"OBJECTSTORECONFIG_BUCKETNAME": harness.charm.config["object-store-bucket-name"],
"DBCONFIG_USER": "root",
"DBCONFIG_PASSWORD": mysql_data["root_password"],
"DBCONFIG_DBNAME": mysql_data["database"],
"DBCONFIG_HOST": mysql_data["host"],
"DBCONFIG_PORT": mysql_data["port"],
"DBCONFIG_CONMAXLIFETIME": "120s",
"DB_DRIVER_NAME": "mysql",
"DBCONFIG_MYSQLCONFIG_USER": "root",
Expand All @@ -467,6 +462,17 @@ def test_install_with_all_inputs_and_pebble(
"ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_HOST": kfp_viz_data["service-name"],
"ML_PIPELINE_VISUALIZATIONSERVER_SERVICE_PORT": kfp_viz_data["service-port"],
"CACHE_IMAGE": harness.charm.config["cache-image"],
"ARCHIVE_CONFIG_LOG_FILE_NAME": harness.charm.config["log-archive-filename"],
"ARCHIVE_CONFIG_LOG_PATH_PREFIX": harness.charm.config["log-archive-prefix"],
# OBJECTSTORECONFIG_HOST and _PORT currently have no effect due to
# https://github.com/kubeflow/pipelines/issues/9689, described more in
# https://github.com/canonical/minio-operator/pull/151
# They're included here so that when the upstream issue is fixed we don't break
"OBJECTSTORECONFIG_HOST": (
f"{objectstorage_data['service']}.{objectstorage_data['namespace']}"
),
"OBJECTSTORECONFIG_PORT": str(objectstorage_data["port"]),
"OBJECTSTORECONFIG_REGION": "",
}
test_env = pebble_plan_info["services"][KFP_API_SERVICE_NAME]["environment"]

Expand Down
Loading