Changeset View
Changeset View
Standalone View
Standalone View
helm/dagster/schema/schema/charts/utils/kubernetes.py
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
class SecurityContext(BaseModel): | class SecurityContext(BaseModel): | ||||
__root__: Dict[str, Any] | __root__: Dict[str, Any] | ||||
class Config: | class Config: | ||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.SecurityContext")} | schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.SecurityContext")} | ||||
class InitContainer(BaseModel): | |||||
name: str | |||||
image: str | |||||
command: List[str] | |||||
rexledesma: we shouldn't be adding fields to these classes - the point is that they exactly match the… | |||||
Done Inline ActionsAh ok - I saw some classes with fields and some without, so wasn't sure. I'll remove them. sidkmenon: Ah ok - I saw some classes with fields and some without, so wasn't sure. I'll remove them. | |||||
Done Inline ActionsDecided to refrain from schema_extra here since InitContainer isn't supported by the JSON schema API we use - was thinking about trying to hand-roll some validation hooks to show the difference between this and Container but to keep things simple decided to just provide these fields for now. sidkmenon: Decided to refrain from `schema_extra` here since `InitContainer` isn't supported by the JSON… | |||||
Not Done Inline ActionsLooks like they type InitContainer as Container in https://kubernetesjsonschema.dev/v1.15.0/_definitions.json - let's just use Container as the schema for InitContainer to keep it simple. rexledesma: Looks like they type `InitContainer` as `Container` in https://kubernetesjsonschema.dev/v1.15. | |||||
class Config: | |||||
# TODO: InitContainers don't support everything that normal containers do | |||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.Container")} | |||||
class Resources(BaseModel): | class Resources(BaseModel): | ||||
__root__: Dict[str, Any] | __root__: Dict[str, Any] | ||||
class Config: | class Config: | ||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.ResourceRequirements")} | schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.ResourceRequirements")} | ||||
class LivenessProbe(BaseModel): | class LivenessProbe(BaseModel): | ||||
Show All 14 Lines | |||||
class SecretRef(BaseModel): | class SecretRef(BaseModel): | ||||
class Config: | class Config: | ||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.LocalObjectReference")} | schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.LocalObjectReference")} | ||||
class SecretEnvSource(BaseModel): | class SecretEnvSource(BaseModel): | ||||
name: str | |||||
optional: bool | |||||
class Config: | class Config: | ||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.SecretEnvSource")} | schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.SecretEnvSource")} | ||||
class ConfigMapEnvSource(BaseModel): | class ConfigMapEnvSource(BaseModel): | ||||
class Config: | class Config: | ||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.ConfigMapEnvSource")} | schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.ConfigMapEnvSource")} | ||||
class VolumeMount(BaseModel): | |||||
name: str | |||||
mountPath: str | |||||
subPath: str | |||||
secret: str | |||||
class Config: | |||||
schema_extra = {"$ref": create_definition_ref("io.k8s.api.core.v1.VolumeMount")} |
we shouldn't be adding fields to these classes - the point is that they exactly match the kubernetes object that they represent (as expressed through schema extra)