Skip to content

Implicit ServiceSpec union? #141

Open
@ari-becker

Description

@ari-becker

Trying to run kubectl apply on:

apiVersion: v1
kind: Service
metadata:
  name: foo
spec:
  type: ClusterIP
  selector:
    app: foo

results in the following error: The Service "foo" is invalid: spec.ports: Required value. Putting ports: [] results in the same error.

The ports field in ServiceSpec is an Optional (List ServicePort.Type) only because of ExternalName Services (example taken from linked documentation):

apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: prod
spec:
  type: ExternalName
  externalName: my.database.example.com

Similarly, externalName is a required field for an ExternalName ServiceSpec but should not be specified at all for other kinds of ServiceSpec.

Ran into this issue when the super-configuration that was generating a Kubernetes.Service.Type had an optional field that was being mapped to the Kubernetes Service's .spec.ports, where the field wasn't specified and the default was an empty optional.

Related: dhall-lang/dhall-lang#691

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions