diff --git a/riocli/apply/manifests/package-nonros-device.yaml b/riocli/apply/manifests/package-nonros-device.yaml index 80a45d2e..0cea43f0 100644 --- a/riocli/apply/manifests/package-nonros-device.yaml +++ b/riocli/apply/manifests/package-nonros-device.yaml @@ -20,6 +20,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -31,6 +40,16 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: + http: + path: "/" + port: 90 + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. + docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) diff --git a/riocli/apply/manifests/package-ros-device-no-rosbag.yaml b/riocli/apply/manifests/package-ros-device-no-rosbag.yaml index 02e381a8..743e1d4d 100644 --- a/riocli/apply/manifests/package-ros-device-no-rosbag.yaml +++ b/riocli/apply/manifests/package-ros-device-no-rosbag.yaml @@ -21,6 +21,14 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + tcp: + port: 999 + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -32,6 +40,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + http: + path: "/" + port: 90 + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) diff --git a/riocli/apply/manifests/package-ros-device-rosbag.yaml b/riocli/apply/manifests/package-ros-device-rosbag.yaml index 2d68df3b..61dc48f2 100644 --- a/riocli/apply/manifests/package-ros-device-rosbag.yaml +++ b/riocli/apply/manifests/package-ros-device-rosbag.yaml @@ -21,6 +21,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + http: + path: "/" + port: 90 + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -32,6 +41,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) diff --git a/riocli/apply/manifests/package.yaml b/riocli/apply/manifests/package.yaml index 77a2665e..f8c3635b 100644 --- a/riocli/apply/manifests/package.yaml +++ b/riocli/apply/manifests/package.yaml @@ -166,6 +166,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -177,6 +186,14 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + tcp: + port: 999 + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) @@ -377,6 +394,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -388,6 +414,15 @@ spec: limits: # Optional cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) @@ -431,6 +466,15 @@ spec: limits: cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. build: depends: kind: build @@ -442,6 +486,15 @@ spec: limits: cpu: 0.025 # Unit: Core (Optional) memory: 128 # Unit: MB (Optional) + livenessProbe: # Optional + exec: + command: + - "shell-cmd" + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness probes are initiated. + periodSeconds: 10 # How often (in seconds) to perform the probe. + failureThreshold: 1 # Minimum consecutive failures for the probe to be considered failed after having succeeded. + successThreshold: 3 # Minimum consecutive successes for the probe to be considered successful after having failed. + timeoutSeconds: 1 # Number of seconds after which the probe times out. docker: image: "busybox:latest" imagePullPolicy: "Always" # Always, Never, IfNotPresent(default) diff --git a/riocli/jsonschema/schemas/package-schema.yaml b/riocli/jsonschema/schemas/package-schema.yaml index d53e46c6..a67c231b 100644 --- a/riocli/jsonschema/schemas/package-schema.yaml +++ b/riocli/jsonschema/schemas/package-schema.yaml @@ -122,8 +122,11 @@ definitions: - docker - build - preInstalled - command: - type: string + command: + type: array + items: + type: string + description: Command to execute for the Exec probe. runAsBash: type: boolean default: True @@ -137,6 +140,10 @@ definitions: memory: type: number minimum: 0 + livenessProbe: + type: object + items: + "$ref": "#definations/livenessProbe" required: - type dependencies: @@ -734,3 +741,73 @@ definitions: type: string guid: type: string + + livenessProbe: + type: object + properties: + httpGet: + type: object + properties: + path: + type: string + description: Path to access for the HTTP probe. + port: + type: integer + description: Port number for the HTTP probe. + schema: + type: string + default: HTTP + description: Scheme to use for connecting to the host. + required: + - path + - port + exec: + type: object + properties: + command: + type: array + items: + type: string + description: Command to execute for the Exec probe. + required: + - command + tcpSocket: + type: object + properties: + port: + type: integer + description: Port number for the TCP probe. + required: + - port + initialDelaySeconds: + type: integer + minimum: 1 + default: 1 + description: Number of seconds after the container has started before liveness probes are initiated. + timeoutSeconds: + type: integer + minimum: 10 + default: 1 + description: Number of seconds after which the probe times out. + periodSeconds: + type: integer + minimum: 1 + default: 1 + description: How often (in seconds) to perform the probe. + successThreshold: + type: integer + default: 3 + minimum: 1 + description: Minimum consecutive successes for the probe to be considered successful after having failed. + failureThreshold: + type: integer + default: 3 + minimum: 1 + description: Minimum consecutive failures for the probe to be considered failed after having succeeded. + oneOf: + - required: + - httpGet + - required: + - tcpSocket + - required: + - exec \ No newline at end of file diff --git a/riocli/package/model.py b/riocli/package/model.py index f670ff6c..ec879a5d 100644 --- a/riocli/package/model.py +++ b/riocli/package/model.py @@ -159,7 +159,6 @@ def create_object(self, client: Client, **kwargs): component_obj.rosBagJobDefs = self.spec.rosBagJobs pkg_object.plans[0].components = [component_obj] - return client.create_package(pkg_object) def update_object(self, client: Client, obj: typing.Any) -> typing.Any: @@ -198,6 +197,9 @@ def _map_executable(self, exec): 'memory': exec.limits.get('memory', 0) } + if 'livenessProbe' in exec: + exec_object.livenessProbe = exec.livenessProbe + if exec.get('runAsBash'): if 'command' in exec: exec_object.cmd = ['/bin/bash', '-c', exec.command]