Skip to content

Conversation

@sayap
Copy link

@sayap sayap commented Jun 19, 2025

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
Copy link
Author

sayap commented Jun 19, 2025

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
Copy link
Author

sayap commented Sep 22, 2025

@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

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 41.02564% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.43%. Comparing base (12ee6cb) to head (3767d7d).
⚠️ 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 ⚠️
pkg/apis/flagger/v1beta1/zz_generated.deepcopy.go 0.00% 16 Missing ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@sayap
Copy link
Author

sayap commented Oct 14, 2025

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 added 3 commits October 28, 2025 10:24
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 fluxcd#927

Signed-off-by: Yap Sok Ann <sokann@gmail.com>
Signed-off-by: Yap Sok Ann <sokann@gmail.com>
Signed-off-by: Yap Sok Ann <sokann@gmail.com>
@sayap
Copy link
Author

sayap commented Oct 28, 2025

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

Copy link
Member

@aryan9600 aryan9600 left a comment

Choose a reason for hiding this comment

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

thanks for tackling this issue

Port int32 `json:"port"`

// Port name of the generated Kubernetes service
PortName string `json:"portName"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
PortName string `json:"portName"`
PortName string `json:"portName,omitempty"`

}

func (c *KubernetesDefaultRouter) reconcileService(canary *flaggerv1.Canary, name string, podSelector string, metadata *flaggerv1.CustomMetadata) error {
func (c *KubernetesDefaultRouter) getApexServicePort(canary *flaggerv1.Canary) corev1.ServicePort {
Copy link
Member

Choose a reason for hiding this comment

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

i think we can merge this and getDsicoveryServicePorts into one function named something like getDefaultServicePorts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly define multiple ports under canary specs (portDiscovery alternative)

3 participants