spec icon indicating copy to clipboard operation
spec copied to clipboard

Proposal: Add ExposedEndpoint Trait

Open hongchaodeng opened this issue 5 years ago • 5 comments

I was contemplating a solution for https://github.com/microsoft/hydra-spec/pull/125.

This is what I come up with and want to discuss:

  1. Add a standard trait ExposedEndpoint:
apiVersion: standard.hydra.io/v1alpha1
kind: Trait
metadata:
  name: ExposedEndpoint
  annotations:
    version: v1.0.0
    description: "Describes what endpoints to expose for the component"
spec:
  appliesTo:
    - core.hydra.io/v1alpha1.ReplicatedService
  properties:
    type: object
    properties:
      name:
        description: a name indicating the purpose of this exposure.
        type: string
      containerPort:
        type: integer
      servicePort:
        type: integer
      required:
        - containerPort

This example shows how it works:

apiVersion: core.hydra.io/v1alpha1
kind: OperationalConfiguration
metadata:
  name: custom-single-app
  annotations:
    version: v1.0.0
    description: "Customized version of single-app"
spec:
  components:
    - componentName: nginx
      instanceName: web-nginx
      traits:
        - name: http
          type: ExposedEndpoint
          properties:
            containerPort: 8080
            servicePort: 80
        - name: metrics
          type: ExposedEndpoint
          properties:
            containerPort: 8081
            servicePort: 81

hongchaodeng avatar Sep 06 '19 05:09 hongchaodeng

not only ReplicatedService, but also singletonService

wonderflow avatar Sep 06 '19 05:09 wonderflow

I think this is ok to me.

LGTM

wonderflow avatar Sep 06 '19 05:09 wonderflow

fixes https://github.com/microsoft/hydra-spec/issues/120

wonderflow avatar Sep 06 '19 05:09 wonderflow

The idea of ExposedEndpoint make sense. 👍

resouer avatar Sep 06 '19 05:09 resouer

I think this ExposedEndpoint endpoint is really useful, can anyone give a PR to make more progress?

wonderflow avatar Oct 08 '19 09:10 wonderflow