Skip to content

Commit 89788bd

Browse files
committed
Capture in variable
1 parent 836cf0e commit 89788bd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

rust/operator-binary/src/container.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,14 +784,14 @@ wait_for_termination $!
784784
/// Needs the KERBEROS_REALM env var, which will be written with `export_kerberos_real_env_var_command`
785785
/// Needs the POD_NAME env var to be present, which will be provided by the PodSpec
786786
fn get_kerberos_ticket(hdfs: &HdfsCluster, role: &HdfsRole) -> Result<String, Error> {
787+
let cluster_domain = KUBERNETES_CLUSTER_DOMAIN
788+
.get()
789+
.expect("KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator");
787790
let principal = format!(
788791
"{service_name}/{hdfs_name}.{namespace}.svc.{cluster_domain}@${{KERBEROS_REALM}}",
789792
service_name = role.kerberos_service_name(),
790793
hdfs_name = hdfs.name_any(),
791794
namespace = hdfs.namespace().context(ObjectHasNoNamespaceSnafu)?,
792-
cluster_domain = KUBERNETES_CLUSTER_DOMAIN.get().expect(
793-
"KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator"
794-
),
795795
);
796796
Ok(formatdoc!(
797797
r###"

rust/operator-binary/src/security/kerberos.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ fn principal_host_part(hdfs: &HdfsCluster) -> Result<String> {
157157
.with_context(|_| ObjectHasNoNamespaceSnafu {
158158
obj_ref: ObjectRef::from_obj(hdfs),
159159
})?;
160+
let cluster_domain = KUBERNETES_CLUSTER_DOMAIN
161+
.get()
162+
.expect("KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator");
160163
Ok(format!(
161164
"{hdfs_name}.{hdfs_namespace}.svc.{cluster_domain}@${{env.KERBEROS_REALM}}",
162-
cluster_domain = KUBERNETES_CLUSTER_DOMAIN
163-
.get()
164-
.expect("KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator"),
165165
))
166166
}

0 commit comments

Comments
 (0)