Skip to content
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

Argo Rollout Canary Service with HTTPS not working #3593

Closed
Cstack-Krish opened this issue May 23, 2024 · 0 comments · Fixed by #3603
Closed

Argo Rollout Canary Service with HTTPS not working #3593

Cstack-Krish opened this issue May 23, 2024 · 0 comments · Fixed by #3603
Labels
bug Something isn't working

Comments

@Cstack-Krish
Copy link

Cstack-Krish commented May 23, 2024

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.

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.

image

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 👍.

@Cstack-Krish Cstack-Krish added the bug Something isn't working label May 23, 2024
zachaller pushed a commit that referenced this issue Jun 13, 2024
 (#3603)

fix protocol missing in ambassador canary mapping creation

Signed-off-by: Joshua Mathew <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant