<#3184 Do not set group or group_version when secr...
# flyte-github
c
#3184 Do not set group or group_version when secret_requires_group=False Pull request opened by thomasjpfan ## Why are the changes needed? Overriding
group
and
group_version
is a bug when trying to get the secret from
SecretManager
. We already have a check during registration time: flytekit/flytekit/models/security.py Lines 54 to 56 in</flyteorg/flytekit/commit/fc5421e1692b04bf72c69fc0f1fba319ea3428d3|fc5421e> | in_registration_context = execution.mode is None | | ------------------------------------------------------------------------------------------- | | if in_registration_context and get_plugin().secret_requires_group() and self.group is None: | | raise ValueError("Group is a required parameter") | This means that during registration time, we'll check if groups are required. During runtime, there are two cases (assuming
secret_requires_group=True
): 1. If the secret manager requires groups, then
Secret(group="...")
is configured correctly. 2. If the secret manager does not require group, then compiling passes and
group
is set to
None
already. ## What changes were proposed in this pull request? This PR removes the check for groups in
SecretManager
. ## How was this patch tested? A unit test was added to this PR. On sandbox, I created a kubernetes secret: kubectl create secret -n flytesnacks-development generic my-group --from-literal=token=abc-xyz And ran: from flytekit import Secret, task, current_context, ImageSpec new_flytekit = "git+https://github.com/thomasjpfan/flytekit.git@9d6d5481dd42a746bc0973b03c7a79414655a084" image = ImageSpec( apt_packages=["git"], packages=["union>=0.1.155"], registry="localhost:30000", commands=[f"uv pip install {new_flytekit}"], ) @task(secret_requests=[Secret(key="token", group="my-group")], container_image=image) def get_secret() -> str: return current_context().secrets.get(key="token", group="my-group") If I use the latest release of
flytekit
, then the above will fail. With this PR, it passes and returns the secret. ### Summary by Bito This PR fixes a bug in SecretManager by removing redundant group parameter validation in flytekit/core/context_manager.py, aligning with registration-time validations. A unit test was added to verify secret retrieval works correctly when the secret manager doesn't require group information. Unit tests added: True Estimated effort to review (1-5, lower is better): 1 flyteorg/flytekit