Skip to content

Commit ec1d453

Browse files
vivekratnavelbharatviswa504
authored andcommitted
HDDS-1788. Fix kerberos principal error in Ozone Recon. (#1201)
1 parent 8f40856 commit ec1d453

File tree

9 files changed

+39
-24
lines changed

9 files changed

+39
-24
lines changed

hadoop-hdds/common/src/main/resources/ozone-default.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@
612612
<description>
613613
The actual address the OM web server will bind to using HTTPS.
614614
If this optional address is set, it overrides only the hostname portion of
615-
ozone.om.http-address.
615+
ozone.om.https-address.
616616
</description>
617617
</property>
618618
<property>
@@ -1040,7 +1040,7 @@
10401040
<description>
10411041
The actual address the SCM web server will bind to using HTTPS.
10421042
If this optional address is set, it overrides only the hostname portion of
1043-
ozone.scm.http-address.
1043+
ozone.scm.https-address.
10441044
</description>
10451045
</property>
10461046
<property>
@@ -1525,7 +1525,7 @@
15251525
<value>5m</value>
15261526
<tag>OZONE, OM</tag>
15271527
<description>Time interval used to store the omMetrics in to a
1528-
file. Background thread perodically stores the OM metrics in to a
1528+
file. Background thread periodically stores the OM metrics in to a
15291529
file. Unit could be defined with postfix (ns,ms,s,m,h,d)
15301530
</description>
15311531
</property>

hadoop-ozone/dist/src/main/compose/ozonesecure-mr/docker-image/docker-krb5/Dockerfile-krb5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Unless required by applicable law or agreed to in writing, software
1212
# distributed under the License is distributed on an "AS IS" BASIS,
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License lsfor the specific language governing permissions and
14+
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

1717

hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ services:
6565
env_file:
6666
- ./docker-config
6767
command: ["/opt/hadoop/bin/ozone","s3g"]
68+
recon:
69+
image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
70+
hostname: recon
71+
volumes:
72+
- ../..:/opt/hadoop
73+
ports:
74+
- 9888:9888
75+
env_file:
76+
- ./docker-config
77+
environment:
78+
WAITFOR: om:9874
79+
ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
80+
command: ["/opt/hadoop/bin/ozone","recon"]
6881
scm:
6982
image: apache/ozone-runner:${HADOOP_RUNNER_VERSION}
7083
hostname: scm

hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ OZONE-SITE.XML_ozone.om.kerberos.principal=om/[email protected]
3333
OZONE-SITE.XML_ozone.om.kerberos.keytab.file=/etc/security/keytabs/om.keytab
3434
OZONE-SITE.XML_ozone.s3g.keytab.file=/etc/security/keytabs/HTTP.keytab
3535
OZONE-SITE.XML_ozone.s3g.authentication.kerberos.principal=HTTP/[email protected]
36+
OZONE-SITE.XML_ozone.recon.authentication.kerberos.principal=HTTP/[email protected]
37+
OZONE-SITE.XML_ozone.recon.keytab.file=/etc/security/keytabs/HTTP.keytab
38+
OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon
39+
OZONE-SITE.XML_recon.om.snapshot.task.initial.delay=20s
3640

3741
OZONE-SITE.XML_ozone.security.enabled=true
3842
OZONE-SITE.XML_ozone.acl.enabled=true

hadoop-ozone/dist/src/main/compose/ozonesecure/docker-image/docker-krb5/Dockerfile-krb5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Unless required by applicable law or agreed to in writing, software
1212
# distributed under the License is distributed on an "AS IS" BASIS,
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License lsfor the specific language governing permissions and
14+
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

1717

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
*/
1818
package org.apache.hadoop.ozone.recon;
1919

20-
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
21-
2220
import com.google.inject.Provider;
21+
import org.apache.hadoop.conf.Configuration;
22+
2323

2424
/**
2525
* Ozone Configuration Provider.
2626
* <p>
2727
* As the OzoneConfiguration is created by the CLI application here we inject
2828
* it via a singleton instance to the Jax-RS/CDI instances.
2929
*/
30-
public class OzoneConfigurationProvider implements
31-
Provider<OzoneConfiguration> {
30+
public class ConfigurationProvider implements
31+
Provider<Configuration> {
3232

33-
private static OzoneConfiguration configuration;
33+
private static Configuration configuration;
3434

35-
static void setConfiguration(OzoneConfiguration conf) {
36-
OzoneConfigurationProvider.configuration = conf;
35+
static void setConfiguration(Configuration conf) {
36+
ConfigurationProvider.configuration = conf;
3737
}
3838

3939
@Override
40-
public OzoneConfiguration get() {
40+
public Configuration get() {
4141
return configuration;
4242
}
4343
}

hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconControllerModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_SQL_MAX_IDLE_CONNECTION_AGE;
3030
import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_SQL_MAX_IDLE_CONNECTION_TEST_STMT;
3131

32+
import org.apache.hadoop.conf.Configuration;
3233
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
3334
import org.apache.hadoop.ozone.recon.persistence.DataSourceConfiguration;
3435
import org.apache.hadoop.ozone.recon.persistence.JooqPersistenceModule;
@@ -53,7 +54,7 @@
5354
public class ReconControllerModule extends AbstractModule {
5455
@Override
5556
protected void configure() {
56-
bind(OzoneConfiguration.class).toProvider(OzoneConfigurationProvider.class);
57+
bind(Configuration.class).toProvider(ConfigurationProvider.class);
5758
bind(ReconHttpServer.class).in(Singleton.class);
5859
bind(DBStore.class)
5960
.toProvider(ReconContainerDBProvider.class).in(Singleton.class);

hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static void main(String[] args) {
6464
@Override
6565
public Void call() throws Exception {
6666
OzoneConfiguration ozoneConfiguration = createOzoneConfiguration();
67-
OzoneConfigurationProvider.setConfiguration(ozoneConfiguration);
67+
ConfigurationProvider.setConfiguration(ozoneConfiguration);
6868

6969
injector = Guice.createInjector(new
7070
ReconControllerModule(), new ReconRestServletModule() {

hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.hadoop.ozone.recon.spi.impl;
2020

21-
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_SECURITY_ENABLED_KEY;
2221
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_FLUSH;
2322
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT;
2423
import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_OM_SNAPSHOT_DB;
@@ -45,7 +44,9 @@
4544
import javax.inject.Singleton;
4645

4746
import org.apache.commons.io.FileUtils;
48-
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
47+
import org.apache.hadoop.conf.Configuration;
48+
import org.apache.hadoop.hdfs.DFSUtil;
49+
import org.apache.hadoop.http.HttpConfig;
4950
import org.apache.hadoop.ozone.om.OMConfigKeys;
5051
import org.apache.hadoop.ozone.om.OMMetadataManager;
5152
import org.apache.hadoop.ozone.recon.recovery.ReconOMMetadataManager;
@@ -74,14 +75,11 @@ public class OzoneManagerServiceProviderImpl
7475
private File omSnapshotDBParentDir = null;
7576
private String omDBSnapshotUrl;
7677

77-
@Inject
78-
private OzoneConfiguration configuration;
79-
8078
@Inject
8179
private ReconOMMetadataManager omMetadataManager;
8280

8381
@Inject
84-
public OzoneManagerServiceProviderImpl(OzoneConfiguration configuration) {
82+
public OzoneManagerServiceProviderImpl(Configuration configuration) {
8583

8684
String ozoneManagerHttpAddress = configuration.get(OMConfigKeys
8785
.OZONE_OM_HTTP_ADDRESS_KEY);
@@ -92,8 +90,7 @@ public OzoneManagerServiceProviderImpl(OzoneConfiguration configuration) {
9290
omSnapshotDBParentDir = getReconDbDir(configuration,
9391
OZONE_RECON_OM_SNAPSHOT_DB_DIR);
9492

95-
boolean ozoneSecurityEnabled = configuration.getBoolean(
96-
OZONE_SECURITY_ENABLED_KEY, false);
93+
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(configuration);
9794

9895
int socketTimeout = (int) configuration.getTimeDuration(
9996
RECON_OM_SOCKET_TIMEOUT, RECON_OM_SOCKET_TIMEOUT_DEFAULT,
@@ -118,7 +115,7 @@ public OzoneManagerServiceProviderImpl(OzoneConfiguration configuration) {
118115
omDBSnapshotUrl = "http://" + ozoneManagerHttpAddress +
119116
OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT;
120117

121-
if (ozoneSecurityEnabled) {
118+
if (policy.isHttpsEnabled()) {
122119
omDBSnapshotUrl = "https://" + ozoneManagerHttpsAddress +
123120
OZONE_OM_DB_CHECKPOINT_HTTP_ENDPOINT;
124121
}

0 commit comments

Comments
 (0)