Skip to content

Commit

Permalink
Propagate security ctx to flyte workflow CRD (flyteorg#422)
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Rogan <[email protected]>
  • Loading branch information
katrogan authored May 10, 2022
1 parent 18e6d2b commit 24b3c57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions flyteadmin/pkg/workflowengine/impl/prepare_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func addPermissions(securityCtx *core.SecurityContext, roleNameKey string, flyte
if securityCtx == nil || securityCtx.RunAs == nil {
return
}
flyteWf.SecurityContext = *securityCtx
if len(securityCtx.RunAs.IamRole) > 0 {
if flyteWf.Annotations == nil {
flyteWf.Annotations = map[string]string{}
Expand Down
2 changes: 2 additions & 0 deletions flyteadmin/pkg/workflowengine/impl/prepare_execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestAddPermissions(t *testing.T) {
roleNameKey: testRole,
})
assert.Equal(t, testK8sServiceAccount, flyteWf.ServiceAccountName)
assert.True(t, proto.Equal(&flyteWf.SecurityContext, securityCtxFromAuth))
})

t.Run("override using security ctx", func(t *testing.T) {
Expand All @@ -80,6 +81,7 @@ func TestAddPermissions(t *testing.T) {
roleNameKey: testRoleSc,
})
assert.Equal(t, testK8sServiceAccountSc, flyteWf.ServiceAccountName)
assert.True(t, proto.Equal(&flyteWf.SecurityContext, securityCtx))
})
}

Expand Down

0 comments on commit 24b3c57

Please sign in to comment.