ashishkumar50 commented on code in PR #4389:
URL: https://github.com/apache/ozone/pull/4389#discussion_r1173721257


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/S3SecretManagerImpl.java:
##########
@@ -64,6 +69,10 @@ public String getSecretString(String awsAccessKey)
         "awsAccessKeyId cannot be null or empty.");
     LOG.trace("Get secret for awsAccessKey:{}", awsAccessKey);
 
+    S3SecretValue cacheValue = s3SecretCache.get(awsAccessKey);
+    if (cacheValue != null) {
+      return cacheValue.getAwsSecret();
+    }
     S3SecretValue s3Secret = s3SecretStore.getSecret(awsAccessKey);

Review Comment:
   How does cache is helping here? Cache value will get inserted only during 
first time when getsecret is invoked or setsecret. Since cache will expire 
after sometime, always there will be cache miss and it will try to get secret 
from vault which will be more costly compare to current rocksdb retrieval. 



##########
hadoop-ozone/s3-secret-store/src/main/java/org/apache/hadoop/ozone/s3/remote/vault/auth/AuthType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.hadoop.ozone.s3.remote.vault.auth;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.ozone.s3.remote.S3SecretRemoteStoreConfigurationKeys;
+
+import static 
org.apache.hadoop.ozone.s3.remote.S3SecretRemoteStoreConfigurationKeys.APP_ROLE_ID;
+import static 
org.apache.hadoop.ozone.s3.remote.S3SecretRemoteStoreConfigurationKeys.APP_ROLE_PATH;
+import static 
org.apache.hadoop.ozone.s3.remote.S3SecretRemoteStoreConfigurationKeys.APP_ROLE_SECRET;
+import static 
org.apache.hadoop.ozone.s3.remote.S3SecretRemoteStoreConfigurationKeys.AUTH_TYPE;
+
+/**
+ * Type of authentication method.
+ */
+public enum AuthType {
+  APP_ROLE,
+  TOKEN;
+
+  public static Auth fromConf(Configuration conf) {
+    AuthType authType = AuthType.valueOf(conf.get(AUTH_TYPE).toUpperCase());
+    switch (authType) {
+    case TOKEN:
+      String token = conf.get(S3SecretRemoteStoreConfigurationKeys.TOKEN);

Review Comment:
   Is there any validity of vault token? We should consider renewing the token 
if expires, otherwise vault communication will fail.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -754,8 +758,27 @@ private void instantiateServices(boolean withNewSnapshot) 
throws IOException {
     }
     volumeManager = new VolumeManagerImpl(metadataManager);
     bucketManager = new BucketManagerImpl(metadataManager);
+
+    Class<? extends S3SecretStoreProvider> storeProviderClass =
+        configuration.getClass(
+            S3_SECRET_STORAGE_TYPE,
+            DEFAULT_SECRET_STORAGE_TYPE,
+            S3SecretStoreProvider.class);
+    S3SecretStore store;
+    try {
+      store = storeProviderClass == DEFAULT_SECRET_STORAGE_TYPE
+              ? metadataManagerImpl

Review Comment:
   Before migrating to store like vault, there might be secrets present in 
default rocksdb. In this case operations will fail if we directly switch to 
vault without considering this. Is there way to retrieve those and migrate 
those secrets to vault?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to