meta-digi-containers: remove DRM options
The DRM support is still a work in progress feature and is not ready yet. Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
0df6685a07
commit
9576c20113
|
|
@ -99,43 +99,11 @@ This generates a bundle named like:
|
|||
In those manifests:
|
||||
|
||||
- `name` is the stable logical container name stored on the target.
|
||||
- `friendly_name` is the user-facing label shown by DRM and the manager output when available.
|
||||
- `friendly_name` is the user-facing label shown by the manager output when available.
|
||||
- the final `package_id` is generated automatically from `name` unless the
|
||||
input manifest provides an explicit `package_id`
|
||||
|
||||
## Digi Remote Manager metrics support
|
||||
|
||||
`dey-image-container-manager` includes `cc-container-mng` that has the capability to
|
||||
publish container statistics through the local CCCS Python API.
|
||||
For generated DCPs, DRM behavior is controlled through `registration_defaults.drm`
|
||||
in the artifact manifest.
|
||||
Those manifest defaults establish the initial runtime policy on the target.
|
||||
After installation, mutable policy such as `autostart`, `monitor`, `restart`, and
|
||||
`drm` can be inspected or updated through the container manager `config`
|
||||
`get` and `set` operations without regenerating the DCP.
|
||||
The image recipe generates the DCP automatically from the following variables:
|
||||
|
||||
- `CONTAINER_DRM_ENABLED`
|
||||
- `CONTAINER_DRM_STATS_SAMPLE_INTERVAL`
|
||||
- `CONTAINER_DRM_STATS_LIST_OF_METRICS`
|
||||
|
||||
Example:
|
||||
|
||||
```conf
|
||||
CONTAINER_DRM_ENABLED = "true"
|
||||
CONTAINER_DRM_STATS_SAMPLE_INTERVAL = "30"
|
||||
CONTAINER_DRM_STATS_LIST_OF_METRICS = "[\"cpu\", \"mem\"]"
|
||||
```
|
||||
|
||||
`CONTAINER_DRM_STATS_LIST_OF_METRICS` follows the same semantics as the target
|
||||
manager:
|
||||
|
||||
- `["all"]` is accepted as a shorthand input for all periodic metrics.
|
||||
- `[]` publishes no periodic metrics.
|
||||
- any other list publishes only the selected metrics.
|
||||
|
||||
Generated manifests and target-side effective configuration use the explicit
|
||||
metric list.
|
||||
- `registration_defaults` is limited to local manager policy such as `autostart`,
|
||||
`monitor`, and `restart`; this release does not generate DRM-specific defaults
|
||||
|
||||
`dey-image-container-manager` also overrides the manager persistent base path
|
||||
through `CC_CONTAINER_PATH`, which defaults to `${ROOT_HOME}/cc-container` in
|
||||
|
|
@ -326,9 +294,6 @@ Relevant variables:
|
|||
- `CONTAINER_FRIENDLY_NAME`
|
||||
- `CONTAINER_ARTIFACT_VERSION`
|
||||
- `CONTAINER_CREATE_ARGS_PODMAN`
|
||||
- `CONTAINER_DRM_ENABLED`
|
||||
- `CONTAINER_DRM_STATS_SAMPLE_INTERVAL`
|
||||
- `CONTAINER_DRM_STATS_LIST_OF_METRICS`
|
||||
- `CONTAINER_FIRMWARE_VERSIONS`
|
||||
- `CONTAINER_DEVICE_TYPES_JSON`
|
||||
- `CONTAINER_ARTIFACT_DESCRIPTION`
|
||||
|
|
|
|||
|
|
@ -6,19 +6,6 @@
|
|||
"registration_defaults": {
|
||||
"autostart": true,
|
||||
"monitor": true,
|
||||
"drm": {
|
||||
"enabled": true,
|
||||
"stats_sample_interval_s": 30,
|
||||
"stats_list_of_metrics": [
|
||||
"uptime",
|
||||
"cpu",
|
||||
"mem",
|
||||
"net/rx",
|
||||
"net/tx",
|
||||
"disk/read",
|
||||
"disk/write"
|
||||
]
|
||||
},
|
||||
"restart": {
|
||||
"enabled": true,
|
||||
"max_retries": 3,
|
||||
|
|
|
|||
|
|
@ -7,19 +7,6 @@
|
|||
"registration_defaults": {
|
||||
"autostart": true,
|
||||
"monitor": true,
|
||||
"drm": {
|
||||
"enabled": true,
|
||||
"stats_sample_interval_s": 30,
|
||||
"stats_list_of_metrics": [
|
||||
"uptime",
|
||||
"cpu",
|
||||
"mem",
|
||||
"net/rx",
|
||||
"net/tx",
|
||||
"disk/read",
|
||||
"disk/write"
|
||||
]
|
||||
},
|
||||
"restart": {
|
||||
"enabled": true,
|
||||
"max_retries": 3,
|
||||
|
|
|
|||
|
|
@ -59,9 +59,6 @@ do_image_container_artifacts() {
|
|||
CREATE_ARGS="${create_args}" \
|
||||
AUTOSTART="${CONTAINER_AUTOSTART}" \
|
||||
MONITOR="${CONTAINER_MONITOR}" \
|
||||
DRM_ENABLED="${CONTAINER_DRM_ENABLED}" \
|
||||
DRM_STATS_SAMPLE_INTERVAL="${CONTAINER_DRM_STATS_SAMPLE_INTERVAL}" \
|
||||
DRM_STATS_LIST_OF_METRICS="${CONTAINER_DRM_STATS_LIST_OF_METRICS}" \
|
||||
RESTART_ENABLED="${CONTAINER_RESTART_ENABLED}" \
|
||||
RESTART_MAX_RETRIES="${CONTAINER_RESTART_MAX_RETRIES}" \
|
||||
RESTART_WINDOW="${CONTAINER_RESTART_WINDOW}" \
|
||||
|
|
@ -73,7 +70,7 @@ do_image_container_artifacts() {
|
|||
LABELS_JSON="${CONTAINER_ARTIFACT_LABELS_JSON}" \
|
||||
python3 -c 'import json, os, sys; \
|
||||
parse_bool = lambda name: os.environ[name].strip().lower() == "true"; \
|
||||
payload = {"name": os.environ["NAME"], "friendly_name": os.environ["FRIENDLY_NAME"], "version": os.environ["VERSION"], "runtime": os.environ["RUNTIME"], "registration_defaults": {"autostart": parse_bool("AUTOSTART"), "monitor": parse_bool("MONITOR"), "drm": {"enabled": parse_bool("DRM_ENABLED"), "stats_sample_interval_s": int(os.environ["DRM_STATS_SAMPLE_INTERVAL"]), "stats_list_of_metrics": json.loads(os.environ["DRM_STATS_LIST_OF_METRICS"])}, "restart": {"enabled": parse_bool("RESTART_ENABLED"), "max_retries": int(os.environ["RESTART_MAX_RETRIES"]), "window": int(os.environ["RESTART_WINDOW"]), "retry_delay": int(os.environ["RESTART_RETRY_DELAY"]) } }, "device_types": json.loads(os.environ["DEVICE_TYPES_JSON"]), "firmware_versions": os.environ["FIRMWARE_VERSIONS"], "build_id": os.environ["BUILD_ID"], "description": os.environ["DESCRIPTION"], "labels": json.loads(os.environ["LABELS_JSON"])}; \
|
||||
payload = {"name": os.environ["NAME"], "friendly_name": os.environ["FRIENDLY_NAME"], "version": os.environ["VERSION"], "runtime": os.environ["RUNTIME"], "registration_defaults": {"autostart": parse_bool("AUTOSTART"), "monitor": parse_bool("MONITOR"), "restart": {"enabled": parse_bool("RESTART_ENABLED"), "max_retries": int(os.environ["RESTART_MAX_RETRIES"]), "window": int(os.environ["RESTART_WINDOW"]), "retry_delay": int(os.environ["RESTART_RETRY_DELAY"]) } }, "device_types": json.loads(os.environ["DEVICE_TYPES_JSON"]), "firmware_versions": os.environ["FIRMWARE_VERSIONS"], "build_id": os.environ["BUILD_ID"], "description": os.environ["DESCRIPTION"], "labels": json.loads(os.environ["LABELS_JSON"])}; \
|
||||
create_args = os.environ["CREATE_ARGS"].strip(); \
|
||||
payload.update({"create_args": create_args} if create_args else {}); \
|
||||
open(sys.argv[1], "w", encoding="utf-8").write(json.dumps(payload, indent=2) + "\n")' \
|
||||
|
|
|
|||
|
|
@ -69,9 +69,6 @@ CONTAINER_ARTIFACT_LABELS_JSON ?= "{}"
|
|||
# monitor and (auto/re)start configuration
|
||||
CONTAINER_AUTOSTART ?= "true"
|
||||
CONTAINER_MONITOR ?= "true"
|
||||
CONTAINER_DRM_ENABLED ?= "true"
|
||||
CONTAINER_DRM_STATS_SAMPLE_INTERVAL ?= "30"
|
||||
CONTAINER_DRM_STATS_LIST_OF_METRICS ?= "[\"uptime\", \"cpu\", \"mem\", \"net/rx\", \"net/tx\", \"disk/read\", \"disk/write\"]"
|
||||
CONTAINER_RESTART_ENABLED ?= "true"
|
||||
CONTAINER_RESTART_MAX_RETRIES ?= "3"
|
||||
CONTAINER_RESTART_WINDOW ?= "60"
|
||||
|
|
|
|||
|
|
@ -16,17 +16,6 @@ import tarfile
|
|||
import tempfile
|
||||
|
||||
BASE36_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
SUPPORTED_STATS_METRICS = (
|
||||
"uptime",
|
||||
"cpu",
|
||||
"mem",
|
||||
"net/rx",
|
||||
"net/tx",
|
||||
"disk/read",
|
||||
"disk/write",
|
||||
)
|
||||
SUPPORTED_STATS_METRICS_SET = set(SUPPORTED_STATS_METRICS)
|
||||
|
||||
|
||||
def fail(message: str) -> "NoReturn":
|
||||
raise SystemExit(f"error: {message}")
|
||||
|
|
@ -110,34 +99,6 @@ def validate_labels(value: object) -> dict:
|
|||
return value
|
||||
|
||||
|
||||
def validate_string_list(value: object, *, path: str, allowed: set[str]) -> list[str]:
|
||||
if value is None:
|
||||
return []
|
||||
if not isinstance(value, list):
|
||||
fail(f"invalid manifest: {path} must be an array")
|
||||
result: list[str] = []
|
||||
seen: set[str] = set()
|
||||
for item in value:
|
||||
if not isinstance(item, str) or not item.strip():
|
||||
fail(f"invalid manifest: {path} entries must be non-empty strings")
|
||||
metric = item.strip()
|
||||
if metric not in allowed:
|
||||
fail(f"invalid manifest: {path} contains unsupported metric {metric}")
|
||||
if metric in seen:
|
||||
continue
|
||||
seen.add(metric)
|
||||
result.append(metric)
|
||||
if "all" in result and len(result) > 1:
|
||||
fail(f"invalid manifest: {path} cannot combine all with specific metrics")
|
||||
return result
|
||||
|
||||
|
||||
def normalize_drm_stats_metrics(metrics: list[str]) -> list[str]:
|
||||
if "all" in metrics:
|
||||
return list(SUPPORTED_STATS_METRICS)
|
||||
return metrics
|
||||
|
||||
|
||||
def validate_manifest(data: dict) -> dict:
|
||||
package_id = data.get("package_id")
|
||||
if package_id is not None:
|
||||
|
|
@ -156,10 +117,6 @@ def validate_manifest(data: dict) -> dict:
|
|||
restart = registration_defaults.get("restart")
|
||||
if not isinstance(restart, dict):
|
||||
fail("invalid manifest: registration_defaults.restart must be an object")
|
||||
drm = registration_defaults.get("drm", {})
|
||||
if not isinstance(drm, dict):
|
||||
fail("invalid manifest: registration_defaults.drm must be an object")
|
||||
|
||||
create_args = data.get("create_args")
|
||||
if runtime == "podman":
|
||||
if not isinstance(create_args, str) or not create_args.strip():
|
||||
|
|
@ -196,20 +153,6 @@ def validate_manifest(data: dict) -> dict:
|
|||
"registration_defaults": {
|
||||
"autostart": validate_bool(registration_defaults, "autostart", path="registration_defaults"),
|
||||
"monitor": validate_bool(registration_defaults, "monitor", path="registration_defaults"),
|
||||
"drm": {
|
||||
"enabled": validate_bool(drm, "enabled", path="registration_defaults.drm"),
|
||||
"stats_sample_interval_s": validate_int(
|
||||
drm,
|
||||
"stats_sample_interval_s",
|
||||
path="registration_defaults.drm",
|
||||
minimum=1,
|
||||
),
|
||||
"stats_list_of_metrics": validate_string_list(
|
||||
drm.get("stats_list_of_metrics"),
|
||||
path="registration_defaults.drm.stats_list_of_metrics",
|
||||
allowed=SUPPORTED_STATS_METRICS_SET | {"all"},
|
||||
),
|
||||
},
|
||||
"restart": {
|
||||
"enabled": validate_bool(restart, "enabled", path="registration_defaults.restart"),
|
||||
"max_retries": validate_int(restart, "max_retries", path="registration_defaults.restart", minimum=0),
|
||||
|
|
@ -223,9 +166,6 @@ def validate_manifest(data: dict) -> dict:
|
|||
"description": description or "",
|
||||
"labels": validate_labels(data.get("labels")),
|
||||
}
|
||||
validated["registration_defaults"]["drm"]["stats_list_of_metrics"] = normalize_drm_stats_metrics(
|
||||
validated["registration_defaults"]["drm"]["stats_list_of_metrics"]
|
||||
)
|
||||
return validated
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue