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

[Core feature] Override task secret_requests using with_overrides #2365

Closed
wants to merge 1 commit into from

Conversation

Mecoli1219
Copy link
Contributor

@Mecoli1219 Mecoli1219 commented Apr 21, 2024

Tracking issue

flyteorg/flyte#5085

Why are the changes needed?

with_overrides method should enable overriding secret_requests property.

What changes were proposed in this pull request?

Handling secret_requests inside with_overrides method, and adding the property override_security_context inside TaskNodeOverrides to send the overrides information to flyteAdmin.

How was this patch tested?

Check this PR: flyteorg/flyte#5261

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

flyteorg/flyte#5261

Docs link

Copy link

welcome bot commented Apr 21, 2024

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 21, 2024
@Mecoli1219 Mecoli1219 marked this pull request as draft April 21, 2024 07:33
@Mecoli1219
Copy link
Contributor Author

Mecoli1219 commented Apr 21, 2024

from flytekit import task, Secret, workflow
from flytekit.testing import SecretsManager
import typing
import flytekit
import os
import typing
from collections import OrderedDict

import flytekit
import flytekit.configuration
from flytekit.configuration import Image, ImageConfig
from flytekit.core.workflow import workflow
from flytekit.tools.translator import get_serializable

serialization_settings = flytekit.configuration.SerializationSettings(
    project="proj",
    domain="dom",
    version="123",
    image_config=ImageConfig(Image(name="name", fqn="asdf/fdsa", tag="123")),
    env={},
)


@task(secret_requests=[Secret("group1", key="key1")])
def foo() -> str:
    return "hello" + flytekit.current_context().secrets.get("group1", "key1")


@workflow
def my_wf() -> typing.Tuple[str, str]:
    overrides1 = {
        "secret_requests": [Secret("group3", key="key3")],
    }
    overrides2 = {
        "secret_requests": [Secret("group2", key="key2"), Secret("group3", key="key3")],
    }
    str1 = foo().with_overrides(**overrides2)
    str2 = foo().with_overrides(**overrides2)
    str2 = foo().with_overrides(**overrides2)
    str2 = foo().with_overrides(**overrides2)
    str2 = foo().with_overrides(**overrides2)

    return str1, str2


sec = SecretsManager()
os.environ[sec.get_secrets_env_var("group1", "key1")] = "super-secret-value1"
os.environ[sec.get_secrets_env_var("group2", "key2")] = "super-secret-value2"
os.environ[sec.get_secrets_env_var("group3", "key3")] = "super-secret-value3" 


# model_wf = get_serializable(OrderedDict(), serialization_settings, my_wf)

@Mecoli1219 Mecoli1219 force-pushed the #5085 branch 3 times, most recently from ab9c8cb to 1bca1a5 Compare May 7, 2024 13:40
@Mecoli1219 Mecoli1219 marked this pull request as ready for review May 7, 2024 14:08
@Mecoli1219 Mecoli1219 closed this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant