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.
https://score.dev/
Apache License 2.0
7.62k stars 2.22k forks source link

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

Open mathieu-benoit opened 1 year ago

mathieu-benoit commented 1 year ago

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.

github-actions[bot] commented 1 year ago

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

sujaya-sys commented 11 months ago

We've received a similar feature request:

"Need to translate this


                "liveness_probe": {
                    "port": "3000",
                    "type": "tcp"
                },

using score"

mathieu-benoit commented 11 months ago

As a workaround and if using Humanitec, you can use the Humanitec Score extension, example below:

apiVersion: humanitec.org/v1b1
profile: humanitec/default-module
spec:
  containers:
    adservice:
      liveness_probe:
        command:
          - /bin/grpc_health_probe
          - '-addr=:9555'
        type: command
      readiness_probe:
        command:
          - /bin/grpc_health_probe
          - '-addr=:9555'
        type: command
astromechza commented 1 month ago

This should be straight forward. But things will need to be cautious because not all score implementations will support all kinds of probes (as it is docker compose doesn't support httpGet).