Skip to content

Conversation

@elbamit
Copy link
Contributor

@elbamit elbamit commented Jan 4, 2026

📝 Description

Add support for IG4 authentication on workflows by mounting the secret on the argo pods.
This PR moves the core logic of enrich_and_validate_auth_token_name out of the launcher to a more common place so it can be used by workflows since they don't go through launcher/runtime handler.


🛠️ Changes Made

  • Move enrich_and_validate_auth_token_name core logic from launcher to mlrun.auth.utils
  • Create helper function resolve_auth_token_secret_name for pipelines that gets token name and then extract secret name.
  • Refactor replace_kfp_plaintext_secret_env_vars_with_secret_refs to process_kfp_workflow_secret_references to pass the auth_secret_name param so that it gets mounted to the argo pods during _enrich_kfp_workflow_yaml_credentials

✅ Checklist

  • I updated the documentation (if applicable)
  • I have tested the changes in this PR
  • I confirmed whether my changes are covered by system tests
    • If yes, I ran all relevant system tests and ensured they passed before submitting this PR
    • I updated existing system tests and/or added new ones if needed to cover my changes
  • If I introduced a deprecation:

🧪 Testing

Unit tests

  • test_resolve_auth_secret_name
  • test_enrich_and_validate_auth_token_name

🔗 References


🚨 Breaking Changes?

  • Yes (explain below)
  • No

🔍️ Additional Notes

…ns from the ServerSideLauncher to mlrun/auth/utils so it can be accessed without launcher (such as KFP). Launcher function has been refactored to only handle run/remoteRuntime objects before passing the required info to the new core logic functions. Nuclio endpoint has been updated accordingly.
…cret and use it during create_pipeline CRUD to extract the secret name to mount. Secret name is passed into pipeline adapter where it is mounted to the argo pods
Copy link
Member

@liranbg liranbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done, naming and some suggestions that improves readability


# TODO In ML-11600, implement token name resolution and validation + tests
def enrich_and_validate_auth_token_name(
def enrich_and_validate_auth_token_name_on_object(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def enrich_and_validate_auth_token_name_on_object(
def enrich_and_validate_auth_token_name(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is pretty obvious from the parameters that you apply it on the given object

# Resolve token name and raise error only if token is explicitly provided by the user
# in ML-11600, we will implement a proper resolution logic that checks all secret tokens
# of the user and finds a valid one if no token name is provided
raise_error_on_failure = bool(provided_token_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content_type: str,
env_var_names: list[str],
secrets_store: "SecretsStore",
secret_name: typing.Optional[str] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
secret_name: typing.Optional[str] = None,
auth_secret_name: typing.Optional[str] = None,

and change callees + others to reflect this is not an arbitrary secret but auth one

@elbamit elbamit marked this pull request as ready for review January 4, 2026 14:18
@elbamit elbamit requested review from a team and moranbental as code owners January 4, 2026 14:18
Copy link
Member

@liranbg liranbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really minor here



def replace_kfp_plaintext_secret_env_vars_with_secret_refs(
def process_kfp_workflow_secret_references(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to bump patch version for pipeline adapter (under pyproject.toml).

Comment on lines 320 to 338
def enrich_and_validate_auth_token_name(token_name: typing.Optional[str]):
if mlrun.mlconf.is_iguazio_v4_mode():
# Resolve token name and raise error only if token is explicitly provided by the user
raise_error_on_failure = bool(token_name)

# If token name not provided, use default
token_name = (
token_name or mlrun.common.constants.MLRUN_RUNTIME_AUTH_DEFAULT_TOKEN_NAME
)
validate_token_name(token_name, raise_error_on_failure=raise_error_on_failure)
return token_name


# TODO implement validation in ML-11600
def validate_token_name(
token_name: str,
raise_error_on_failure: bool = True,
):
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revisiting this agan, you dont do any enrichment nor validation here at this point (leaving some todos for validation) but honestly, I think it is better off KISSing it at this phase and remove this completely. moving the part of

token_name or mlrun.common.constants.MLRUN_RUNTIME_AUTH_DEFAULT_TOKEN_NAME
        )

to its callees

@liranbg liranbg merged commit 66d39c5 into mlrun:development Jan 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants