score-spec / spec

The Score Specification provides a developer-centric and platform-agnostic Workload specification to improve developer productivity and experience. It eliminates configuration inconsistencies between environments.

Home Page:https://score.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Services port protocol does not translate well to compose

fernando-villalba opened this issue · comments

If I do the following:

apiVersion: score.dev/v1b1
metadata:
  name: frontend
containers:
  frontend:
    image: nginx:alpine
service:
  ports:
    www:
      port: 80
      protocol: TCP
      targetPort: 80

It translates to helm values correctly like so:

containers:
  frontend:
    image:
      name: nginx:alpine
service:
  ports:
    - name: www
      port: 80
      protocol: TCP
      targetPort: 80
  type: ClusterIP

How it does not translate correctly to compose:

services:
  frontend:
    image: nginx:alpine
    ports:
      - target: 80
        published: "80"
        protocol: TCP

Becuase in compose the protocol needs to be specified in lower case, otherwise it fails.

Both formats have different ways of specifying the structure and content of a container configuration.
The Docker Compose configuration uses a different format for specifying container properties. The services section specifies the name and the image of the container, and the ports section specifies the target and published ports, along with the protocol. Change the protocol specification to lower case & check it again.