-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Hive listener integration #605
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: main
Are you sure you want to change the base?
Conversation
|
I might have run into stackabletech/hdfs-operator#686 during development. I recognized that I can have an empty string in my discovery configMap from time to time. Behaviour appears to be flaky, but yet more often then not the emtpy string appears: Expected
Flaky faulty one
|
…tackabletech/hive-operator into feat/hive-listener-integration
🟢
|
Co-authored-by: Malte Sander <[email protected]>
…tackabletech/hive-operator into feat/hive-listener-integration
Co-authored-by: Malte Sander <[email protected]>
…tackabletech/hive-operator into feat/hive-listener-integration
listener_ref: Listener, | ||
rolegroup: &String, | ||
chroot: Option<&str>, | ||
) -> Result<String, Error> { | ||
// We only need the first address corresponding to the rolegroup | ||
let listener_address = listener_ref |
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.
This should probably be called listener
, as it isn't a ref.
listener_ref: Listener, | |
rolegroup: &String, | |
chroot: Option<&str>, | |
) -> Result<String, Error> { | |
// We only need the first address corresponding to the rolegroup | |
let listener_address = listener_ref | |
listener: Listener, | |
rolegroup: &String, | |
chroot: Option<&str>, | |
) -> Result<String, Error> { | |
// We only need the first address corresponding to the rolegroup | |
let listener_address = listener |
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.
Is gone as not needed anymore
rust/operator-binary/src/crd/mod.rs
Outdated
@@ -448,6 +417,10 @@ pub struct MetaStoreConfig { | |||
/// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. | |||
#[fragment_attrs(serde(default))] | |||
pub graceful_shutdown_timeout: Option<Duration>, | |||
|
|||
/// This field controls which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) is used to expose the webserver. | |||
#[serde(default)] |
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.
All other fields use fragment_attr
, is that needed here too?
#[serde(default)] | |
#[fragment_attr(serde(default))] |
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.
Also, do we want the String::default()
to be called? Doesn't it have to be a valid class, or it falls back to cluster-internal
?
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.
also outdated I think.
Yes, now it falls back to cluster-internal
if listenerClass is not given.
hive, | ||
&resolved_product_image.app_version_label, | ||
&HiveRole::MetaStore.to_string(), | ||
"discovery", |
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.
Would this cause a collision if there are multiple role groups defined?
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.
Also outdated as it's on role level now
// Init listener struct. Collect listener after applied to cluster_resources | ||
// to use listener object in later created discovery configMap | ||
let mut listener = Listener::new("name", ListenerSpec::default()); | ||
let role_config = hive.role_config(&hive_role); | ||
if let Some(GenericRoleConfig { | ||
pod_disruption_budget: pdb, | ||
if let Some(HiveMetastoreRoleConfig { | ||
common: GenericRoleConfig { | ||
pod_disruption_budget: pdb, | ||
}, | ||
listener_class, | ||
}) = role_config | ||
{ | ||
add_pdbs(pdb, hive, &hive_role, client, &mut cluster_resources) | ||
.await | ||
.context(FailedToCreatePdbSnafu)?; | ||
|
||
let group_listener: Listener = | ||
build_group_listener(hive, &resolved_product_image, &hive_role, listener_class)?; | ||
listener = cluster_resources | ||
.add(client, group_listener) | ||
.await | ||
.with_context(|_| ApplyGroupListenerSnafu { | ||
role: hive_role.to_string(), | ||
})?; |
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 would split the pdbs and listener stuff like so:
let role_config = hive.role_config(&hive_role);
if let Some(HiveMetastoreRoleConfig {
common: GenericRoleConfig {
pod_disruption_budget: pdb,
},
..
}) = role_config
{
add_pdbs(pdb, hive, &hive_role, client, &mut cluster_resources)
.await
.context(FailedToCreatePdbSnafu)?;
}
// std's SipHasher is deprecated, and DefaultHasher is unstable across Rust releases.
// We don't /need/ stability, but it's still nice to avoid spurious changes where possible.
let mut discovery_hash = FnvHasher::with_key(0);
if let Some(HiveMetastoreRoleConfig { listener_class, .. }) = role_config {
let group_listener: Listener =
build_group_listener(hive, &resolved_product_image, &hive_role, listener_class)?;
let listener = cluster_resources
.add(client, group_listener)
.await
.context(ApplyGroupListenerSnafu {
role: hive_role.to_string(),
})?;
for discovery_cm in discovery::build_discovery_configmaps(
hive,
hive,
hive_role,
&resolved_product_image,
None,
listener,
)
.await
.context(BuildDiscoveryConfigSnafu)?
{
let discovery_cm = cluster_resources
.add(client, discovery_cm)
.await
.context(ApplyDiscoveryConfigSnafu)?;
if let Some(generation) = discovery_cm.metadata.resource_version {
discovery_hash.write(generation.as_bytes())
}
}
}
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.
done with aa56092
let recommended_object_labels: ObjectLabels<'_, v1alpha1::HiveCluster> = | ||
build_recommended_labels( |
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.
Why type 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.
Overlooked it. Probably IDE autocompletion whenever you double click the type :(
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.
done with cae1450
obj_ref: ObjectRef<Service>, | ||
}, | ||
#[snafu(display("could not find port [{port_name}] for rolegroup listener {role}"))] | ||
NoServicePort { port_name: String, role: String }, | ||
#[snafu(display("service [{obj_ref}] port [{port_name}] does not have a nodePort "))] | ||
NoNodePort { |
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.
NoNodePort
, FindEndpoints
, InvalidNodePort
etc. unused
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.
done with aa56092
Description
Adds listener Support
Definition of Done Checklist
Author
Reviewer
Acceptance