Skip to content

Commit 8efdf91

Browse files
improve coverage and fix bad var handling
Signed-off-by: ttitsworth-fsp <[email protected]>
1 parent 965b291 commit 8efdf91

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

flyteadmin/pkg/manager/impl/execution_manager.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,12 @@ func (m *ExecutionManager) addIdentityAnnotations(ctx context.Context, initialAn
20662066
// Get identity from authentication context
20672067
identityContext := auth.IdentityContextFromContext(ctx)
20682068

2069+
// Check if identity context is empty
2070+
if identityContext.IsEmpty() {
2071+
logger.Debugf(ctx, "No identity information found in context, skipping identity annotation injection")
2072+
return initialAnnotations
2073+
}
2074+
20692075
if initialAnnotations == nil {
20702076
initialAnnotations = make(map[string]string)
20712077
}
@@ -2075,12 +2081,7 @@ func (m *ExecutionManager) addIdentityAnnotations(ctx context.Context, initialAn
20752081

20762082
// Determine if this is an app or user identity
20772083
isAppIdentity := identityContext.AppID() != ""
2078-
isUserIdentity := identityContext.UserInfo() != nil
2079-
2080-
if !isAppIdentity && !isUserIdentity {
2081-
logger.Debugf(ctx, "No identity information found in context, skipping identity annotation injection")
2082-
return initialAnnotations
2083-
}
2084+
isUserIdentity := identityContext.UserInfo() != nil && !isAppIdentity
20842085

20852086
// Add annotations based on identity type
20862087
if isAppIdentity {

flyteadmin/pkg/manager/impl/execution_manager_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6568,4 +6568,5 @@ func TestAddIdentityAnnotations(t *testing.T) {
65686568
assert.NotContains(t, result, "flyte.ai/user-unknown-key")
65696569
assert.Equal(t, "value", result["existing"])
65706570
})
6571+
65716572
}

0 commit comments

Comments
 (0)