use of io.kubernetes.client.openapi.models.V1SecurityContextBuilder in project cdap by caskdata.
the class KubeTwillPreparer method withSecurityContext.
@Override
public SecureTwillPreparer withSecurityContext(String runnableName, SecurityContext securityContext) {
if (securityContext.getIdentity() != null) {
setIdentity(runnableName, securityContext.getIdentity());
}
if (securityContext.getUserId() != null || securityContext.getGroupId() != null) {
V1SecurityContextBuilder builder = new V1SecurityContextBuilder();
if (securityContext.getUserId() != null) {
builder.withRunAsUser(securityContext.getUserId());
}
if (securityContext.getGroupId() != null) {
builder.withRunAsGroup(securityContext.getGroupId());
}
containerSecurityContexts.put(runnableName, builder.build());
}
return this;
}
Aggregations