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

Implement port discovery #207

Merged
merged 18 commits into from
Jun 18, 2019
Merged

Implement port discovery #207

merged 18 commits into from
Jun 18, 2019

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Jun 15, 2019

This PR adds port discovery boolean field to the canary service spec. If port discovery is enabled, Flagger scans the deployment pod template and extracts the container ports excluding the port specified in the canary service spec and Istio/App Mesh proxy ports. All the extra ports will be used when generating the ClusterIP services.

For a deployment that exposes two ports e.g.:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "9899"
    spec:
      containers:
      - name: app
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        - containerPort: 9899
          name: prom-metrics
          protocol: TCP

You can enable port discovery so that Prometheus will be able to reach port 9899 over mTLS:

apiVersion: flagger.app/v1alpha3
kind: Canary
spec:
  service:
    # container port used for canary analysis
    port: 8080
    # port name can be http or grpc (default http)
    portName: http
    # add all the other container ports
    # when generating ClusterIP services (default false)
    portDiscovery: true
    trafficPolicy:
      tls:
        mode: ISTIO_MUTUAL

Fix: #171

@marcoferrer
Copy link
Contributor

Excited to see this getting attention.

@stefanprodan stefanprodan merged commit 677ee8d into master Jun 18, 2019
@stefanprodan stefanprodan deleted the port-discovery branch June 18, 2019 10:09
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.

Consider exposing more ports in generated service objects in situations where pod has more than one port
2 participants