Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Merge branch 'ddl-ebrown.DOM-46168-check-for-group'
Browse files Browse the repository at this point in the history
* ddl-ebrown.DOM-46168-check-for-group:
  Add docker-build-mpi Makefile target
  [DOM-46168] Fix MPI script when gid 12574 exists
  • Loading branch information
ddl-ebrown committed Apr 24, 2023
2 parents 7929d5b + 77f5829 commit c3e9a5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ SHELL := /bin/bash

# Image URL to use all building/pushing image targets
IMG ?= ghcr.io/dominodatalab/distributed-compute-operator:latest
MPI_INIT_IMG ?= quay.io/domino/distributed-compute-operator-mpi-init:latest
MPI_SYNC_IMG ?= quay.io/domino/distributed-compute-operator-mpi-sync:latest
# Produce CRDs that work with Kubernetes 1.16+ and supports defaulting, api
# version conversion, and field pruning.
CRD_OPTIONS ?= "crd:crdVersions=v1,maxDescLen=100"
Expand Down Expand Up @@ -63,6 +65,10 @@ build: generate fmt ## Build manager binary.
run: manifests generate fmt ## Run a controller from your host.
go run ./main.go start

docker-build-mpi:
docker build -t $(MPI_INIT_IMG) ./dockerfiles --file ./dockerfiles/mpi-init.Dockerfile
docker build -t $(MPI_SYNC_IMG) ./dockerfiles --file ./dockerfiles/mpi-sync.Dockerfile

docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .

Expand Down
14 changes: 10 additions & 4 deletions dockerfiles/mpi-worker-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ fi
if ! id $DOMINO_UID >/dev/null 2>&1; then
useradd -u $DOMINO_UID -g $DOMINO_GID -mN -s /bin/bash -d "$DOMINO_HOME_DIR" $DOMINO_USER
else
# Change username of user with matching userid if needed
# Change username of user with matching userid if needed
EXISTING_USER=$(id -nu $DOMINO_UID)
if [ "$EXISTING_USER" != "$DOMINO_USER" ]; then
usermod -l $DOMINO_USER $EXISTING_USER
fi

# Change groupname of group with matching groupid if needed
EXISTING_GROUP=$(id -ng $DOMINO_GID)
if [ "$EXISTING_GROUP" != "$DOMINO_GROUP" ]; then
groupmod --new-name $DOMINO_GROUP $EXISTING_GROUP
fi

# Change home directory (idempotent)
usermod -d "$DOMINO_HOME_DIR" $DOMINO_USER

# Add to domino group (idempotent)
usermod -a -G $DOMINO_GROUP $DOMINO_USER
# Add to domino group (idempotent)
usermod -a -G $DOMINO_GROUP $DOMINO_USER
fi


Expand Down Expand Up @@ -81,4 +87,4 @@ AllowUsers $DOMINO_USER
EOF
chmod 444 "$CONFIG_DIR/sshd_config"

su -c "$INSTALL_DIR/sbin/sshd -f \"$CONFIG_DIR/sshd_config\" -De" - $DOMINO_USER
su -c "$INSTALL_DIR/sbin/sshd -f \"$CONFIG_DIR/sshd_config\" -De" - $DOMINO_USER

0 comments on commit c3e9a5c

Please sign in to comment.