Skip to content

fix(kfp-api): pass cache-enabled config through as CACHEENABLED env var - #1066

Open
kshivam4781 wants to merge 2 commits into
canonical:mainfrom
kshivam4781:fix/915-cache-enabled-env-var
Open

kshivam4781 wants to merge 2 commits into
canonical:mainfrom
kshivam4781:fix/915-cache-enabled-env-var

Conversation

@kshivam4781

Copy link
Copy Markdown

Summary

Closes #915. The kfp-api charm defines a cache-enabled config option, but _generate_environment in charm.py never wires it into an environment variable the apiserver actually reads — so toggling cache-enabled in the charm config has no effect on the running apiserver.

Root cause

Traced the expected env var name against upstream kubeflow/pipelines rather than guessing:

  • apiserver/common/config.go defines the config key as CacheEnabled (viper key).
  • main.go calls viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) (only . → _) and viper.AutomaticEnv(), which uppercases the key with no camelCase-to-underscore splitting.

So the actual env var the apiserver binds to is CACHEENABLED (no underscore), not CACHE_ENABLED.

What changed

  • Added "CACHEENABLED": "true"/"false" to _generate_environment in charm.py, driven by the cache-enabled config option.
  • Extended the existing full-deployment expected_env test to assert the new key.
  • Added a new test_cache_enabled_config test (modeled on the existing test_launcher_driver_images_config) that toggles the config option and asserts the resulting env var.

Test plan

  • poetry install --only unit,charm then the full tests/unit/test_operator.py suite: 56/56 passed.
  • isort --check-only, black --check, and pflake8 (via poetry install --only lint) all clean, no diffs.

The cache-enabled charm config option was defined in config.yaml but never
translated into an environment variable for the apiserver container, so
toggling it had no effect (kfp-api always behaved as if caching were
enabled). The upstream apiserver reads this via
common.GetBoolConfigWithDefault("CacheEnabled", true), which viper resolves
from the CACHEENABLED environment variable. This sets that env var from
self.model.config["cache-enabled"], following the existing
true/false-string pattern used for OBJECTSTORECONFIG_SECURE.

Closes canonical#915

Signed-off-by: Shivam <shivamssing25@gmail.com>
Adds test_cache_enabled_config, which asserts that toggling the
cache-enabled config option changes the CACHEENABLED env var passed to the
apiserver container, and extends the existing full-deployment env
assertion to include the new key.

Signed-off-by: Shivam <shivamssing25@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cache-enabled config in kfp-api is never used

1 participant