spec
spec copied to clipboard
Proposal: Add ExposedEndpoint Trait
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:
- 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
not only ReplicatedService, but also singletonService
I think this is ok to me.
LGTM
fixes https://github.com/microsoft/hydra-spec/issues/120
The idea of ExposedEndpoint make sense. 👍
I think this ExposedEndpoint endpoint is really useful, can anyone give a PR to make more progress?