Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Specify service port in TrafficSplit #14

Closed
stefanprodan opened this issue Apr 30, 2019 · 3 comments · Fixed by #15
Closed

Specify service port in TrafficSplit #14

stefanprodan opened this issue Apr 30, 2019 · 3 comments · Fixed by #15

Comments

@stefanprodan
Copy link
Contributor

A Kubernetes service can expose more than one port. To support such a service the TrafficSplit could have an optional field in the backend spec:

ClusterIP with multiple ports:

apiVersion: v1
kind: Service
metadata:
  name: frontend-primary
spec:
  type: ClusterIP
  selector:
    app: frontend-primary
  ports:
    - name: http
      port: 8080
      protocol: TCP
      targetPort: http
    - name: grpc
      port: 9090
      protocol: TCP
      targetPort: grpc

TrafficSplit for HTTP:

apiVersion: v1beta1
kind: TrafficSplit
metadata:
  name: frontend
spec:
  service: frontend
  backends:
  - service: frontend-primary
    port: 8080
    weight: 900m
  - service: frontend-canary
    port: 8080
    weight: 100m
@nicholasjackson
Copy link
Collaborator

Hey @stefanprodan not sure how Istio configures things, just grokking the docs, but wondering if this information should not be obtained from service discovery. The service in question would be an Envoy proxy, not a kubernetes service.

@stefanprodan
Copy link
Contributor Author

Both Istio and App Mesh rely on ClusterIPs to define backends:

Istio:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: frontend
  namespace: test
spec:
  hosts:
    - frontend
  http:
    route:
    - destination:
        host: frontend-primary
        port:
          number: 9898
      weight: 100
    - destination:
        host: frontend-canary
        port:
          number: 9898
      weight: 0

App Mesh:

apiVersion: appmesh.k8s.aws/v1alpha1
kind: VirtualNode
metadata:
  name: frontend
  namespace: test
spec:
  meshName: global.appmesh-system
  listeners:
    - portMapping:
        port: 9898
        protocol: http
  serviceDiscovery:
    dns:
      hostName: frontend.test
  backends:
    - virtualService:
        virtualServiceName: backend.test
---
apiVersion: appmesh.k8s.aws/v1alpha1
kind: VirtualService
metadata:
  name: frontend.test
  namespace: test
spec:
  meshName: global.appmesh-system
  virtualRouter:
    name: frontend-router
  routes:
    - name: frontend-route
      http:
        match:
          prefix: /
        action:
          weightedTargets:
            - virtualNodeName: frontend
              weight: 100

@nicholasjackson
Copy link
Collaborator

Thanks, just been looking at the Istio docs, did not realize you could have multiple destinations ports for a data plane.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants