-
Notifications
You must be signed in to change notification settings - Fork 156
issue 680: configure kale to use different kfp server
#702
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
Open
hmtosi
wants to merge
32
commits into
kubeflow:main
Choose a base branch
from
hmtosi:issue-680-configure-server
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
75b1ffd
initial changes
hmtosi dea5ae8
update to include all Client parameters
hmtosi 98b09be
remove UI components
hmtosi 3181b0b
remove ui components
hmtosi 0a7b6ce
remove test until functionality is confirmed
hmtosi 64f7682
Merge branch 'main' into issue-680-configure-server
hmtosi 2f35252
Merge branch 'main' into issue-680-configure-server
hmtosi ce8b94e
finish removing ui functionality
hmtosi 2a5525e
add unit test for kfp server config
hmtosi a99999d
update paramter descriptions
hmtosi a406305
Merge branch 'main' into issue-680-configure-server
hmtosi 9b77459
fix linting
hmtosi 0ea0c75
change to factory architecture
hmtosi 469368b
add factory to git tracking
hmtosi 3633771
update documentation
hmtosi 4a1370b
update so e2e passes
hmtosi 808c32f
Merge branch 'main' into issue-680-configure-server
hmtosi 92b7567
Merge branch 'kubeflow:main' into issue-680-configure-server
hmtosi 136e2dd
update default config path
hmtosi 0500397
update kfp authentication to allow credentials
hmtosi 57e7e12
add authenticator file
hmtosi 33cd1e3
Merge branch 'kubeflow:main' into issue-680-configure-server
hmtosi 5d3ac89
Fix circular import
jesuino 351638b
Merge pull request #2 from jesuino/credentials_circular_import
hmtosi f41d494
Apply suggestion from @Copilot
hmtosi 192cded
add config env var so it can be explicitly set
hmtosi 1a80fe5
add atomic rename suggested by copilot
hmtosi 59703ae
update documentation
hmtosi 3ba3ece
Merge branch 'kubeflow:main' into issue-680-configure-server
hmtosi 481266c
separate configuration (persisted) from credentials (resolved at runt…
hmtosi bec5c32
prevent tokens from being saved to disk
hmtosi bd43a9b
Merge branch 'kubeflow:main' into issue-680-configure-server
hmtosi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Copyright 2026 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import json | ||
| import logging | ||
| import os | ||
| from typing import Any | ||
|
|
||
| from kale.config.config import Config, Field | ||
|
|
||
| log = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class KFPServerConfig(Config): | ||
| """Configuration for KFP server connection.""" | ||
|
|
||
| host = Field(type=str, default=None) | ||
| cookies = Field(type=str, default=None) | ||
| credentials = Field(type=str, default=None) | ||
| existing_token = Field(type=str, default=None) | ||
| namespace = Field(type=str, default="kubeflow") | ||
| ssl_ca_cert = Field(type=str, default=None) | ||
|
|
||
|
|
||
| def get_config_path() -> str: | ||
| """Get the path to the KFP server configuration file.""" | ||
| kale_dir = os.path.join(os.path.expanduser("~"), ".kale") | ||
| return os.path.join(kale_dir, "kfp_server_config.json") | ||
|
|
||
|
|
||
| def load_config() -> KFPServerConfig: | ||
| """Load KFP server configuration from disk. | ||
|
|
||
| Returns: | ||
| KFPServerConfig instance. If no config file exists, returns default config. | ||
| """ | ||
| config_path = get_config_path() | ||
| if not os.path.exists(config_path): | ||
| log.debug("No KFP server config found at %s, using defaults", config_path) | ||
| return KFPServerConfig() | ||
|
|
||
| try: | ||
| with open(config_path) as f: | ||
| config_dict = json.load(f) | ||
| log.info("Loaded KFP server config from %s", config_path) | ||
| return KFPServerConfig(**config_dict) | ||
| except (json.JSONDecodeError, OSError) as e: | ||
hmtosi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| log.warning("Failed to load KFP server config from %s: %s. Using defaults.", config_path, e) | ||
| return KFPServerConfig() | ||
|
|
||
|
|
||
| def save_config(config: KFPServerConfig | dict[str, Any]) -> None: | ||
hmtosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """Save KFP server configuration to disk. | ||
|
|
||
| Args: | ||
| config: KFPServerConfig instance or dict with config values | ||
| """ | ||
| if isinstance(config, dict): | ||
| config = KFPServerConfig(**config) | ||
|
|
||
| config_path = get_config_path() | ||
| kale_dir = os.path.dirname(config_path) | ||
|
|
||
| # Create .kale directory if it doesn't exist | ||
| os.makedirs(kale_dir, exist_ok=True) | ||
|
|
||
| config_dict = config.to_dict() | ||
| with open(config_path, "w") as f: | ||
| json.dump(config_dict, f, indent=2) | ||
|
|
||
| # Set restrictive permissions for security (only owner can read/write) | ||
| os.chmod(config_path, 0o600) | ||
hmtosi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| log.info("Saved KFP server config to %s", config_path) | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.