Skip to content

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

K8SPS-131: make router ports configurable #948

wants to merge 6 commits into from

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Jun 12, 2025

K8SPS-131 Powered by Pull Request Badge

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 the cr.yaml:

      ports:
      - name: http
        port: 8443
        targetPort: 0
      - name: custom-port
        port: 2222
        targetPort: 1111

It allows users to modify existing ports (such as http, rw-default, or read-write) or add new ones. If targetPort is specified (not 0), it will be used as the container port.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PS version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/XL 500-999 lines label Jun 12, 2025
@pooknull pooknull marked this pull request as ready for review June 13, 2025 05:05
@pooknull pooknull added this to the v0.11.0 milestone Jun 13, 2025
egegunes
egegunes previously approved these changes Jun 13, 2025
Comment on lines 87 to 94
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)
}
Copy link
Contributor

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.

tests := []struct {
name string
specifiedPorts []corev1.ServicePort
expectedPortsFile string
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gkech
gkech previously approved these changes Jun 23, 2025
@JNKPercona
Copy link
Collaborator

Test name Status
version-service passed
async-ignore-annotations passed
auto-config passed
config passed
config-router passed
demand-backup passed
gr-demand-backup passed
gr-demand-backup-haproxy passed
gr-finalizer passed
gr-haproxy passed
gr-ignore-annotations passed
gr-init-deploy passed
gr-one-pod failure
gr-recreate passed
gr-scaling passed
gr-scheduled-backup failure
gr-security-context passed
gr-self-healing passed
gr-tls-cert-manager passed
gr-users passed
haproxy passed
init-deploy passed
limits passed
monitoring passed
one-pod passed
operator-self-healing passed
recreate passed
scaling passed
scheduled-backup passed
service-per-pod passed
sidecars passed
smart-update passed
storage passed
tls-cert-manager passed
users passed
pvc-resize passed
We run 36 out of 36

commit: 30950f8
image: perconalab/percona-server-mysql-operator:PR-948-30950f8a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL 500-999 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants