Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multiple improvements for REANA 0.9.4 #615

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions reana_workflow_controller/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import os
import json

from reana_commons.config import REANA_COMPONENT_PREFIX, SHARED_VOLUME_PATH
from reana_commons.config import (
MQ_CONNECTION_STRING,
REANA_COMPONENT_PREFIX,
SHARED_VOLUME_PATH,
)
from reana_db.models import JobStatus, RunStatus

from reana_workflow_controller.version import __version__
Expand All @@ -22,6 +26,9 @@ def _env_vars_dict_to_k8s_list(env_vars):
return [{"name": name, "value": str(value)} for name, value in env_vars.items()]


SECRET_KEY = os.getenv("REANA_SECRET_KEY", "CHANGE_ME")
"""Secret key used for the application user sessions."""

SQLALCHEMY_TRACK_MODIFICATIONS = False
"""Track modifications flag."""

Expand Down Expand Up @@ -119,7 +126,8 @@ def _env_vars_dict_to_k8s_list(env_vars):
"""

WORKFLOW_ENGINE_COMMON_ENV_VARS = [
{"name": "SHARED_VOLUME_PATH", "value": SHARED_VOLUME_PATH}
{"name": "SHARED_VOLUME_PATH", "value": SHARED_VOLUME_PATH},
{"name": "RABBIT_MQ", "value": MQ_CONNECTION_STRING},
]
"""Common to all workflow engines environment variables."""

Expand Down
1 change: 0 additions & 1 deletion reana_workflow_controller/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def create_app(config_mapping=None):
if config_mapping:
app.config.from_mapping(config_mapping)

app.secret_key = "super secret key"
# Register API routes
from reana_workflow_controller.rest import (
workflows_session,
Expand Down
4 changes: 3 additions & 1 deletion reana_workflow_controller/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ def add_environment_variable(self, name, value):

def add_run_with_root_permissions(self):
"""Run interactive session with root."""
security_context = client.V1SecurityContext(run_as_user=0)
security_context = client.V1SecurityContext(
run_as_user=0, allow_privilege_escalation=False
)
self._session_container.security_context = security_context

def add_user_secrets(self):
Expand Down
1 change: 1 addition & 0 deletions reana_workflow_controller/workflow_run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def _create_job_spec(
workflow_engine_container.security_context = client.V1SecurityContext(
run_as_group=WORKFLOW_RUNTIME_USER_GID,
run_as_user=WORKFLOW_RUNTIME_USER_UID,
allow_privilege_escalation=False,
)
workflow_engine_container.volume_mounts = [workspace_mount]

Expand Down
Loading