Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into HDDS-815
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvekshayr committed Feb 9, 2024
2 parents 2cbabcc + c1efa33 commit 9527771
Show file tree
Hide file tree
Showing 130 changed files with 1,766 additions and 1,451 deletions.
8 changes: 8 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,14 @@
<tag>OZONE, SECURITY, KERBEROS</tag>
<description>The OzoneManager service principal. Ex om/_HOST@REALM.COM</description>
</property>
<property>
<name>ozone.om.kerberos.principal.pattern</name>
<value>*</value>
<description>
A client-side RegEx that can be configured to control
allowed realms to authenticate with (useful in cross-realm env.)
</description>
</property>
<property>
<name>ozone.om.http.auth.kerberos.principal</name>
<value>HTTP/_HOST@REALM</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

package org.apache.hadoop.ozone.client;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.hadoop.ozone.OzoneAcl;
import org.apache.hadoop.ozone.OzoneConsts;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -36,8 +39,8 @@ public final class VolumeArgs {
private final String owner;
private final long quotaInBytes;
private final long quotaInNamespace;
private final List<OzoneAcl> acls;
private Map<String, String> metadata;
private final ImmutableList<OzoneAcl> acls;
private final ImmutableMap<String, String> metadata;

/**
* Private constructor, constructed via builder.
Expand All @@ -58,8 +61,8 @@ private VolumeArgs(String admin,
this.owner = owner;
this.quotaInBytes = quotaInBytes;
this.quotaInNamespace = quotaInNamespace;
this.acls = acls;
this.metadata = metadata;
this.acls = acls == null ? ImmutableList.of() : ImmutableList.copyOf(acls);
this.metadata = metadata == null ? ImmutableMap.of() : ImmutableMap.copyOf(metadata);
}

/**
Expand Down Expand Up @@ -107,34 +110,20 @@ public List<OzoneAcl> getAcls() {
return acls;
}

/**
* Returns new builder class that builds a OmVolumeArgs.
*
* @return Builder
*/
public static VolumeArgs.Builder newBuilder() {
return new VolumeArgs.Builder();
}

/**
* Builder for OmVolumeArgs.
* Builder for VolumeArgs.
*/
@SuppressWarnings("checkstyle:hiddenfield")
public static class Builder {
private String adminName;
private String ownerName;
private long quotaInBytes;
private long quotaInNamespace;
private List<OzoneAcl> listOfAcls;
private Map<String, String> metadata = new HashMap<>();

/**
* Constructs a builder.
*/
public Builder() {
quotaInBytes = OzoneConsts.QUOTA_RESET;
quotaInNamespace = OzoneConsts.QUOTA_RESET;
}
private long quotaInBytes = OzoneConsts.QUOTA_RESET;
private long quotaInNamespace = OzoneConsts.QUOTA_RESET;
private List<OzoneAcl> acls;
private Map<String, String> metadata;

public VolumeArgs.Builder setAdmin(String admin) {
this.adminName = admin;
Expand All @@ -157,12 +146,18 @@ public VolumeArgs.Builder setQuotaInNamespace(long quota) {
}

public VolumeArgs.Builder addMetadata(String key, String value) {
if (metadata == null) {
metadata = new HashMap<>();
}
metadata.put(key, value);
return this;
}
public VolumeArgs.Builder setAcls(List<OzoneAcl> acls)
public VolumeArgs.Builder addAcl(OzoneAcl acl)
throws IOException {
this.listOfAcls = acls;
if (acls == null) {
acls = new ArrayList<>();
}
acls.add(acl);
return this;
}

Expand All @@ -172,7 +167,7 @@ public VolumeArgs.Builder setAcls(List<OzoneAcl> acls)
*/
public VolumeArgs build() {
return new VolumeArgs(adminName, ownerName, quotaInBytes,
quotaInNamespace, listOfAcls, metadata);
quotaInNamespace, acls, metadata);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ public void createVolume(String volumeName, VolumeArgs volArgs)
userGroups.stream().forEach((group) -> listOfAcls.add(
new OzoneAcl(ACLIdentityType.GROUP, group, groupRights, ACCESS)));
//ACLs from VolumeArgs
if (volArgs.getAcls() != null) {
listOfAcls.addAll(volArgs.getAcls());
List<OzoneAcl> volumeAcls = volArgs.getAcls();
if (volumeAcls != null) {
listOfAcls.addAll(volumeAcls);
}

OmVolumeArgs.Builder builder = OmVolumeArgs.newBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ private OMConfigKeys() {
+ "kerberos.keytab.file";
public static final String OZONE_OM_KERBEROS_PRINCIPAL_KEY = "ozone.om"
+ ".kerberos.principal";
public static final String OZONE_OM_KERBEROS_PRINCIPAL_PATTERN_KEY =
"ozone.om.kerberos.principal.pattern";
public static final String OZONE_OM_HTTP_KERBEROS_KEYTAB_FILE =
"ozone.om.http.auth.kerberos.keytab";
public static final String OZONE_OM_HTTP_KERBEROS_PRINCIPAL_KEY
Expand Down
Loading

0 comments on commit 9527771

Please sign in to comment.