Skip to content

Commit

Permalink
NOTIC: Add rights to manage daemonsets
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjjke committed Dec 16, 2024
1 parent dc1be9d commit 49f0d9a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rules:
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- statefulsets
verbs:
Expand Down
1 change: 1 addition & 0 deletions helm/soperator/templates/manager-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ rules:
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- statefulsets
verbs:
Expand Down
36 changes: 23 additions & 13 deletions images/jail/scripts/createuser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
set -e

if [[ $# -eq 0 ]] || [[ "$*" == *"-h"* ]] || [[ "$*" == *"--help"* ]]; then
echo "Usage: createuser <username> [--with-password] [--without-sudo] [--without-docker]"
echo " [--without-ssh-key] [<args for adduser...>]"
echo "Usage: createuser <username> [--with-password] [--without-sudo] [--without-docker] [<args for adduser...>]"
exit 0
fi

Expand Down Expand Up @@ -46,18 +45,29 @@ if [[ "$*" != *"--without-docker"* ]]; then
add_to_group docker
fi

if [ -n "$ssh_public_key" ]; then
home_dir=$(eval echo "~$username")
ssh_dir="$home_dir/.ssh"
if [ ! -d "$ssh_dir" ]; then
mkdir -p "$ssh_dir"
chown "$username:$username" "$ssh_dir"
chmod 700 "$ssh_dir"
fi
home_dir=$(eval echo "~$username")
ssh_dir="$home_dir/.ssh"
authorized_keys="$ssh_dir/authorized_keys"
internal_key="$ssh_dir/id_ecdsa"

authorized_keys="$ssh_dir/authorized_keys"
echo "Saving SSH key to '${authorized_keys}'"
echo "$ssh_public_key" >> "$authorized_keys"
if [ ! -d "$ssh_dir" ]; then
mkdir -p "$ssh_dir"
chown "$username:$username" "$ssh_dir"
chmod 700 "$ssh_dir"
fi

if [ ! -f "$authorized_keys" ]; then
touch "$authorized_keys"
chown "$username:$username" "$authorized_keys"
chmod 600 "$authorized_keys"
fi

if [ -n "$ssh_public_key" ]; then
echo "Saving SSH key to '${authorized_keys}' ..."
echo "$ssh_public_key" >> "$authorized_keys"
fi

echo "Generating an internal SSH key pair ..."
ssh-keygen -t ecdsa -f "$internal_key" -N ''
chown "$username:$username" "$internal_key" "$internal_key.pub"
cat "$internal_key.pub" >> "$authorized_keys"
2 changes: 1 addition & 1 deletion images/worker/docker/daemon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hosts": [
"unix:///var/run/docker.sock",
"unix:///var/run/docker.sock"
],
"runtimes": {
"nvidia": {
Expand Down
1 change: 1 addition & 0 deletions internal/controller/clustercontroller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import (
//+kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch;update;patch;delete;create
//+kubebuilder:rbac:groups=k8s.mariadb.com,resources=mariadbs,verbs=get;list;watch;update;patch;delete;create
//+kubebuilder:rbac:groups=k8s.mariadb.com,resources=grants,verbs=get;list;watch;update;patch;delete;create
//+kubebuilder:rbac:groups=apps,resources=daemonsets,verbs=get;list;watch;update;patch;delete;create

// SlurmClusterReconciler reconciles a SlurmCluster object
type SlurmClusterReconciler struct {
Expand Down
1 change: 0 additions & 1 deletion internal/render/common/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ func RenderConfigMapSecurityLimits(componentType consts.ComponentType, cluster *

func generateUnlimitedSecurityLimitsConfig() renderutils.ConfigFile {
res := &renderutils.MultilineStringConfig{}
res.AddLine("#Empty security limits file")
res.AddLine("# Set core file size to unlimited (-c)")
res.AddLine("* soft core unlimited")
res.AddLine("* hard core unlimited")
Expand Down

0 comments on commit 49f0d9a

Please sign in to comment.