flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Allow multiple ports to be defined explicitly

Open sayap opened this issue 9 months ago • 5 comments

Add a ports field in the canary service specs that allows full control over port mapping and protocol, as an alternative to port discovery.

If the new ports field is set, it takes precedence over both the single port fields and port discovery.

Fixes #927

sayap avatar Jun 19 '25 02:06 sayap

I didn't modify this section in the Istio router, as I am not too sure how it works:

	// set destination port when an ingress gateway is specified
	if canary.Spec.Service.PortDiscovery &&
		(len(canary.Spec.Service.Gateways) > 0 &&
			canary.Spec.Service.Gateways[0] != "mesh" || canary.Spec.Service.Delegation) {
		dest = istiov1beta1.HTTPRouteDestination{
			Destination: istiov1beta1.Destination{
				Host: host,
				Port: &istiov1beta1.PortSelector{
					Number: uint32(canary.Spec.Service.Port),
				},
			},
			Weight: weight,
		}
	}

In our case, we have a separate controller running that reconciles the Canary CRs, making some API calls to set the traffic split elsewhere (Istio, Consul, ALB).

sayap avatar Jun 19 '25 02:06 sayap

@aryan9600 Can you help to trigger the pipelines again? I have read the dev-guide, did the make codegen and make crd, and also ran the unit tests and e2e tests. Thank you

sayap avatar Sep 22 '25 07:09 sayap

Codecov Report

:x: Patch coverage is 41.02564% with 46 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 28.43%. Comparing base (12ee6cb) to head (3767d7d). :warning: Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
pkg/router/kubernetes_default.go 51.61% 29 Missing and 1 partial :warning:
pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go 0.00% 16 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1809       +/-   ##
===========================================
- Coverage   39.44%   28.43%   -11.01%     
===========================================
  Files         287      287               
  Lines       22706    22864      +158     
===========================================
- Hits         8956     6501     -2455     
- Misses      12777    15640     +2863     
+ Partials      973      723      -250     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Oct 08 '25 18:10 codecov-commenter

Looks like the failing test was caused by an unrelated issue:

Waiting for deployment "apisix" rollout to finish: 0 of 1 updated replicas are available...
error: deployment "apisix" exceeded its progress deadline

Can retry the pipeline again? Thanks

sayap avatar Oct 14 '25 02:10 sayap

Did a rebase after the merging of #1823 that also introduces a new field

sayap avatar Oct 28 '25 03:10 sayap