Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/orchestratord/src/controller/materialize/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct ConsoleAppConfig {

#[derive(Serialize)]
struct ConsoleAppConfigAuth {
mode: AuthenticatorKind,
self_managed_password_auth_enabled: bool,
}

fn create_console_app_configmap_object(mz: &Materialize, console_image_ref: &str) -> ConfigMap {
Expand All @@ -224,7 +224,10 @@ fn create_console_app_configmap_object(mz: &Materialize, console_image_ref: &str
let app_config_json = serde_json::to_string(&ConsoleAppConfig {
version,
auth: ConsoleAppConfigAuth {
mode: mz.spec.authenticator_kind,
self_managed_password_auth_enabled: mz
.spec
.authenticator_kind
.password_style_self_managed_auth(),
},
})
.expect("known valid");
Expand Down
21 changes: 8 additions & 13 deletions src/orchestratord/src/controller/materialize/environmentd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,10 +1394,7 @@ fn create_environmentd_statefulset_object(
..Default::default()
});
args.push("--listeners-config-path=/listeners/listeners.json".to_owned());
if matches!(
mz.spec.authenticator_kind,
AuthenticatorKind::Password | AuthenticatorKind::Sasl
) {
if mz.spec.authenticator_kind.password_style_self_managed_auth() {
args.push("--system-parameter-default=enable_password_auth=true".into());
env.push(EnvVar {
name: "MZ_EXTERNAL_LOGIN_PASSWORD_MZ_SYSTEM".to_string(),
Expand Down Expand Up @@ -1691,10 +1688,7 @@ fn create_connection_info(
},
};

if matches!(
authenticator_kind,
AuthenticatorKind::Password | AuthenticatorKind::Sasl
) {
if mz.spec.authenticator_kind.password_style_self_managed_auth() {
listeners_config.sql.remove("internal");
listeners_config.http.remove("internal");

Expand Down Expand Up @@ -1747,17 +1741,18 @@ fn create_connection_info(
},
};

let (scheme, leader_api_port, mz_system_secret_name) = match authenticator_kind {
AuthenticatorKind::Password | AuthenticatorKind::Sasl => {
let (scheme, leader_api_port, mz_system_secret_name) =
if mz.spec.authenticator_kind.password_style_self_managed_auth() {
let scheme = if external_enable_tls { "https" } else { "http" };
(
scheme,
config.environmentd_http_port,
Some(mz.spec.backend_secret_name.clone()),
)
}
_ => ("http", config.environmentd_internal_http_port, None),
};
} else {
("http", config.environmentd_internal_http_port, None)
};

let environmentd_url = format!(
"{}://{}.{}.svc.cluster.local:{}",
scheme,
Expand Down
7 changes: 7 additions & 0 deletions src/server-core/src/listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ pub enum AuthenticatorKind {
None,
}

impl AuthenticatorKind {
/// Whether this authenticator kind supports password-style self-managed authentication.
pub fn password_style_self_managed_auth(&self) -> bool {
matches!(self, AuthenticatorKind::Password | AuthenticatorKind::Sasl)
}
}

/// Whether to allow internal users (ie: mz_system) and/or normal users.
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq)]
pub enum AllowedRoles {
Expand Down