Skip to content
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 flexibility to the path of the script #143

Open
yorugac opened this issue Aug 14, 2022 · 0 comments
Open

Add flexibility to the path of the script #143

yorugac opened this issue Aug 14, 2022 · 0 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@yorugac
Copy link
Collaborator

yorugac commented Aug 14, 2022

Currently, k6-operator with ConfigMap and VolumeClaim options expects JS script to be present in /test folder:

func ParseScript(spec *v1alpha1.K6Spec) (*Script, error) {
s := &Script{
Filename: "test.js",
Path: "/test/",
}
if spec.Script.VolumeClaim.Name != "" {
s.Name = spec.Script.VolumeClaim.Name
if spec.Script.VolumeClaim.File != "" {
s.Filename = spec.Script.VolumeClaim.File
}
s.Type = "VolumeClaim"
return s, nil
}
if spec.Script.ConfigMap.Name != "" {
s.Name = spec.Script.ConfigMap.Name
if spec.Script.ConfigMap.File != "" {
s.Filename = spec.Script.ConfigMap.File
}
s.Type = "ConfigMap"
return s, nil
}
if spec.Script.LocalFile != "" {
s.Name = "LocalFile"
s.Type = "LocalFile"
s.Path, s.Filename = filepath.Split(spec.Script.LocalFile)
return s, nil
}
return nil, errors.New("Script definition should contain one of: ConfigMap, VolumeClaim, LocalFile")
}

These two options don't match how LocalFile is implemented and it also causes issues during usage.

Caveat: in order not to break anyone's existing setup, it'd be good to keep backwards-compatibility with the current approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant