Skip to content

feat: Add ScaledObject resources #2497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified class_generator/schema/__resources-mappings.json.gz
Binary file not shown.
350,949 changes: 77,384 additions & 273,565 deletions class_generator/schema/_definitions.json

Large diffs are not rendered by default.

32 changes: 14 additions & 18 deletions class_generator/tests/manifests/Deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ def __init__(
name value path port scheme enum: HTTP, HTTPS sleep seconds
tcpSocket host port preStop exec command httpGet host httpHeaders
name value path port scheme enum: HTTP, HTTPS sleep seconds
tcpSocket host port stopSignal enum: SIGABRT, SIGALRM, SIGBUS,
SIGCHLD, .... livenessProbe exec command failureThreshold grpc
port service httpGet host httpHeaders name value path port scheme
enum: HTTP, HTTPS initialDelaySeconds periodSeconds
tcpSocket host port livenessProbe exec command failureThreshold
grpc port service httpGet host httpHeaders name value path port
scheme enum: HTTP, HTTPS initialDelaySeconds periodSeconds
successThreshold tcpSocket host port terminationGracePeriodSeconds
timeoutSeconds name ports containerPort hostIP hostPort name
protocol enum: SCTP, TCP, UDP readinessProbe exec command
Expand Down Expand Up @@ -132,10 +131,9 @@ def __init__(
name value path port scheme enum: HTTP, HTTPS sleep seconds
tcpSocket host port preStop exec command httpGet host httpHeaders
name value path port scheme enum: HTTP, HTTPS sleep seconds
tcpSocket host port stopSignal enum: SIGABRT, SIGALRM, SIGBUS,
SIGCHLD, .... livenessProbe exec command failureThreshold grpc
port service httpGet host httpHeaders name value path port scheme
enum: HTTP, HTTPS initialDelaySeconds periodSeconds
tcpSocket host port livenessProbe exec command failureThreshold
grpc port service httpGet host httpHeaders name value path port
scheme enum: HTTP, HTTPS initialDelaySeconds periodSeconds
successThreshold tcpSocket host port terminationGracePeriodSeconds
timeoutSeconds name ports containerPort hostIP hostPort name
protocol enum: SCTP, TCP, UDP readinessProbe exec command
Expand Down Expand Up @@ -171,8 +169,7 @@ def __init__(
value path port scheme enum: HTTP, HTTPS sleep seconds tcpSocket
host port preStop exec command httpGet host httpHeaders name value
path port scheme enum: HTTP, HTTPS sleep seconds tcpSocket host
port stopSignal enum: SIGABRT, SIGALRM, SIGBUS, SIGCHLD, ....
livenessProbe exec command failureThreshold grpc port service
port livenessProbe exec command failureThreshold grpc port service
httpGet host httpHeaders name value path port scheme enum: HTTP,
HTTPS initialDelaySeconds periodSeconds successThreshold tcpSocket
host port terminationGracePeriodSeconds timeoutSeconds name ports
Expand Down Expand Up @@ -202,14 +199,13 @@ def __init__(
subPathExpr workingDir nodeName nodeSelector os name overhead
preemptionPolicy enum: Never, PreemptLowerPriority priority
priorityClassName readinessGates conditionType resourceClaims name
resourceClaimName resourceClaimTemplateName resources claims name
request limits requests restartPolicy enum: Always, Never,
OnFailure runtimeClassName schedulerName schedulingGates name
securityContext appArmorProfile localhostProfile type enum:
Localhost, RuntimeDefault, Unconfined fsGroup fsGroupChangePolicy
enum: Always, OnRootMismatch runAsGroup runAsNonRoot runAsUser
seLinuxChangePolicy seLinuxOptions level role type user
seccompProfile localhostProfile type enum: Localhost,
resourceClaimName resourceClaimTemplateName restartPolicy enum:
Always, Never, OnFailure runtimeClassName schedulerName
schedulingGates name securityContext appArmorProfile
localhostProfile type enum: Localhost, RuntimeDefault, Unconfined
fsGroup fsGroupChangePolicy enum: Always, OnRootMismatch
runAsGroup runAsNonRoot runAsUser seLinuxOptions level role type
user seccompProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined supplementalGroups
supplementalGroupsPolicy enum: Merge, Strict sysctls name value
windowsOptions gmsaCredentialSpec gmsaCredentialSpecName
Expand Down
144 changes: 68 additions & 76 deletions class_generator/tests/manifests/Pod/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(
priority_class_name: str | None = None,
readiness_gates: list[Any] | None = None,
resource_claims: list[Any] | None = None,
resources: dict[str, Any] | None = None,
restart_policy: str | None = None,
runtime_class_name: str | None = None,
scheduler_name: str | None = None,
Expand Down Expand Up @@ -102,30 +101,30 @@ def __init__(
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port preStop exec command httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port stopSignal enum: SIGABRT, SIGALRM,
SIGBUS, SIGCHLD, .... livenessProbe exec command failureThreshold
grpc port service httpGet host httpHeaders name value path port
scheme enum: HTTP, HTTPS initialDelaySeconds periodSeconds
successThreshold tcpSocket host port terminationGracePeriodSeconds
timeoutSeconds name ports containerPort hostIP hostPort name
protocol enum: SCTP, TCP, UDP readinessProbe exec command
seconds tcpSocket host port livenessProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds resizePolicy
resourceName restartPolicy resources claims name request limits
requests restartPolicy securityContext allowPrivilegeEscalation
appArmorProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined capabilities add drop privileged
procMount enum: Default, Unmasked readOnlyRootFilesystem
runAsGroup runAsNonRoot runAsUser seLinuxOptions level role type
user seccompProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined windowsOptions gmsaCredentialSpec
gmsaCredentialSpecName hostProcess runAsUserName startupProbe exec
command failureThreshold grpc port service httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS
initialDelaySeconds periodSeconds successThreshold tcpSocket host
port terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
terminationGracePeriodSeconds timeoutSeconds name ports
containerPort hostIP hostPort name protocol enum: SCTP, TCP, UDP
readinessProbe exec command failureThreshold grpc port service
httpGet host httpHeaders name value path port scheme enum: HTTP,
HTTPS initialDelaySeconds periodSeconds successThreshold tcpSocket
host port terminationGracePeriodSeconds timeoutSeconds
resizePolicy resourceName restartPolicy resources claims name
request limits requests restartPolicy securityContext
allowPrivilegeEscalation appArmorProfile localhostProfile type
enum: Localhost, RuntimeDefault, Unconfined capabilities add drop
privileged procMount enum: Default, Unmasked
readOnlyRootFilesystem runAsGroup runAsNonRoot runAsUser
seLinuxOptions level role type user seccompProfile
localhostProfile type enum: Localhost, RuntimeDefault, Unconfined
windowsOptions gmsaCredentialSpec gmsaCredentialSpecName
hostProcess runAsUserName startupProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
terminationMessagePath terminationMessagePolicy enum:
FallbackToLogsOnError, File tty volumeDevices devicePath name
volumeMounts mountPath mountPropagation enum: Bidirectional,
Expand Down Expand Up @@ -153,30 +152,30 @@ def __init__(
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port preStop exec command httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port stopSignal enum: SIGABRT, SIGALRM,
SIGBUS, SIGCHLD, .... livenessProbe exec command failureThreshold
grpc port service httpGet host httpHeaders name value path port
scheme enum: HTTP, HTTPS initialDelaySeconds periodSeconds
successThreshold tcpSocket host port terminationGracePeriodSeconds
timeoutSeconds name ports containerPort hostIP hostPort name
protocol enum: SCTP, TCP, UDP readinessProbe exec command
seconds tcpSocket host port livenessProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds name ports
containerPort hostIP hostPort name protocol enum: SCTP, TCP, UDP
readinessProbe exec command failureThreshold grpc port service
httpGet host httpHeaders name value path port scheme enum: HTTP,
HTTPS initialDelaySeconds periodSeconds successThreshold tcpSocket
host port terminationGracePeriodSeconds timeoutSeconds
resizePolicy resourceName restartPolicy resources claims name
request limits requests restartPolicy securityContext
allowPrivilegeEscalation appArmorProfile localhostProfile type
enum: Localhost, RuntimeDefault, Unconfined capabilities add drop
privileged procMount enum: Default, Unmasked
readOnlyRootFilesystem runAsGroup runAsNonRoot runAsUser
seLinuxOptions level role type user seccompProfile
localhostProfile type enum: Localhost, RuntimeDefault, Unconfined
windowsOptions gmsaCredentialSpec gmsaCredentialSpecName
hostProcess runAsUserName startupProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds resizePolicy
resourceName restartPolicy resources claims name request limits
requests restartPolicy securityContext allowPrivilegeEscalation
appArmorProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined capabilities add drop privileged
procMount enum: Default, Unmasked readOnlyRootFilesystem
runAsGroup runAsNonRoot runAsUser seLinuxOptions level role type
user seccompProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined windowsOptions gmsaCredentialSpec
gmsaCredentialSpecName hostProcess runAsUserName startupProbe exec
command failureThreshold grpc port service httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS
initialDelaySeconds periodSeconds successThreshold tcpSocket host
port terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
targetContainerName terminationMessagePath
terminationMessagePolicy enum: FallbackToLogsOnError, File tty
volumeDevices devicePath name volumeMounts mountPath
Expand Down Expand Up @@ -222,30 +221,30 @@ def __init__(
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port preStop exec command httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS sleep
seconds tcpSocket host port stopSignal enum: SIGABRT, SIGALRM,
SIGBUS, SIGCHLD, .... livenessProbe exec command failureThreshold
grpc port service httpGet host httpHeaders name value path port
scheme enum: HTTP, HTTPS initialDelaySeconds periodSeconds
successThreshold tcpSocket host port terminationGracePeriodSeconds
timeoutSeconds name ports containerPort hostIP hostPort name
protocol enum: SCTP, TCP, UDP readinessProbe exec command
seconds tcpSocket host port livenessProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds resizePolicy
resourceName restartPolicy resources claims name request limits
requests restartPolicy securityContext allowPrivilegeEscalation
appArmorProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined capabilities add drop privileged
procMount enum: Default, Unmasked readOnlyRootFilesystem
runAsGroup runAsNonRoot runAsUser seLinuxOptions level role type
user seccompProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined windowsOptions gmsaCredentialSpec
gmsaCredentialSpecName hostProcess runAsUserName startupProbe exec
command failureThreshold grpc port service httpGet host
httpHeaders name value path port scheme enum: HTTP, HTTPS
initialDelaySeconds periodSeconds successThreshold tcpSocket host
port terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
terminationGracePeriodSeconds timeoutSeconds name ports
containerPort hostIP hostPort name protocol enum: SCTP, TCP, UDP
readinessProbe exec command failureThreshold grpc port service
httpGet host httpHeaders name value path port scheme enum: HTTP,
HTTPS initialDelaySeconds periodSeconds successThreshold tcpSocket
host port terminationGracePeriodSeconds timeoutSeconds
resizePolicy resourceName restartPolicy resources claims name
request limits requests restartPolicy securityContext
allowPrivilegeEscalation appArmorProfile localhostProfile type
enum: Localhost, RuntimeDefault, Unconfined capabilities add drop
privileged procMount enum: Default, Unmasked
readOnlyRootFilesystem runAsGroup runAsNonRoot runAsUser
seLinuxOptions level role type user seccompProfile
localhostProfile type enum: Localhost, RuntimeDefault, Unconfined
windowsOptions gmsaCredentialSpec gmsaCredentialSpecName
hostProcess runAsUserName startupProbe exec command
failureThreshold grpc port service httpGet host httpHeaders name
value path port scheme enum: HTTP, HTTPS initialDelaySeconds
periodSeconds successThreshold tcpSocket host port
terminationGracePeriodSeconds timeoutSeconds stdin stdinOnce
terminationMessagePath terminationMessagePolicy enum:
FallbackToLogsOnError, File tty volumeDevices devicePath name
volumeMounts mountPath mountPropagation enum: Bidirectional,
Expand Down Expand Up @@ -324,8 +323,6 @@ def __init__(

resource_claims (list[Any]): name resourceClaimName resourceClaimTemplateName.

resources (dict[str, Any]): claims name request limits requests.

restart_policy (str): Restart policy for all containers within the pod. One of Always,
OnFailure, Never. In some contexts, only a subset of those values
may be permitted. Default to Always. More info:
Expand All @@ -351,10 +348,9 @@ def __init__(

security_context (dict[str, Any]): appArmorProfile localhostProfile type enum: Localhost, RuntimeDefault,
Unconfined fsGroup fsGroupChangePolicy enum: Always,
OnRootMismatch runAsGroup runAsNonRoot runAsUser
seLinuxChangePolicy seLinuxOptions level role type user
seccompProfile localhostProfile type enum: Localhost,
RuntimeDefault, Unconfined supplementalGroups
OnRootMismatch runAsGroup runAsNonRoot runAsUser seLinuxOptions
level role type user seccompProfile localhostProfile type enum:
Localhost, RuntimeDefault, Unconfined supplementalGroups
supplementalGroupsPolicy enum: Merge, Strict sysctls name value
windowsOptions gmsaCredentialSpec gmsaCredentialSpecName
hostProcess runAsUserName.
Expand All @@ -371,8 +367,8 @@ def __init__(
means setting the FQDN in the hostname field of the kernel (the
nodename field of struct utsname). In Windows containers, this
means setting the registry value of hostname for the registry key
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Pa
rameters to FQDN. If a pod does not have FQDN, this has no effect.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Paramet
ers to FQDN. If a pod does not have FQDN, this has no effect.
Default to false.

share_process_namespace (bool): Share a single process namespace between all of the containers in a
Expand Down Expand Up @@ -475,7 +471,6 @@ def __init__(
self.priority_class_name = priority_class_name
self.readiness_gates = readiness_gates
self.resource_claims = resource_claims
self.resources = resources
self.restart_policy = restart_policy
self.runtime_class_name = runtime_class_name
self.scheduler_name = scheduler_name
Expand Down Expand Up @@ -575,9 +570,6 @@ def to_dict(self) -> None:
if self.resource_claims is not None:
_spec["resourceClaims"] = self.resource_claims

if self.resources is not None:
_spec["resources"] = self.resources

if self.restart_policy is not None:
_spec["restartPolicy"] = self.restart_policy

Expand Down
18 changes: 9 additions & 9 deletions class_generator/tests/test_class_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ def test_parse_explain(tmp_path: Path) -> None:
"""Test all resource kinds in parallel and collect all failures."""
# List of all resource kinds to test
resource_kinds = [
"APIServer",
"Pod",
"Pipeline",
"OAuth",
"ClusterOperator",
"ConfigMap",
"DNS",
"Deployment",
"ImageContentSourcePolicy",
"Machine",
"ServiceMeshMember",
"NMState",
"OAuth",
"Pod",
"Deployment",
"Machine",
"APIServer",
"Secret",
"ServiceMeshMember",
"Pipeline",
"ConfigMap",
"DNS",
"ServingRuntime",
"RouteAdvertisements",
]
Expand Down
1 change: 1 addition & 0 deletions ocp_resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ class ApiGroup:
K8S_MARIADB_COM: str = "k8s.mariadb.com"
K8S_OVN_ORG: str = "k8s.ovn.org"
K8S_V1_CNI_CNCF_IO: str = "k8s.v1.cni.cncf.io"
KEDA_SH: str = "keda.sh"
KUBEFLOW_ORG: str = "kubeflow.org"
KUBERNETES_IO: str = "kubernetes.io"
KUBEVIRT_IO: str = "kubevirt.io"
Expand Down
Loading