feat: Added config validation

This commit is contained in:
2026-02-20 05:33:50 +01:00
parent 7b29763230
commit 08c1d0c605
15 changed files with 3077 additions and 36 deletions

90
src/models/runtime.py Normal file
View File

@@ -0,0 +1,90 @@
# generated by datamodel-codegen:
# filename: schema.tRo.json
# timestamp: 2026-02-20T04:31:38+00:00
from __future__ import annotations
from enum import Enum
from pydantic import BaseModel, ConfigDict, Field, constr
class ApiVersion(Enum):
v1alpha1 = 'v1alpha1'
class Kind(Enum):
EventSinkConfig = 'EventSinkConfig'
class EventSinkV1Alpha1(BaseModel):
model_config = ConfigDict(
extra='forbid',
)
apiVersion: ApiVersion = Field(
...,
description='apiVersion is the API version of the resource.\n',
title='apiVersion',
)
kind: Kind = Field(
..., description='kind is the kind of the resource.\n', title='kind'
)
endpoint: str | None = Field(
None,
description='The endpoint for the event sink as host:port.\n',
title='endpoint',
)
class KindModel(Enum):
KmsgLogConfig = 'KmsgLogConfig'
class KmsgLogV1Alpha1(BaseModel):
model_config = ConfigDict(
extra='forbid',
)
apiVersion: ApiVersion = Field(
...,
description='apiVersion is the API version of the resource.\n',
title='apiVersion',
)
kind: KindModel = Field(
..., description='kind is the kind of the resource.\n', title='kind'
)
name: str | None = Field(
None, description='Name of the config document.\n', title='name'
)
url: constr(pattern=r'^(tcp|udp)://') | None = Field(
None,
description='The URL encodes the log destination.\nThe scheme must be tcp:// or udp://.\nThe path must be empty.\nThe port is required.\n',
title='url',
)
class KindModel1(Enum):
WatchdogTimerConfig = 'WatchdogTimerConfig'
class WatchdogTimerV1Alpha1(BaseModel):
model_config = ConfigDict(
extra='forbid',
)
apiVersion: ApiVersion = Field(
...,
description='apiVersion is the API version of the resource.\n',
title='apiVersion',
)
kind: KindModel1 = Field(
..., description='kind is the kind of the resource.\n', title='kind'
)
device: str | None = Field(
None, description='Path to the watchdog device.\n', title='device'
)
timeout: (
constr(pattern=r'^[-+]?(((\d+(\.\d*)?|\d*(\.\d+)+)([nuµm]?s|m|h))|0)+$') | None
) = Field(
None,
description='Timeout for the watchdog.\n\nIf Talos is unresponsive for this duration, the watchdog will reset the system.\n\nDefault value is 1 minute, minimum value is 10 seconds.\n',
title='timeout',
)