Skip to content

Commit cee7f2a

Browse files
committed
history: remove services created by the operator and update test
1 parent e0fa982 commit cee7f2a

File tree

2 files changed

+6
-70
lines changed

2 files changed

+6
-70
lines changed

rust/operator-binary/src/history/history_controller.rs

Lines changed: 5 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ use stackable_operator::{
2929
DeepMerge,
3030
api::{
3131
apps::v1::{StatefulSet, StatefulSetSpec},
32-
core::v1::{
33-
ConfigMap, PodSecurityContext, Service, ServiceAccount, ServicePort, ServiceSpec,
34-
},
32+
core::v1::{ConfigMap, PodSecurityContext, ServiceAccount},
3533
rbac::v1::{ClusterRole, RoleBinding, RoleRef, Subject},
3634
},
3735
apimachinery::pkg::apis::meta::v1::LabelSelector,
@@ -41,7 +39,7 @@ use stackable_operator::{
4139
core::{DeserializeGuard, error_boundary},
4240
runtime::{controller::Action, reflector::ObjectRef},
4341
},
44-
kvp::{Label, Labels, ObjectLabels},
42+
kvp::{Labels, ObjectLabels},
4543
logging::controller::ReconcilerError,
4644
product_logging::{
4745
framework::{LoggingError, calculate_log_volume_size_limit, vector_container},
@@ -301,13 +299,6 @@ pub async fn reconcile(
301299
.merged_config(&rgr)
302300
.context(FailedToResolveConfigSnafu)?;
303301

304-
let service =
305-
build_rolegroup_service(shs, &resolved_product_image.app_version_label, &rgr)?;
306-
cluster_resources
307-
.add(client, service)
308-
.await
309-
.context(ApplyServiceSnafu)?;
310-
311302
let config_map = build_config_map(
312303
shs,
313304
rolegroup_config,
@@ -614,9 +605,9 @@ fn build_stateful_set(
614605
// so that load balancers can hard-code the target addresses. This will
615606
// be the case even when no class is set (and the value defaults to
616607
// cluster-internal) as the address should still be consistent.
617-
let pvcs = Some(vec![
608+
let volume_claim_templates = Some(vec![
618609
ListenerOperatorVolumeSourceBuilder::new(
619-
&ListenerReference::ListenerClass(merged_config.listener_class.to_string()),
610+
&ListenerReference::ListenerName(shs.group_listener_name(rolegroupref)),
620611
&recommended_labels,
621612
)
622613
.context(BuildListenerVolumeSnafu)?
@@ -672,7 +663,7 @@ fn build_stateful_set(
672663
metadata: sts_metadata,
673664
spec: Some(StatefulSetSpec {
674665
template: pod_template,
675-
volume_claim_templates: pvcs,
666+
volume_claim_templates,
676667
replicas: shs.replicas(rolegroupref),
677668
selector: LabelSelector {
678669
match_labels: Some(
@@ -832,58 +823,3 @@ fn cleaner_config(
832823

833824
Ok(result)
834825
}
835-
836-
/// The rolegroup [`Service`] is a headless service that allows direct access to the instances of a certain rolegroup
837-
///
838-
/// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing.
839-
#[allow(clippy::result_large_err)]
840-
fn build_rolegroup_service(
841-
shs: &v1alpha1::SparkHistoryServer,
842-
app_version_label: &str,
843-
group: &RoleGroupRef<v1alpha1::SparkHistoryServer>,
844-
) -> Result<Service, Error> {
845-
let ports = Some(vec![
846-
ServicePort {
847-
name: Some(String::from("http")),
848-
port: HISTORY_UI_PORT.into(),
849-
..ServicePort::default()
850-
},
851-
ServicePort {
852-
name: Some(String::from("metrics")),
853-
port: METRICS_PORT.into(),
854-
..ServicePort::default()
855-
},
856-
]);
857-
858-
let metadata = ObjectMetaBuilder::new()
859-
.name_and_namespace(shs)
860-
.name(group.object_name())
861-
.ownerreference_from_resource(shs, None, Some(true))
862-
.context(ObjectMissingMetadataForOwnerRefSnafu)?
863-
.with_recommended_labels(labels(shs, app_version_label, &group.role_group))
864-
.context(MetadataBuildSnafu)?
865-
.with_label(Label::try_from(("prometheus.io/scrape", "true")).context(LabelBuildSnafu)?)
866-
.build();
867-
868-
let selector = Some(
869-
Labels::role_group_selector(shs, APP_NAME, &group.role, &group.role_group)
870-
.context(LabelBuildSnafu)?
871-
.into(),
872-
);
873-
874-
let service_spec = ServiceSpec {
875-
// Internal communication does not need to be exposed
876-
type_: Some("ClusterIP".to_string()),
877-
cluster_ip: Some("None".to_string()),
878-
ports,
879-
selector,
880-
publish_not_ready_addresses: Some(true),
881-
..ServiceSpec::default()
882-
};
883-
884-
Ok(Service {
885-
metadata,
886-
spec: Some(service_spec),
887-
status: None,
888-
})
889-
}

tests/templates/kuttl/spark-history-server/20-test-logs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ spec:
1616
"bash",
1717
"-x",
1818
"-c",
19-
"test 2 == $(curl http://spark-history-node-default:18080/api/v1/applications | jq length)",
19+
"test 2 == $(curl http://spark-history-node-default-group:18080/api/v1/applications | jq length)",
2020
]

0 commit comments

Comments
 (0)