-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
We are having a deployment with a service object that works only on HTTPS, we have configured argo rollouts with canary strategy with ambassador traffic routing. When a rollout is triggered a canary mapping file is generated/cloned as expected but the value of spec.service in the canary mapping file is not having the https://. Based on the code snippet that clones the mapping for canary service, seems like the value of spec.service in mapping gets replaced with the value of canaryservice in the rollout manifest.
argo-rollouts/rollout/trafficrouting/ambassador/ambassador.go
Lines 230 to 256 in 2e7cf69
func buildCanaryMapping(baseMapping *unstructured.Unstructured, canarySvc string, desiredWeight int32) *unstructured.Unstructured { | |
canaryMapping := baseMapping.DeepCopy() | |
svc := buildCanaryService(baseMapping, canarySvc) | |
unstructured.RemoveNestedField(canaryMapping.Object, "metadata") | |
cMappingName := buildCanaryMappingName(baseMapping.GetName()) | |
canaryMapping.SetName(cMappingName) | |
canaryMapping.SetNamespace(baseMapping.GetNamespace()) | |
unstructured.SetNestedField(canaryMapping.Object, svc, "spec", "service") | |
setMappingWeight(canaryMapping, desiredWeight) | |
return canaryMapping | |
} | |
func buildCanaryService(baseMapping *unstructured.Unstructured, canarySvc string) string { | |
curSvc := GetMappingService(baseMapping) | |
parts := strings.Split(curSvc, ":") | |
if len(parts) < 2 { | |
return canarySvc | |
} | |
// Check if the last part is a valid int that can be used as the port | |
port := parts[len(parts)-1] | |
if _, err := strconv.Atoi(port); err != nil { | |
return canarySvc | |
} | |
return fmt.Sprintf("%s:%s", canarySvc, port) | |
} | |
We wanted the https:// to be retained for our functionality to work.
Expected behavior
Cloned canary service mapping file should respect the protocol defined in the actual mapping which is https here.
Rollout Spec
strategy:
canary:
canaryService: identity-canary
stableService: identity
steps:
- setWeight: 40
- pause: {}
- setWeight: 90
- pause: {}
trafficRouting:
ambassador:
mappings:
- identity
Ambassador Mapping
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: identity
namespace: identity-canary-qa1
spec:
connect_timeout_ms: 3000
hostname: hostname.com
load_balancer:
policy: round_robin
prefix: /.*
prefix_regex: true
resolver: endpoint
rewrite: ''
service: 'https://identity/'
Version
Argo-Rollouts Version: v1.6.6
AgoCD Version: v2.11.0
Ambassador Version: v3.9.0
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.