This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inject and Use values from Security Context (#153)
* Inject and Use values from Security Context Signed-off-by: Anand Swaminathan <[email protected]>
- Loading branch information
1 parent
030cdef
commit d0a6ee2
Showing
17 changed files
with
204 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
go/tasks/pluginmachinery/core/mocks/task_execution_metadata.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
package flytek8s | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core/mocks" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetServiceAccountNameFromTaskExecutionMetadata(t *testing.T) { | ||
mockTaskExecMetadata := mocks.TaskExecutionMetadata{} | ||
mockTaskExecMetadata.OnGetSecurityContext().Return(core.SecurityContext{ | ||
RunAs: &core.Identity{K8SServiceAccount: "service-account"}, | ||
}) | ||
result := GetServiceAccountNameFromTaskExecutionMetadata(&mockTaskExecMetadata) | ||
assert.Equal(t, "service-account", result) | ||
} | ||
|
||
func TestGetServiceAccountNameFromServiceAccount(t *testing.T) { | ||
mockTaskExecMetadata := mocks.TaskExecutionMetadata{} | ||
mockTaskExecMetadata.OnGetSecurityContext().Return(core.SecurityContext{}) | ||
mockTaskExecMetadata.OnGetK8sServiceAccount().Return("service-account") | ||
result := GetServiceAccountNameFromTaskExecutionMetadata(&mockTaskExecMetadata) | ||
assert.Equal(t, "service-account", result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.