Repository navigation
fix(kfp-api): pass cache-enabled config through as CACHEENABLED env var - #1066
Open
kshivam4781 wants to merge 2 commits into
Open
kshivam4781 wants to merge 2 commits into
kshivam4781 wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #915. The kfp-api charm defines a
cache-enabledconfig option, but_generate_environmentincharm.pynever wires it into an environment variable the apiserver actually reads — so togglingcache-enabledin 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.godefines the config key asCacheEnabled(viper key).main.gocallsviper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))(only.→_) andviper.AutomaticEnv(), which uppercases the key with no camelCase-to-underscore splitting.So the actual env var the apiserver binds to is
CACHEENABLED(no underscore), notCACHE_ENABLED.What changed
"CACHEENABLED": "true"/"false"to_generate_environmentincharm.py, driven by thecache-enabledconfig option.expected_envtest to assert the new key.test_cache_enabled_configtest (modeled on the existingtest_launcher_driver_images_config) that toggles the config option and asserts the resulting env var.Test plan
poetry install --only unit,charmthen the fulltests/unit/test_operator.pysuite: 56/56 passed.isort --check-only,black --check, andpflake8(viapoetry install --only lint) all clean, no diffs.