forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Storage volume support hdfs configuration (StarRocks#33004)
Signed-off-by: Zijie Lu <[email protected]> Signed-off-by: Moonm3n <[email protected]>
- Loading branch information
1 parent
6ffc788
commit bba8c98
Showing
9 changed files
with
248 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ore/src/main/java/com/starrocks/credential/hdfs/StrictHDFSCloudConfigurationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed 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 | ||
// | ||
// https://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 com.starrocks.credential.hdfs; | ||
|
||
import com.starrocks.credential.CloudConfiguration; | ||
import com.starrocks.credential.CloudConfigurationConstants; | ||
|
||
import java.util.Map; | ||
|
||
public class StrictHDFSCloudConfigurationProvider extends HDFSCloudConfigurationProvider { | ||
@Override | ||
public CloudConfiguration build(Map<String, String> properties) { | ||
Map<String, String> prop = preprocessProperties(properties); | ||
|
||
HDFSCloudCredential hdfsCloudCredential = new StrictHDFSCloudCredential( | ||
getOrDefault(properties, CloudConfigurationConstants.HDFS_AUTHENTICATION), | ||
getOrDefault(properties, CloudConfigurationConstants.HDFS_USERNAME, | ||
CloudConfigurationConstants.HDFS_USERNAME_DEPRECATED), | ||
getOrDefault(properties, CloudConfigurationConstants.HDFS_PASSWORD, | ||
CloudConfigurationConstants.HDFS_PASSWORD_DEPRECATED), | ||
getOrDefault(properties, CloudConfigurationConstants.HDFS_KERBEROS_PRINCIPAL, | ||
CloudConfigurationConstants.HDFS_KERBEROS_PRINCIPAL_DEPRECATED), | ||
getOrDefault(properties, CloudConfigurationConstants.HADOOP_KERBEROS_KEYTAB, | ||
CloudConfigurationConstants.HDFS_KERBEROS_KEYTAB_DEPRECATED), | ||
getOrDefault(properties, CloudConfigurationConstants.HADOOP_KERBEROS_KEYTAB_CONTENT, | ||
CloudConfigurationConstants.HDFS_KERBEROS_KEYTAB_CONTENT_DEPRECATED), | ||
prop | ||
); | ||
if (!hdfsCloudCredential.validate()) { | ||
return null; | ||
} | ||
|
||
return new HDFSCloudConfiguration(hdfsCloudCredential); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
fe/fe-core/src/main/java/com/starrocks/credential/hdfs/StrictHDFSCloudCredential.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed 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 | ||
// | ||
// https://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 com.starrocks.credential.hdfs; | ||
|
||
import java.util.Map; | ||
|
||
public class StrictHDFSCloudCredential extends HDFSCloudCredential { | ||
public StrictHDFSCloudCredential(String authentication, String username, String password, String kerberosPrincipal, | ||
String keytab, String keytabContent, Map<String, String> hadoopConfiguration) { | ||
super(authentication, username, password, kerberosPrincipal, keytab, keytabContent, hadoopConfiguration); | ||
} | ||
|
||
@Override | ||
public boolean validate() { | ||
if (!authentication.isEmpty()) { | ||
return authentication.equals(SIMPLE_AUTH) || authentication.equals(KERBEROS_AUTH); | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.