Skip to content
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

adapter: remove SSH tunnel migration #29774

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
51 changes: 1 addition & 50 deletions src/adapter/src/catalog/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ use mz_ore::now::NowFn;
use mz_repr::namespaces::{MZ_CATALOG_SCHEMA, MZ_INTERNAL_SCHEMA};
use mz_repr::{GlobalId, Timestamp};
use mz_sql::ast::display::AstDisplay;
use mz_sql::ast::{
ConnectionOption, ConnectionOptionName, CreateConnectionStatement, CreateConnectionType, Value,
WithOptionValue,
};
use mz_sql_parser::ast::{Raw, Statement};
use mz_ssh_util::keys::SshKeyPairSet;
use mz_storage_types::connections::ConnectionContext;
use semver::Version;
use tracing::info;
// DO NOT add any more imports from `crate` outside of `crate::catalog`.
Expand Down Expand Up @@ -102,8 +96,7 @@ pub(crate) async fn migrate(
catalog_version
);

rewrite_ast_items(tx, |_tx, id, stmt| {
let connection_context = state.config.connection_context.clone();
rewrite_ast_items(tx, |_tx, _id, _stmt| {
Box::pin(async move {
// Add per-item AST migrations below.
//
Expand All @@ -114,8 +107,6 @@ pub(crate) async fn migrate(
// Migration functions may also take `tx` as input to stage
// arbitrary changes to the catalog.

migrate_inject_ssh_public_keys_v0118(connection_context, id, stmt).await;

Ok(())
})
})
Expand Down Expand Up @@ -192,46 +183,6 @@ pub(crate) async fn migrate(
// Please include the adapter team on any code reviews that add or edit
// migrations.

async fn migrate_inject_ssh_public_keys_v0118(
connection_context: ConnectionContext,
id: GlobalId,
stmt: &mut Statement<Raw>,
) {
match stmt {
Statement::CreateConnection(CreateConnectionStatement {
connection_type: CreateConnectionType::Ssh,
values,
..
}) => {
let secret = connection_context
.secrets_reader
.read(id)
.await
.unwrap_or_else(|e| panic!("failed reading secret for SSH key {id}: {e}"));
let keyset = SshKeyPairSet::from_bytes(&secret)
.unwrap_or_else(|e| panic!("failed decoding SSH key {id}: {e}"));

values.retain(|v| {
v.name != ConnectionOptionName::PublicKey1
&& v.name != ConnectionOptionName::PublicKey2
});
values.push(ConnectionOption {
name: ConnectionOptionName::PublicKey1,
value: Some(WithOptionValue::Value(Value::String(
keyset.primary().ssh_public_key(),
))),
});
values.push(ConnectionOption {
name: ConnectionOptionName::PublicKey2,
value: Some(WithOptionValue::Value(Value::String(
keyset.secondary().ssh_public_key(),
))),
});
}
_ => (),
}
}

// Durable migrations

/// Migrations that run only on the durable catalog before any data is loaded into memory.
Expand Down
Loading