Skip to content

Commit

Permalink
Fix applying property attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gu <[email protected]>
  • Loading branch information
tylergu committed Feb 13, 2024
1 parent 2df2dd9 commit cbf6c84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion acto/checker/impl/consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ def check(
)
if (
diff_type == "iterable_item_removed"
or corresponding_schema.patch
or corresponding_schema.attributes & PropertyAttribute.Patch
== PropertyAttribute.Patch
or input_diff.path[-1] == "ACTOKEY"
):
pass
Expand Down
10 changes: 3 additions & 7 deletions acto/input/k8s_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,14 +609,10 @@ def expand_top_level_matched_schemas(
if isinstance(crd_schema, ObjectSchema):
if isinstance(k8s_schema, KubernetesObjectSchema):
for key, sub_schema in crd_schema.properties.items():
if key not in k8s_schema.properties:
raise RuntimeError(
f"Property {key} not found"
f"in k8s schema {k8s_schema.k8s_schema_name}"
if key in k8s_schema.properties:
to_explore.append(
(sub_schema, k8s_schema.properties[key])
)
to_explore.append(
(sub_schema, k8s_schema.properties[key])
)
elif (
isinstance(k8s_schema, KubernetesMapSchema)
and crd_schema.additional_properties is not None
Expand Down
8 changes: 8 additions & 0 deletions data/rabbitmq-operator/custom_mapping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from acto.input.input import CustomKubernetesMapping
from acto.input.property_attribute import (
PropertyAttribute,
tag_property_attribute,
)

KUBERNETES_TYPE_MAPPING: list[CustomKubernetesMapping] = [
CustomKubernetesMapping(
Expand All @@ -10,3 +14,7 @@
kubernetes_schema_name="io.k8s.api.core.v1.ServiceSpec",
),
]

tag_property_attribute(
["spec", "override", "statefulSet", "spec"], PropertyAttribute.Patch
)

0 comments on commit cbf6c84

Please sign in to comment.