Skip to content
Open
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
2 changes: 1 addition & 1 deletion charts/flyte-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ helm install gateway bitnami/contour -n flyte
| common.ingress.tls | object | `{"enabled":false}` | - Ingress hostname host: |
| common.ingress.webpackHMR | bool | `false` | - Enable or disable HMR route to flyteconsole. This is useful only for frontend development. |
| configmap.admin | object | `{"admin":{"clientId":"{{ .Values.secrets.adminOauthClientCredentials.clientId }}","clientSecretLocation":"/etc/secrets/client_secret","endpoint":"flyteadmin:81","insecure":true},"event":{"capacity":1000,"rate":500,"type":"admin"}}` | Admin Client configuration [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/subworkflow/launchplan#AdminConfig) |
| configmap.adminServer | object | `{"auth":{"appAuth":{"thirdPartyConfig":{"flyteClient":{"clientId":"flytectl","redirectUri":"http://localhost:53593/callback","scopes":["offline","all"]}}},"authorizedUris":["https://localhost:30081","http://flyteadmin:80","http://flyteadmin.flyte.svc.cluster.local:80"],"userAuth":{"openId":{"baseUrl":"https://accounts.google.com","clientId":"657465813211-6eog7ek7li5k7i7fvgv2921075063hpe.apps.googleusercontent.com","scopes":["profile","openid"]}}},"flyteadmin":{"eventVersion":2,"metadataStoragePrefix":["metadata","admin"],"metricsScope":"flyte:","profilerPort":10254,"roleNameKey":"iam.amazonaws.com/role","testing":{"host":"http://flyteadmin"}},"server":{"grpc":{"port":8089},"httpPort":8088,"security":{"allowCors":true,"allowedHeaders":["Content-Type","flyte-authorization"],"allowedOrigins":["*"],"secure":false,"useAuth":false}}}` | FlyteAdmin server configuration |
| configmap.adminServer | object | `{"auth":{"appAuth":{"thirdPartyConfig":{"flyteClient":{"clientId":"flytectl","redirectUri":"http://localhost:53593/callback","scopes":["offline","all"]}}},"authorizedUris":["https://localhost:30081","http://flyteadmin:80","http://flyteadmin.flyte.svc.cluster.local:80"],"userAuth":{"openId":{"baseUrl":"https://accounts.google.com","clientId":"657465813211-6eog7ek7li5k7i7fvgv2921075063hpe.apps.googleusercontent.com","scopes":["profile","openid"]}}},"flyteadmin":{"eventVersion":2,"injectUserAnnotations":false,"metadataStoragePrefix":["metadata","admin"],"metricsScope":"flyte:","profilerPort":10254,"roleNameKey":"iam.amazonaws.com/role","testing":{"host":"http://flyteadmin"},"userAnnotationPrefix":"flyte.ai"},"server":{"grpc":{"port":8089},"httpPort":8088,"security":{"allowCors":true,"allowedHeaders":["Content-Type","flyte-authorization"],"allowedOrigins":["*"],"secure":false,"useAuth":false}}}` | FlyteAdmin server configuration |
| configmap.adminServer.auth | object | `{"appAuth":{"thirdPartyConfig":{"flyteClient":{"clientId":"flytectl","redirectUri":"http://localhost:53593/callback","scopes":["offline","all"]}}},"authorizedUris":["https://localhost:30081","http://flyteadmin:80","http://flyteadmin.flyte.svc.cluster.local:80"],"userAuth":{"openId":{"baseUrl":"https://accounts.google.com","clientId":"657465813211-6eog7ek7li5k7i7fvgv2921075063hpe.apps.googleusercontent.com","scopes":["profile","openid"]}}}` | Authentication configuration |
| configmap.adminServer.server.security.secure | bool | `false` | Controls whether to serve requests over SSL/TLS. |
| configmap.adminServer.server.security.useAuth | bool | `false` | Controls whether to enforce authentication. Follow the guide in https://docs.flyte.org/ on how to setup authentication. |
Expand Down
5 changes: 5 additions & 0 deletions charts/flyte-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,11 @@ configmap:
- "metadata"
- "admin"
eventVersion: 2
injectIdentityAnnotations: false
identityAnnotationPrefix: "flyte.ai"
identityAnnotationKeys:
- email
- sub
testing:
host: http://flyteadmin

Expand Down
4 changes: 3 additions & 1 deletion deployment/eks/flyte_aws_scheduler_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -174,6 +175,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -886,7 +888,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "6fd4bb5460f260b492db7ddd34b6011581292e88b28c2e4514b7da75673cd4d"
configChecksum: "71783b5be9ab6a2bbb2fa40b936c74b39c6dcf60d70979daede4d9449ce944d"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_helm_controlplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -155,6 +156,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -583,7 +585,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "b1a6f6afb902bd1384515a97c5bad38985c0799ca8173efb0e664bda8eb9ca1"
configChecksum: "92eb8185e329f235bc30c58f192a9ab6a2840f64a379ef53fe2571bc468ab22"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down Expand Up @@ -1009,7 +1011,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "b1a6f6afb902bd1384515a97c5bad38985c0799ca8173efb0e664bda8eb9ca1"
configChecksum: "92eb8185e329f235bc30c58f192a9ab6a2840f64a379ef53fe2571bc468ab22"
labels:
app.kubernetes.io/name: flytescheduler
app.kubernetes.io/instance: flyte
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -186,6 +187,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -917,7 +919,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "b1a6f6afb902bd1384515a97c5bad38985c0799ca8173efb0e664bda8eb9ca1"
configChecksum: "92eb8185e329f235bc30c58f192a9ab6a2840f64a379ef53fe2571bc468ab22"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down Expand Up @@ -1343,7 +1345,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "b1a6f6afb902bd1384515a97c5bad38985c0799ca8173efb0e664bda8eb9ca1"
configChecksum: "92eb8185e329f235bc30c58f192a9ab6a2840f64a379ef53fe2571bc468ab22"
labels:
app.kubernetes.io/name: flytescheduler
app.kubernetes.io/instance: flyte
Expand Down
6 changes: 4 additions & 2 deletions deployment/gcp/flyte_helm_controlplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -155,6 +156,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -600,7 +602,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "e952d320a403549f597a6e5c264a4284fb2ae2e33b57c54e70975bf4f0f4f9a"
configChecksum: "20b338538d7cb4f2b765e3d06619b7ecb2cfc5730dd8ae986568c6e3ef303a1"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down Expand Up @@ -1026,7 +1028,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "e952d320a403549f597a6e5c264a4284fb2ae2e33b57c54e70975bf4f0f4f9a"
configChecksum: "20b338538d7cb4f2b765e3d06619b7ecb2cfc5730dd8ae986568c6e3ef303a1"
labels:
app.kubernetes.io/name: flytescheduler
app.kubernetes.io/instance: flyte
Expand Down
6 changes: 4 additions & 2 deletions deployment/gcp/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -186,6 +187,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -942,7 +944,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "e952d320a403549f597a6e5c264a4284fb2ae2e33b57c54e70975bf4f0f4f9a"
configChecksum: "20b338538d7cb4f2b765e3d06619b7ecb2cfc5730dd8ae986568c6e3ef303a1"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down Expand Up @@ -1368,7 +1370,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "e952d320a403549f597a6e5c264a4284fb2ae2e33b57c54e70975bf4f0f4f9a"
configChecksum: "20b338538d7cb4f2b765e3d06619b7ecb2cfc5730dd8ae986568c6e3ef303a1"
labels:
app.kubernetes.io/name: flytescheduler
app.kubernetes.io/instance: flyte
Expand Down
7 changes: 5 additions & 2 deletions deployment/sandbox/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ data:
- openid
flyteadmin:
eventVersion: 2
injectUserAnnotations: false
metadataStoragePrefix:
- metadata
- admin
Expand All @@ -306,6 +307,7 @@ data:
roleNameKey: iam.amazonaws.com/role
testing:
host: http://flyteadmin
userAnnotationPrefix: flyte.ai
server:
grpc:
port: 8089
Expand Down Expand Up @@ -710,6 +712,7 @@ data:
resource_manager.yaml: |
propeller:
resourcemanager:
redis: null
type: noop
storage.yaml: |
storage:
Expand Down Expand Up @@ -6730,7 +6733,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "29b249082ba3f15e213daf85d53d386f968925a8aeab291c585078d59680378"
configChecksum: "fe83495c82ad870691613547d3dcb8acaaec70e61a501843703aba7462d0afe"
labels:
app.kubernetes.io/name: flyteadmin
app.kubernetes.io/instance: flyte
Expand Down Expand Up @@ -7127,7 +7130,7 @@ spec:
template:
metadata:
annotations:
configChecksum: "29b249082ba3f15e213daf85d53d386f968925a8aeab291c585078d59680378"
configChecksum: "fe83495c82ad870691613547d3dcb8acaaec70e61a501843703aba7462d0afe"
labels:
app.kubernetes.io/name: flytescheduler
app.kubernetes.io/instance: flyte
Expand Down
5 changes: 5 additions & 0 deletions flyteadmin/flyteadmin_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ flyteadmin:
- "metadata"
- "admin"
useOffloadedWorkflowClosure: false
injectIdentityAnnotations: false
identityAnnotationPrefix: "flyte.ai"
identityAnnotationKeys:
- email
- sub
database:
postgres:
port: 30001
Expand Down
82 changes: 82 additions & 0 deletions flyteadmin/pkg/manager/impl/execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ func (m *ExecutionManager) launchSingleTaskExecution(
annotations = executionConfig.GetAnnotations().GetValues()
}

annotations = m.addIdentityAnnotations(ctx, annotations)

var rawOutputDataConfig *admin.RawOutputDataConfig
if executionConfig.GetRawOutputDataConfig() != nil {
rawOutputDataConfig = executionConfig.GetRawOutputDataConfig()
Expand Down Expand Up @@ -1025,6 +1027,9 @@ func (m *ExecutionManager) launchExecution(
if err != nil {
return nil, nil, nil, err
}

annotations = m.addIdentityAnnotations(ctx, annotations)

var rawOutputDataConfig *admin.RawOutputDataConfig
if executionConfig.GetRawOutputDataConfig() != nil {
rawOutputDataConfig = executionConfig.GetRawOutputDataConfig()
Expand Down Expand Up @@ -2050,6 +2055,83 @@ func (m *ExecutionManager) addProjectLabels(ctx context.Context, projectName str
return initialLabels, nil
}

// addIdentityAnnotations automatically injects identity information (user or app) as annotations when enabled in config.
// This allows tracking which identity submitted each workflow execution and enables identity-based authorization.
func (m *ExecutionManager) addIdentityAnnotations(ctx context.Context, initialAnnotations map[string]string) map[string]string {
// Check if identity annotation injection is enabled
if !m.config.ApplicationConfiguration().GetTopLevelConfig().GetInjectIdentityAnnotations() {
return initialAnnotations
}

// Get identity from authentication context
identityContext := auth.IdentityContextFromContext(ctx)

// Check if identity context is empty
if identityContext.IsEmpty() {
logger.Debugf(ctx, "No identity information found in context, skipping identity annotation injection")
return initialAnnotations
}

if initialAnnotations == nil {
initialAnnotations = make(map[string]string)
}

prefix := m.config.ApplicationConfiguration().GetTopLevelConfig().GetIdentityAnnotationPrefix()
keys := m.config.ApplicationConfiguration().GetTopLevelConfig().GetIdentityAnnotationKeys()

// Determine if this is an app or user identity
isAppIdentity := identityContext.AppID() != ""
isUserIdentity := identityContext.UserInfo() != nil && !isAppIdentity

// Add annotations based on identity type
if isAppIdentity {
// Handle app-based identity
appID := identityContext.AppID()
for _, key := range keys {
annotationKey := prefix + "/app-" + key
if _, exists := initialAnnotations[annotationKey]; !exists {
var value string
switch key {
case "email", "sub", "id":
// For app identities, use the app ID for these fields
value = appID
default:
// Skip unknown keys for app identities
continue
}
if value != "" {
initialAnnotations[annotationKey] = value
logger.Debugf(ctx, "Injected app identity annotation %s=%s", annotationKey, value)
}
}
}
} else if isUserIdentity {
// Handle user-based identity
userInfo := identityContext.UserInfo()
for _, key := range keys {
annotationKey := prefix + "/user-" + key
if _, exists := initialAnnotations[annotationKey]; !exists {
var value string
switch key {
case "email":
value = userInfo.GetEmail()
case "sub":
value = userInfo.GetSubject()
default:
// Skip unknown keys
continue
}
if value != "" {
initialAnnotations[annotationKey] = value
logger.Debugf(ctx, "Injected user identity annotation %s=%s", annotationKey, value)
}
}
}
}

return initialAnnotations
}

func addStateFilter(filters []common.InlineFilter) ([]common.InlineFilter, error) {
var stateFilterExists bool
for _, inlineFilter := range filters {
Expand Down
Loading
Loading