-
Notifications
You must be signed in to change notification settings - Fork 30
K8SPS-131: make router ports configurable #948
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
base: main
Are you sure you want to change the base?
Conversation
pkg/router/router_test.go
Outdated
data, err := yaml.Marshal(got) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
err = os.WriteFile(filepath.Join("testdata", "ports", tt.expectedPortsFile), data, 0666) | ||
if err != nil { | ||
t.Fatal(err) | ||
} |
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.
Why are we doing that? I think the test is passing for the wrong reason when this code is executed. Essentially we are overwritting the expectation file with the data we got from the ports
function.
pkg/router/router_test.go
Outdated
tests := []struct { | ||
name string | ||
specifiedPorts []corev1.ServicePort | ||
expectedPortsFile string |
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.
Personally I think skipping using files and marshalling the results to assert them, and instead using plain go structs to manage that will make the test much easier to follow and reason.
Noticed that we do something similar in other PRs for asserting StS, which I think does not help a lot since we lose type-safety and structure, it’s fragile to ordering and irrelevant diffs and in many cases hides intent.
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.
commit: 30950f8 |
https://perconadev.atlassian.net/browse/K8SPS-131
DESCRIPTION
Helm PR: percona/percona-helm-charts#568
This PR introduces a new field,
.spec.proxy.router.ports
, to thecr.yaml
:It allows users to modify existing ports (such as
http
,rw-default
, orread-write
) or add new ones. IftargetPort
is specified (not 0), it will be used as the container port.CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
Config/Logging/Testability