-
Notifications
You must be signed in to change notification settings - Fork 92
chore(RHINENG-22191): clean-up dependency loading from clowder #3271
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
base: master
Are you sure you want to change the base?
chore(RHINENG-22191): clean-up dependency loading from clowder #3271
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefines Clowder dependency loading for the kessel-relations service by validating configuration presence, safely looking up the dependency endpoint, and using the endpoint’s configured port instead of a hard-coded value. Class diagram for config clowder_config changesclassDiagram
class AppConfig {
+bool is_clowder
+string kessel_relations_api_endpoint
+int metrics_port
+clowder_config()
}
class app_common_python {
+LoadedConfig LoadedConfig
+dict DependencyEndpoints
}
class LoadedConfig {
+int metricsPort
}
class DependencyEndpoint {
+string hostname
+int port
}
AppConfig --> LoadedConfig : uses
AppConfig --> DependencyEndpoint : uses
app_common_python --> LoadedConfig : provides
app_common_python --> DependencyEndpoint : provides
Flow diagram for updated clowder_config dependency loadingflowchart TD
A[Call clowder_config] --> B[Import app_common_python]
B --> C[Set cfg to app_common_python.LoadedConfig]
C --> D{cfg is None?}
D -->|Yes| E[Raise ValueError: Clowder is enabled, but no configuration was loaded]
D -->|No| F[Get kessel_relations_dep from app_common_python.DependencyEndpoints]
F --> G{kessel_relations_dep is None?}
G -->|Yes| H[Raise ValueError: Could not find kessel-relations endpoint in Clowder configuration]
G -->|No| I[Set kessel_relations_api_endpoint to hostname:port from kessel_relations_dep]
I --> J[Set is_clowder to True]
J --> K[Set metrics_port to cfg.metricsPort]
K --> L[Return from clowder_config]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/config.py
Outdated
| kessel_relations_dep = app_common_python.DependencyEndpoints.get("kessel-relations", {}).get("api", None) | ||
| if kessel_relations_dep is None: | ||
| raise ValueError("Could not find kessel-relations endpoint in Clowder configuration") | ||
|
|
||
| self.kessel_relations_api_endpoint = f"{kessel_relations_dep.hostname}:{kessel_relations_dep.port}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| kessel_relations_dep = app_common_python.DependencyEndpoints.get("kessel-relations", {}).get("api", None) | |
| if kessel_relations_dep is None: | |
| raise ValueError("Could not find kessel-relations endpoint in Clowder configuration") | |
| self.kessel_relations_api_endpoint = f"{kessel_relations_dep.hostname}:{kessel_relations_dep.port}" | |
| kessel_inventory_dep = app_common_python.DependencyEndpoints.get("kessel-inventory", {}).get("api", None) | |
| if kessel_inventory_dep is None: | |
| raise ValueError("Could not find kessel-inventory endpoint in Clowder configuration") | |
| self.kessel_inventory_api_endpoint = f"{kessel_inventory_dep.hostname}:{kessel_inventory_dep.port}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and applied the new dependency
84fb8bb to
70da5dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this in ephemeral with enabled Kessel Phase 1 and got HTTP 500 errors on API requests. This is from the inventory logs:
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:172.30.67.68:8000: Trying to connect an http1.x server (HTTP status 301)"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"failed to connect to all addresses; last error: UNKNOWN: ipv4:172.30.67.68:8000: Trying to connect an http1.x server (HTTP status 301)", grpc_status:14}"
I don't think their Clowder config has the grpc port yet. 8000 is not correct; kessel-inventory is using 9000 in all envs right now. We probably need to keep hardcoding that value until they get that configured |
Just small clean-up for #3264
Summary by Sourcery
Harden Clowder-based configuration of the kessel-relations API endpoint.
Bug Fixes: