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(k8s): set custom ingressClassName for interactive sessions (#581) #581

Merged
merged 1 commit into from
May 3, 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
3 changes: 3 additions & 0 deletions reana_workflow_controller/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ def _env_vars_dict_to_k8s_list(env_vars):
REANA_INGRESS_ANNOTATIONS = json.loads(os.getenv("REANA_INGRESS_ANNOTATIONS", "{}"))
"""REANA Ingress annotations defined by the administrator."""

REANA_INGRESS_CLASS_NAME = os.getenv("REANA_INGRESS_CLASS_NAME")
"""REANA Ingress class name defined by the administrator to be used for interactive sessions."""

IMAGE_PULL_SECRETS = os.getenv("IMAGE_PULL_SECRETS", "").split(",")
"""Docker image pull secrets which allow the usage of private images."""

Expand Down
5 changes: 4 additions & 1 deletion reana_workflow_controller/k8s.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of REANA.
# Copyright (C) 2019, 2020, 2021, 2022 CERN.
# Copyright (C) 2019, 2020, 2021, 2022, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -26,6 +26,7 @@
JUPYTER_INTERACTIVE_SESSION_DEFAULT_IMAGE,
JUPYTER_INTERACTIVE_SESSION_DEFAULT_PORT,
REANA_INGRESS_ANNOTATIONS,
REANA_INGRESS_CLASS_NAME,
)


Expand Down Expand Up @@ -105,6 +106,8 @@
spec = client.V1IngressSpec(
rules=[client.V1IngressRule(http=ingress_rule_value)]
)
if REANA_INGRESS_CLASS_NAME:
spec.ingress_class_name = REANA_INGRESS_CLASS_NAME

Check warning on line 110 in reana_workflow_controller/k8s.py

View check run for this annotation

Codecov / codecov/patch

reana_workflow_controller/k8s.py#L110

Added line #L110 was not covered by tests
ingress = client.V1Ingress(
api_version="networking.k8s.io/v1",
kind="Ingress",
Expand Down