Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sbernauer
Copy link
Member

This seems to work well in combination with stackabletech/trino-operator#715

Copy link
Member

@Techassi Techassi left a 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.

Copy link
Member

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?

Copy link
Member Author

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?

Comment on lines +359 to +364
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,
})?;
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does

// 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
explain the situation a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Development: In Review
Development

Successfully merging this pull request may close these issues.

2 participants