refactor: Extract apply and update status steps - #811
Conversation
| // Discovery CM will fail to build until the rest of the cluster has been | ||
| // deployed, so do it last so that failure won't inhibit the rest of the | ||
| // cluster from booting up. | ||
| let discovery_cm = build_discovery_config_map( |
There was a problem hiding this comment.
This - build_discovery_config_map - is a build step, but it cannot live in the "actual" step (due to dependencies) but neither is it really part of apply, so I've left it here.
There was a problem hiding this comment.
This will be covered by our TODO item:
Address the race condition for discovery config maps: see HDFS, Hive, Kafka
There was a problem hiding this comment.
See: 24908e6
The listeners are not created by the operator but are needed to create the discovery config map. The listeners are watched so that complete listener data triggers a reconcile.
There was a problem hiding this comment.
Re-tested:
--- PASS: kuttl (1052.01s)
--- PASS: kuttl/harness (0.00s)
--- PASS: kuttl/harness/smoke_hadoop-3.5.0_zookeeper-3.9.4_zookeeper-latest-3.9.5_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-cluster-internal_openshift-false (150.36s)
--- PASS: kuttl/harness/smoke_hadoop-3.5.0_zookeeper-3.9.5_zookeeper-latest-3.9.5_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-cluster-internal_openshift-false (616.86s)
--- PASS: kuttl/harness/smoke_hadoop-3.5.0_zookeeper-3.9.5_zookeeper-latest-3.9.5_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-external-unstable_openshift-false (140.38s)
--- PASS: kuttl/harness/smoke_hadoop-3.5.0_zookeeper-3.9.4_zookeeper-latest-3.9.5_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-external-unstable_openshift-false (144.40s)
PASS
|
|
Openshift tests to verify clusterrole: |
| /// Applies the discovery `ConfigMap` directly, outside the [`ClusterResources`] tracking. | ||
| /// | ||
| /// The CM must stay untracked because it is not emitted on every reconcile run: the namenode | ||
| /// `Listener`s are per-pod, so whenever a namenode is scaled up (or a `Listener` briefly has | ||
| /// no ingress address), [`crate::crd::namenode_listener_refs`] returns `None` and the CM is | ||
| /// skipped for that run. A *tracked* CM would be deleted as an orphan by | ||
| /// [`ClusterResources::delete_orphaned_resources`] in every such window and re-created once | ||
| /// the addresses are back -- churn for every client watching the discovery CM. Untracked, the | ||
| /// existing CM simply stays in place until it can be rebuilt. | ||
| /// | ||
| /// This deliberately differs from Hive and Druid, which do track their discovery CMs: their | ||
| /// skip window only opens when a role `Listener` is deleted and re-created, whereas HDFS | ||
| /// would hit it on every namenode scale-up. | ||
| pub async fn apply_discovery_config_map(client: &Client, discovery_cm: &ConfigMap) -> Result<()> { | ||
| client | ||
| .apply_patch(FIELD_MANAGER_SCOPE, discovery_cm, discovery_cm) | ||
| .await | ||
| .with_context(|_| ApplyDiscoveryConfigMapSnafu { | ||
| name: discovery_cm.metadata.name.clone().unwrap_or_default(), | ||
| })?; | ||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
Should we re-emit the ConfigMap like the Druid operator does?
| listener_name.starts_with(&format!( | ||
| "{listener_volume}-{cluster_name}-{role}-", | ||
| listener_volume = *LISTENER_VOLUME_NAME, | ||
| role = HdfsNodeRole::Name, | ||
| )) |
There was a problem hiding this comment.
This implementation is good enough for now, but I want to note a possible name collision. Since a cluster name may itself contain -, that character doesn't reliably separate the parts of the listener name. For example, is_namenode_listener matches the namenode listeners of both the hdfs cluster and the hdfs-namenode cluster: the latter's namenode listeners are named listener-hdfs-namenode-namenode-<rolegroup>-<n>, which also starts with the listener-hdfs-namenode- prefix built for cluster hdfs.
Description
This PR covers the following:
Definition of Done Checklist
Author
Reviewer
Acceptance
type/deprecationlabel & add to the deprecation scheduletype/experimentallabel & add to the experimental features tracker