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

[#4580] feat(catalog): unify cloud storage configurations #4897

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,13 @@ public class IcebergConstants {

// IO properties
public static final String IO_IMPL = "io-impl";
public static final String GRAVITINO_S3_ENDPOINT = "s3-endpoint";
public static final String ICEBERG_S3_ENDPOINT = "s3.endpoint";
public static final String GRAVITINO_S3_ACCESS_KEY_ID = "s3-access-key-id";
public static final String ICEBERG_S3_ACCESS_KEY_ID = "s3.access-key-id";
public static final String GRAVITINO_S3_SECRET_ACCESS_KEY = "s3-secret-access-key";
public static final String ICEBERG_S3_SECRET_ACCESS_KEY = "s3.secret-access-key";
public static final String GRAVITINO_S3_REGION = "s3-region";
public static final String AWS_S3_REGION = "client.region";

public static final String GRAVITINO_OSS_ENDPOINT = "oss-endpoint";
public static final String ICEBERG_OSS_ENDPOINT = "oss.endpoint";
public static final String GRAVITINO_OSS_ACCESS_KEY_ID = "oss-access-key-id";
public static final String ICEBERG_OSS_ACCESS_KEY_ID = "client.access-key-id";
public static final String GRAVITINO_OSS_ACCESS_KEY_SECRET = "oss-access-key-secret";
public static final String ICEBERG_OSS_ACCESS_KEY_SECRET = "client.access-key-secret";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have the GCS related configurations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because GCS need to create credential according to a credential file, For Iceberg, it could only load credential file by setting ENV vars explicitly or load from GCS instance implicitly.


// Iceberg Table properties constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.gravitino.storage.OSSProperties;
import org.apache.gravitino.storage.S3Properties;

public class IcebergPropertiesUtils {

Expand All @@ -40,18 +42,16 @@ public class IcebergPropertiesUtils {
map.put(IcebergConstants.CATALOG_BACKEND_NAME, IcebergConstants.CATALOG_BACKEND_NAME);
map.put(IcebergConstants.IO_IMPL, IcebergConstants.IO_IMPL);
// S3
map.put(IcebergConstants.GRAVITINO_S3_ENDPOINT, IcebergConstants.ICEBERG_S3_ENDPOINT);
map.put(IcebergConstants.GRAVITINO_S3_REGION, IcebergConstants.AWS_S3_REGION);
map.put(IcebergConstants.GRAVITINO_S3_ACCESS_KEY_ID, IcebergConstants.ICEBERG_S3_ACCESS_KEY_ID);
map.put(S3Properties.GRAVITINO_S3_ENDPOINT, IcebergConstants.ICEBERG_S3_ENDPOINT);
map.put(S3Properties.GRAVITINO_S3_REGION, IcebergConstants.AWS_S3_REGION);
map.put(S3Properties.GRAVITINO_S3_ACCESS_KEY_ID, IcebergConstants.ICEBERG_S3_ACCESS_KEY_ID);
map.put(
IcebergConstants.GRAVITINO_S3_SECRET_ACCESS_KEY,
IcebergConstants.ICEBERG_S3_SECRET_ACCESS_KEY);
S3Properties.GRAVITINO_S3_SECRET_ACCESS_KEY, IcebergConstants.ICEBERG_S3_SECRET_ACCESS_KEY);
// OSS
map.put(IcebergConstants.GRAVITINO_OSS_ENDPOINT, IcebergConstants.ICEBERG_OSS_ENDPOINT);
map.put(OSSProperties.GRAVITINO_OSS_ENDPOINT, IcebergConstants.ICEBERG_OSS_ENDPOINT);
map.put(OSSProperties.GRAVITINO_OSS_ACCESS_KEY_ID, IcebergConstants.ICEBERG_OSS_ACCESS_KEY_ID);
map.put(
IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_ID, IcebergConstants.ICEBERG_OSS_ACCESS_KEY_ID);
map.put(
IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_SECRET,
OSSProperties.GRAVITINO_OSS_ACCESS_KEY_SECRET,
IcebergConstants.ICEBERG_OSS_ACCESS_KEY_SECRET);
GRAVITINO_CONFIG_TO_ICEBERG = Collections.unmodifiableMap(map);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.storage;

// Defines the unified OSS properties for different catalogs and connectors.
public class OSSProperties {

// The endpoint of Aliyun OSS service.
public static final String GRAVITINO_OSS_ENDPOINT = "oss-endpoint";
// The static access key ID used to access OSS data.
public static final String GRAVITINO_OSS_ACCESS_KEY_ID = "oss-access-key-id";
// The static secret access key used to access OSS data.
public static final String GRAVITINO_OSS_ACCESS_KEY_SECRET = "oss-access-key-secret";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The oss-access-key-secret is mismatch with the docs. is it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the docs to use access key secret for OSS

private OSSProperties() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.storage;

// Defines the unified S3 properties for different catalogs and connectors.
public class S3Properties {
// An alternative endpoint of the S3 service, This could be used to for S3FileIO with any
// s3-compatible object storage service that has a different endpoint, or access a private S3
// endpoint in a virtual private cloud
public static final String GRAVITINO_S3_ENDPOINT = "s3-endpoint";
// The static access key ID used to access S3 data.
public static final String GRAVITINO_S3_ACCESS_KEY_ID = "s3-access-key-id";
// The static secret access key used to access S3 data.
public static final String GRAVITINO_S3_SECRET_ACCESS_KEY = "s3-secret-access-key";
// The region of the S3 service.
public static final String GRAVITINO_S3_REGION = "s3-region";

private S3Properties() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.apache.gravitino.iceberg.common.IcebergCatalogBackend;
import org.apache.gravitino.iceberg.common.authentication.AuthenticationConfig;
import org.apache.gravitino.iceberg.common.authentication.kerberos.KerberosConfig;
import org.apache.gravitino.storage.OSSProperties;
import org.apache.gravitino.storage.S3Properties;

public class IcebergCatalogPropertiesMetadata extends BaseCatalogPropertiesMetadata {
public static final String CATALOG_BACKEND = IcebergConstants.CATALOG_BACKEND;
Expand Down Expand Up @@ -84,25 +86,25 @@ public class IcebergCatalogPropertiesMetadata extends BaseCatalogPropertiesMetad
null /* defaultValue */,
false /* hidden */),
stringOptionalPropertyEntry(
IcebergConstants.GRAVITINO_S3_ACCESS_KEY_ID,
S3Properties.GRAVITINO_S3_ACCESS_KEY_ID,
"s3 access-key-id",
false /* immutable */,
null /* defaultValue */,
true /* hidden */),
stringOptionalPropertyEntry(
IcebergConstants.GRAVITINO_S3_SECRET_ACCESS_KEY,
S3Properties.GRAVITINO_S3_SECRET_ACCESS_KEY,
"s3 secret-access-key",
false /* immutable */,
null /* defaultValue */,
true /* hidden */),
stringOptionalPropertyEntry(
IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_ID,
OSSProperties.GRAVITINO_OSS_ACCESS_KEY_ID,
"OSS access-key-id",
false /* immutable */,
null /* defaultValue */,
true /* hidden */),
stringOptionalPropertyEntry(
IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_SECRET,
OSSProperties.GRAVITINO_OSS_ACCESS_KEY_SECRET,
"OSS access-key-secret",
false /* immutable */,
null /* defaultValue */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.apache.gravitino.config.ConfigEntry;
import org.apache.gravitino.server.web.JettyServerConfig;
import org.apache.gravitino.server.web.OverwriteDefaultConfig;
import org.apache.gravitino.storage.OSSProperties;
import org.apache.gravitino.storage.S3Properties;

public class IcebergConfig extends Config implements OverwriteDefaultConfig {

Expand Down Expand Up @@ -105,7 +107,7 @@ public class IcebergConfig extends Config implements OverwriteDefaultConfig {
.create();

public static final ConfigEntry<String> S3_ENDPOINT =
new ConfigBuilder(IcebergConstants.GRAVITINO_S3_ENDPOINT)
new ConfigBuilder(S3Properties.GRAVITINO_S3_ENDPOINT)
.doc(
"An alternative endpoint of the S3 service, This could be used to for S3FileIO with "
+ "any s3-compatible object storage service that has a different endpoint, or "
Expand All @@ -115,43 +117,43 @@ public class IcebergConfig extends Config implements OverwriteDefaultConfig {
.create();

public static final ConfigEntry<String> S3_REGION =
new ConfigBuilder(IcebergConstants.GRAVITINO_S3_REGION)
new ConfigBuilder(S3Properties.GRAVITINO_S3_REGION)
.doc("The region of the S3 service")
.version(ConfigConstants.VERSION_0_6_0)
.stringConf()
.checkValue(StringUtils::isNotBlank, ConfigConstants.NOT_BLANK_ERROR_MSG)
.create();

public static final ConfigEntry<String> S3_ACCESS_KEY_ID =
new ConfigBuilder(IcebergConstants.GRAVITINO_S3_ACCESS_KEY_ID)
new ConfigBuilder(S3Properties.GRAVITINO_S3_ACCESS_KEY_ID)
.doc("The static access key ID used to access S3 data")
.version(ConfigConstants.VERSION_0_6_0)
.stringConf()
.create();

public static final ConfigEntry<String> S3_SECRET_ACCESS_KEY =
new ConfigBuilder(IcebergConstants.GRAVITINO_S3_SECRET_ACCESS_KEY)
new ConfigBuilder(S3Properties.GRAVITINO_S3_SECRET_ACCESS_KEY)
.doc("The static secret access key used to access S3 data")
.version(ConfigConstants.VERSION_0_6_0)
.stringConf()
.create();

public static final ConfigEntry<String> OSS_ENDPOINT =
new ConfigBuilder(IcebergConstants.GRAVITINO_OSS_ENDPOINT)
new ConfigBuilder(OSSProperties.GRAVITINO_OSS_ENDPOINT)
.doc("The endpoint of Aliyun OSS service")
.version(ConfigConstants.VERSION_0_7_0)
.stringConf()
.create();

public static final ConfigEntry<String> OSS_ACCESS_KEY_ID =
new ConfigBuilder(IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_ID)
new ConfigBuilder(OSSProperties.GRAVITINO_OSS_ACCESS_KEY_ID)
.doc("The static access key ID used to access OSS data")
.version(ConfigConstants.VERSION_0_7_0)
.stringConf()
.create();

public static final ConfigEntry<String> OSS_ACCESS_KEY_SECRET =
new ConfigBuilder(IcebergConstants.GRAVITINO_OSS_ACCESS_KEY_SECRET)
new ConfigBuilder(OSSProperties.GRAVITINO_OSS_ACCESS_KEY_SECRET)
.doc("The static secret access key used to access OSS data")
.version(ConfigConstants.VERSION_0_7_0)
.stringConf()
Expand Down
Loading