-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: The Stackable scaler now waits 5s after TrinoClusters turn ready #68
base: main
Are you sure you want to change the base?
Conversation
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.
Overall lgtm, a few small comments.
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.
note: These changes seem unrelated to the changes introduced by this PR. Should these instead be introduced by a separate PR?
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.
While playing around with restarting coordinator and workers and seeing the effect in trino-lb, I noticed that the works don't shut down gracefully: https://docs.stackable.tech/home/stable/trino/usage-guide/operations/graceful-shutdown/#_authorization_requirements
To get the graceful shutdown to work we need to add OPA authorization.
If you want to I can put it in a separate PR, shall I?
let last_transition_time: Time = serde_json::from_value(last_transition_time.clone()) | ||
.with_context(|_| ParseLastTransitionTimeSnafu { | ||
last_transition_time: last_transition_time.clone(), | ||
cluster: &cluster.name, | ||
namespace: &cluster.namespace, | ||
})?; |
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.
note: This seems to be formatted weirdly. Can we do anything about that?
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 noticed this during development as well.
This formats wrong
let last_transition_time: Time = serde_json::from_value(last_transition_time.clone())
.with_context(|_| ParseLastTransitionTimeSnafu {
last_transition_time: last_transition_time.clone(),
cluster: &cluster.name,
namespace: &cluster.namespace,
})?;
The following formats correctly, but does not compile (type annotations needed)
let last_transition_time = serde_json::from_value(last_transition_time.clone())
.with_context(|_| ParseLastTransitionTimeSnafu {
last_transition_time: last_transition_time.clone(),
cluster: &cluster.name,
namespace: &cluster.namespace,
})?;
This works
let last_transition_time = serde_json::from_value::<Time>(last_transition_time.clone())
.with_context(|_| ParseLastTransitionTimeSnafu {
last_transition_time: last_transition_time.clone(),
cluster: &cluster.name,
namespace: &cluster.namespace,
})?;
=> Looks like a bug in rustfmt to me. I let you decide, I personally am fine as-is, a future rustfmt version will probably format it correctly 😅
@@ -263,14 +274,14 @@ impl ScalerTrait for StackableScaler { | |||
let cluster = self | |||
.clusters | |||
.get(cluster) | |||
.context(ClusterNotFoundSnafu { cluster })?; | |||
.with_context(|| ClusterNotFoundSnafu { cluster })?; | |||
|
|||
let status = cluster |
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.
note(non-blocking): (To self) There seem to be many hoops you have to jump through to properly use the status of a resource. Can we improve this situation with better API design?
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.
Does
trino-lb/trino-lb/src/scaling/stackable.rs
Lines 278 to 281 in ff4f5a2
// I would prefer switching to using https://docs.rs/k8s-openapi/latest/k8s_openapi/apimachinery/pkg/apis/meta/v1/struct.Condition.html | |
// for parsing. Sadly the Stackable Condition is not compatible with the k8s-openapi Condition struct, so I | |
// created https://github.com/stackabletech/issues/issues/489. The branch refactor/conditions-parsing has an | |
// (non-working) example code, which can be used after the Issues is resolved |
Co-authored-by: Techassi <[email protected]>
Co-authored-by: Techassi <[email protected]>
This seems to work well in combination with stackabletech/trino-operator#715