Giter Club home page Giter Club logo

schema's Issues

[FEATURE] `command`, `tcpSocket` and `grpc` `livenessProbe` and `readinessProbe` support

Detailed description

It would be ideal to support the command, tcpSocket and grpc methods for livenessProbe and readinessProbe.

Context

Today, only the httpGet method for livenessProbe and readinessProbe is supported.

command is another very popular method, like illustrated here with grpc apps: https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/release/kubernetes-manifests.yaml#L61.

So for example, today, this below is not supported:

apiVersion: score.dev/v1b1
metadata:
  name: adservice
containers:
  adservice:
    image: gcr.io/google-samples/microservices-demo/adservice:v0.6.0
    variables:
      PORT: "9555"
    livenessProbe:
      exec:
        command:
          - /bin/grpc_health_probe
          - '-addr=:9555'
    readinessProbe:
      exec:
        command:
          - /bin/grpc_health_probe
          - '-addr=:9555'

Possible implementation

Humanitec already supports tcpSocket and command in addition to httpGet.

Note: gRPC (only supported since Kubernetes 1.24+) is not yet supported in Humanitec. The alternative is to use the command method by using the grpc_health_probe binary.

Additional information

Configure Liveness, Readiness and Startup Probes in Kubernetes.

Spec describes targetPort as required and port as optional which is backwards

All implementations of score Service assume the port is required, and will default the targetPort if not provided. This is the same as both Humanitec and the underlying K8s implementation. Score-compose and score-humanitec do the same.

The score documentation also lists port as required and target port as optional.

However the spec lists this the other way around. To avoid breaking customers that have workloads defined with just port right now, we need to fix this in the spec.

Add specification for metadata.annotations map

Just like resources have metadata.annotations today, there is need to support the same concept formally on the workload metadata as well. This will allow us to pass kubernetes-style annotations through to the destination runtime.

For score-compose, these would be labels, while for score-helm and score-humanitec these would be annotations on the final deployment objects. Since this is just metadata it can also be ignored without affecting the functionality of the workload.

metadata:
  name: my workload
  annotations:
    example.com/my-annotation: value

This should carry the same specification as resource.metadata.annotations.

Json schema is missing protocol and hostIP from service.ports

The score website indicates

image

However the API spec does not support these fields.

"ports": {
  "description": "List of network ports published by the service.",
  "type": "object",
  "minProperties": 1,
  "additionalProperties": {
    "description": "The network port description.",
    "type": "object",
    "required": [
      "targetPort"
    ],
    "additionalProperties": false,
    "properties": {
      "port": {
        "description": "The public service port.",
        "type": "number"
      },
      <--- missing --->
      "targetPort": {
        "description": "The internal service port.",
        "type": "number"
      }
    }
  }
}

This means validators may reject these fields if provided, and implementation behavior or failure may be unpredictable. However hostIP is also not a real field used by any score implementations just yet so that should be removed.

I'd like to propose we fix this by adding protocol to the spec, and removing hostIP from the docs.

Json schema indicates ports as `number`

There are a number of locations in the schema where 'number' is used rather than 'integer' in the port bindings:

  • service.ports.port
  • service.ports.targetPort
  • $defs.httpProbe.port

This usually doesn't show up as a problem but it might when validation allows port numbers like 33.3333 to pass validation, but may cause failures when converted into docker compose, helm, or other destination container types.

I'd like to propose that we change these to integers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.