-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flyteconsole url to FlyteWorkflow CRD #5449
Changes from 13 commits
389a51c
54f43eb
944be08
9b08b5b
d62bd96
5d25965
554da58
80286f2
13fe7ad
38f57ad
6816823
6593fdf
04facbd
501d3ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -55,6 +55,10 @@ | |||||||||||||
flyteWf.Tasks = nil | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
if e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL != "" { | ||||||||||||||
flyteWf.ConsoleURL = e.config.ApplicationConfiguration().GetTopLevelConfig().ConsoleURL | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
executionTargetSpec := executioncluster.ExecutionTargetSpec{ | ||||||||||||||
Project: data.ExecutionID.Project, | ||||||||||||||
Domain: data.ExecutionID.Domain, | ||||||||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ package flytek8s | |||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
"os" | ||||||
"strconv" | ||||||
|
||||||
|
@@ -32,7 +33,7 @@ func GetContextEnvVars(ownerCtx context.Context) []v1.EnvVar { | |||||
return envVars | ||||||
} | ||||||
|
||||||
func GetExecutionEnvVars(id pluginsCore.TaskExecutionID) []v1.EnvVar { | ||||||
func GetExecutionEnvVars(id pluginsCore.TaskExecutionID, consoleURL string) []v1.EnvVar { | ||||||
|
||||||
if id == nil || id.GetID().NodeExecutionId == nil || id.GetID().NodeExecutionId.ExecutionId == nil { | ||||||
return []v1.EnvVar{} | ||||||
|
@@ -69,6 +70,14 @@ func GetExecutionEnvVars(id pluginsCore.TaskExecutionID) []v1.EnvVar { | |||||
// }, | ||||||
} | ||||||
|
||||||
if consoleURL != "" { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
envVars = append(envVars, v1.EnvVar{ | ||||||
Name: "FLYTE_EXECUTION_URL", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to const? |
||||||
// TODO: should we use net/url to build this url? | ||||||
Value: fmt.Sprintf("%s/projects/%s/domains/%s/executions/%s/nodeId/%s/nodes", consoleURL, nodeExecutionID.Project, nodeExecutionID.Domain, nodeExecutionID.Name, id.GetUniqueNodeID()), | ||||||
EngHabu marked this conversation as resolved.
Show resolved
Hide resolved
EngHabu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}) | ||||||
} | ||||||
|
||||||
// Task definition Level env variables. | ||||||
if id.GetID().TaskId != nil { | ||||||
taskID := id.GetID().TaskId | ||||||
|
@@ -113,9 +122,9 @@ func GetExecutionEnvVars(id pluginsCore.TaskExecutionID) []v1.EnvVar { | |||||
return envVars | ||||||
} | ||||||
|
||||||
func DecorateEnvVars(ctx context.Context, envVars []v1.EnvVar, taskEnvironmentVariables map[string]string, id pluginsCore.TaskExecutionID) ([]v1.EnvVar, []v1.EnvFromSource) { | ||||||
func DecorateEnvVars(ctx context.Context, envVars []v1.EnvVar, taskEnvironmentVariables map[string]string, id pluginsCore.TaskExecutionID, consoleURL string) ([]v1.EnvVar, []v1.EnvFromSource) { | ||||||
envVars = append(envVars, GetContextEnvVars(ctx)...) | ||||||
envVars = append(envVars, GetExecutionEnvVars(id)...) | ||||||
envVars = append(envVars, GetExecutionEnvVars(id, consoleURL)...) | ||||||
|
||||||
for k, v := range taskEnvironmentVariables { | ||||||
envVars = append(envVars, v1.EnvVar{Name: k, Value: v}) | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -316,6 +316,19 @@ | |||||
return podSpec, &objectMeta, primaryContainerName, nil | ||||||
} | ||||||
|
||||||
func shouldIncludeConsoleURL(taskTemplate *core.TaskTemplate) bool { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if taskTemplate == nil { | ||||||
return false | ||||||
} | ||||||
config := taskTemplate.GetConfig() | ||||||
if config == nil { | ||||||
return false | ||||||
} | ||||||
// The presence of any "link_type" is sufficient to guarantee that the console URL should be included. | ||||||
_, exists := config["link_type"] | ||||||
return exists | ||||||
} | ||||||
|
||||||
// ApplyFlytePodConfiguration updates the PodSpec and ObjectMeta with various Flyte configuration. This includes | ||||||
// applying default k8s configuration, applying overrides (resources etc.), injecting copilot containers, and merging with the | ||||||
// configuration PodTemplate (if exists). | ||||||
|
@@ -328,10 +341,11 @@ | |||||
|
||||||
// add flyte resource customizations to containers | ||||||
templateParameters := template.Parameters{ | ||||||
Inputs: tCtx.InputReader(), | ||||||
OutputPath: tCtx.OutputWriter(), | ||||||
Task: tCtx.TaskReader(), | ||||||
TaskExecMetadata: tCtx.TaskExecutionMetadata(), | ||||||
Inputs: tCtx.InputReader(), | ||||||
OutputPath: tCtx.OutputWriter(), | ||||||
Task: tCtx.TaskReader(), | ||||||
TaskExecMetadata: tCtx.TaskExecutionMetadata(), | ||||||
IncludeConsoleURL: shouldIncludeConsoleURL(taskTemplate), | ||||||
} | ||||||
|
||||||
resourceRequests := make([]v1.ResourceRequirements, 0, len(podSpec.Containers)) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.