Skip to content

Commit

Permalink
Remove mentions to flyin
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario committed Jan 29, 2024
1 parent 634c17c commit 1058d03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
20 changes: 10 additions & 10 deletions flyteplugins/go/tasks/logs/logging_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,35 +350,35 @@ func TestGetLogsForContainerInPod_Templates(t *testing.T) {
})
}

func TestGetLogsForContainerInPod_Flyin(t *testing.T) {
func TestGetLogsForContainerInPod_Flyteinteractive(t *testing.T) {
tests := []struct {
name string
config *LogConfig
template *core.TaskTemplate
expectedTaskLogs []*core.TaskLog
}{
{
"Flyin enabled but no task template",
"Flyteinteractive enabled but no task template",
&LogConfig{
DynamicLogLinks: map[string]tasklog.TemplateURI{
"vscode": "https://flyin.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
"vscode": "https://flyteinteractive.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
},
},
nil,
nil,
},
{
"Flyin enabled but config not found in task template",
"Flyteinteractive enabled but config not found in task template",
&LogConfig{
DynamicLogLinks: map[string]tasklog.TemplateURI{
"vscode": "https://flyin.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
"vscode": "https://flyteinteractive.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
},
},
&core.TaskTemplate{},
nil,
},
{
"Flyin disabled but config present in TaskTemplate",
"Flyteinteractive disabled but config present in TaskTemplate",
&LogConfig{},
&core.TaskTemplate{
Config: map[string]string{
Expand All @@ -389,7 +389,7 @@ func TestGetLogsForContainerInPod_Flyin(t *testing.T) {
nil,
},
{
"Flyin disabled and K8s enabled and flyin config present in TaskTemplate",
"Flyteinteractive disabled and K8s enabled and flyteinteractive config present in TaskTemplate",
&LogConfig{
IsKubernetesEnabled: true,
KubernetesTemplateURI: "https://k8s.com/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
Expand All @@ -409,12 +409,12 @@ func TestGetLogsForContainerInPod_Flyin(t *testing.T) {
},
},
{
"Flyin and K8s enabled",
"Flyteinteractive and K8s enabled",
&LogConfig{
IsKubernetesEnabled: true,
KubernetesTemplateURI: "https://k8s.com/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
DynamicLogLinks: map[string]tasklog.TemplateURI{
"vscode": "https://flyin.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
"vscode": "https://flyteinteractive.mydomain.com:{{ .taskConfig.port }}/{{ .namespace }}/{{ .podName }}/{{ .containerName }}/{{ .containerId }}",
},
},
&core.TaskTemplate{
Expand All @@ -430,7 +430,7 @@ func TestGetLogsForContainerInPod_Flyin(t *testing.T) {
Name: "Kubernetes Logs my-Suffix",
},
{
Uri: "https://flyin.mydomain.com:65535/my-namespace/my-pod/ContainerName/ContainerID",
Uri: "https://flyteinteractive.mydomain.com:65535/my-namespace/my-pod/ContainerName/ContainerID",
MessageFormat: core.TaskLog_JSON,
Name: "vscode logs my-Suffix",
},
Expand Down
11 changes: 2 additions & 9 deletions flyteplugins/go/tasks/pluginmachinery/tasklog/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ func MustCreateRegex(varName string) *regexp.Regexp {
return regexp.MustCompile(fmt.Sprintf(`(?i){{\s*[\.$]%s\s*}}`, varName))
}

var dynamicLogRegex = regexp.MustCompile(`(?i){{\s*.taskConfig[\.$]([a-zA-Z_]+)\s*}}`)

func MustCreateDynamicLogRegex(varName string) *regexp.Regexp {
return regexp.MustCompile(fmt.Sprintf(`(?i){{\s*.taskConfig[\.$]%s\s*}}`, varName))
}
Expand Down Expand Up @@ -106,9 +108,6 @@ func (input Input) templateVars() []TemplateVar {
TemplateVar{defaultRegexes.ContainerID, containerID},
TemplateVar{defaultRegexes.Hostname, input.HostName},
)
if gotExtraTemplateVars {
vars = append(vars, input.ExtraTemplateVars...)
}
if input.TaskExecutionID != nil {
taskExecutionIdentifier := input.TaskExecutionID.GetID()
vars = append(
Expand Down Expand Up @@ -165,9 +164,6 @@ func (input Input) templateVars() []TemplateVar {
)
}
}
if gotExtraTemplateVars {
vars = append(vars, input.ExtraTemplateVars...)
}

vars = append(
vars,
Expand Down Expand Up @@ -212,9 +208,6 @@ func (p TemplateLogPlugin) GetTaskLogs(input Input) (Output, error) {
})
}

// Compile the potential dynamic log links
dynamicLogRegex := regexp.MustCompile(`(?i){{\s*.taskConfig[\.$]([a-zA-Z_]+)\s*}}`)

for _, dynamicLogLinkType := range getDynamicLogLinkTypes(input.TaskTemplate) {
for _, dynamicTemplateURI := range p.DynamicTemplateURIs {
if p.Name == dynamicLogLinkType {
Expand Down
12 changes: 6 additions & 6 deletions flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ func TestTemplateLogPlugin(t *testing.T) {
},
},
{
"flyin",
"flyteinteractive",
TemplateLogPlugin{
Name: "vscode",
DynamicTemplateURIs: []TemplateURI{"vscode://flyin:{{ .taskConfig.port }}/{{ .podName }}"},
DynamicTemplateURIs: []TemplateURI{"vscode://flyteinteractive:{{ .taskConfig.port }}/{{ .podName }}"},
MessageFormat: core.TaskLog_JSON,
},
args{
Expand All @@ -472,19 +472,19 @@ func TestTemplateLogPlugin(t *testing.T) {
Output{
TaskLogs: []*core.TaskLog{
{
Uri: "vscode://flyin:1234/my-pod-name",
Uri: "vscode://flyteinteractive:1234/my-pod-name",
MessageFormat: core.TaskLog_JSON,
},
},
},
},
{
"flyin - no link_type in task template",
"flyteinteractive - no link_type in task template",
TemplateLogPlugin{
Name: "vscode",
DynamicTemplateURIs: []TemplateURI{"vscode://flyin:{{ .taskConfig.port }}/{{ .podName }}"},
DynamicTemplateURIs: []TemplateURI{"vscode://flyteinteractive:{{ .taskConfig.port }}/{{ .podName }}"},
MessageFormat: core.TaskLog_JSON,
DisplayName: "Flyin Logs",
DisplayName: "Flyteinteractive Logs",
},
args{
input: Input{
Expand Down

0 comments on commit 1058d03

Please sign in to comment.