Skip to content

Commit

Permalink
Disabling usage of user account service in openshift-connector
Browse files Browse the repository at this point in the history
Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
  • Loading branch information
sunix committed Jun 29, 2017
1 parent cf51b1c commit 77329e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public class OpenShiftConnector extends DockerConnector {

private final OpenShiftClient openShiftClient;
private final String openShiftCheProjectName;
private final String openShiftCheServiceAccount;
private final int openShiftLivenessProbeDelay;
private final int openShiftLivenessProbeTimeout;
private final String workspacesPersistentVolumeClaim;
Expand All @@ -182,7 +181,6 @@ public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration,
DockerApiVersionPathPrefixProvider dockerApiVersionPathPrefixProvider,
@Named("che.docker.ip.external") String cheServerExternalAddress,
@Named("che.openshift.project") String openShiftCheProjectName,
@Named("che.openshift.serviceaccountname") String openShiftCheServiceAccount,
@Named("che.openshift.liveness.probe.delay") int openShiftLivenessProbeDelay,
@Named("che.openshift.liveness.probe.timeout") int openShiftLivenessProbeTimeout,
@Named("che.openshift.workspaces.pvc.name") String workspacesPersistentVolumeClaim,
Expand All @@ -193,7 +191,6 @@ public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration,
super(connectorConfiguration, connectionFactory, authResolver, dockerApiVersionPathPrefixProvider);
this.cheServerExternalAddress = cheServerExternalAddress;
this.openShiftCheProjectName = openShiftCheProjectName;
this.openShiftCheServiceAccount = openShiftCheServiceAccount;
this.openShiftLivenessProbeDelay = openShiftLivenessProbeDelay;
this.openShiftLivenessProbeTimeout = openShiftLivenessProbeTimeout;
this.workspacesPersistentVolumeClaim = workspacesPersistentVolumeClaim;
Expand Down Expand Up @@ -1007,7 +1004,6 @@ private String createOpenShiftDeployment(String workspaceID,
.withPorts(KubernetesContainer.getContainerPortsFrom(exposedPorts))
.withImagePullPolicy(OPENSHIFT_IMAGE_PULL_POLICY_IFNOTPRESENT)
.withNewSecurityContext()
.withRunAsUser(UID)
.withPrivileged(false)
.endSecurityContext()
.withLivenessProbe(getLivenessProbeFrom(exposedPorts))
Expand All @@ -1017,7 +1013,6 @@ private String createOpenShiftDeployment(String workspaceID,
PodSpec podSpec = new PodSpecBuilder()
.withContainers(container)
.withVolumes(getVolumesFrom(volumes, workspaceID))
.withServiceAccountName(this.openShiftCheServiceAccount)
.build();

Deployment deployment = new DeploymentBuilder()
Expand Down Expand Up @@ -1227,7 +1222,7 @@ private List<VolumeMount> getVolumeMountsFrom(String[] volumes, String workspace
VolumeMount vm = new VolumeMountBuilder()
.withMountPath(mountPath)
.withName(workspacesPersistentVolumeClaim)
.withSubPath(subPath)
// .withSubPath(subPath)
.build();
vms.add(vm);
}
Expand Down Expand Up @@ -1280,7 +1275,7 @@ private List<Volume> getVolumesFrom(String[] volumes, String workspaceID) {

private PersistentVolumeClaim getClaimCheWorkspace() {
PersistentVolumeClaimList pvcList = openShiftClient.persistentVolumeClaims().inNamespace(openShiftCheProjectName).list();
for(PersistentVolumeClaim pvc:pvcList.getItems()) {
for(PersistentVolumeClaim pvc: pvcList.getItems()) {
if (workspacesPersistentVolumeClaim.equals(pvc.getMetadata().getName())) {
return pvc;
}
Expand All @@ -1294,7 +1289,7 @@ private PersistentVolumeClaim getClaimCheWorkspace() {
.withAnnotations(annotations)
.endMetadata()
.withNewSpec()
.withAccessModes("ReadWriteMany")
.withAccessModes("ReadWriteOnce")
.withNewResources()
.withRequests(requests)
.endResources()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
public class OpenShiftConnectorTest {
private static final String[] CONTAINER_ENV_VARIABLES = {"CHE_WORKSPACE_ID=abcd1234"};
private static final String CHE_DEFAULT_OPENSHIFT_PROJECT_NAME = "eclipse-che";
private static final String CHE_DEFAULT_OPENSHIFT_SERVICEACCOUNT = "cheserviceaccount";
private static final int OPENSHIFT_LIVENESS_PROBE_DELAY = 300;
private static final int OPENSHIFT_LIVENESS_PROBE_TIMEOUT = 1;
private static final String OPENSHIFT_DEFAULT_TOKEN = "91XMfu-FuNDkGjcIh6b0y1EtCvztGeSsSqRrWhBfyL8";
private static final String OPENSHIFT_DEFAULT_WORKSPACE_PERSISTENT_VOLUME_CLAIM = "che_claim_data";
private static final String OPENSHIFT_DEFAULT_WORKSPACE_QUANTITY = "10Gi";
private static final String OPENSHIFT_DEFAULT_WORKSPACE_STORAGE = "/data/workspaces";
Expand Down Expand Up @@ -70,7 +68,6 @@ public void shouldGetWorkspaceIDWhenAValidOneIsProvidedInCreateContainerParams()
dockerApiVersionPathPrefixProvider,
CHE_DEFAULT_SERVER_EXTERNAL_ADDRESS,
CHE_DEFAULT_OPENSHIFT_PROJECT_NAME,
CHE_DEFAULT_OPENSHIFT_SERVICEACCOUNT,
OPENSHIFT_LIVENESS_PROBE_DELAY,
OPENSHIFT_LIVENESS_PROBE_TIMEOUT,
OPENSHIFT_DEFAULT_WORKSPACE_PERSISTENT_VOLUME_CLAIM,
Expand Down

0 comments on commit 77329e3

Please sign in to comment.