Skip to content

Commit 2d91280

Browse files
committed
Renamed for clarification
1 parent 2855190 commit 2d91280

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/cloud_provider_mdns/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Condition(PydanticIgnoreExtraFields):
5050
type: str
5151
status: bool
5252

53-
class RouteParentStatus(PydanticIgnoreExtraFields):
53+
class HTTPRouteParentStatus(PydanticIgnoreExtraFields):
5454
"""
5555
Status for a HTTPRoute parent
5656
"""
@@ -62,7 +62,7 @@ class HTTPRouteStatus(PydanticIgnoreExtraFields):
6262
"""
6363
Status for a HTTPRoute
6464
"""
65-
parents: typing.List[RouteParentStatus] = pydantic.Field(default_factory=list)
65+
parents: typing.List[HTTPRouteParentStatus] = pydantic.Field(default_factory=list)
6666

6767
class HTTPRoute(PydanticIgnoreExtraFields):
6868
"""
@@ -80,7 +80,7 @@ def accepted(self) -> bool:
8080
return all(condition.status for condition in self.status.parents[0].conditions \
8181
if condition.type == 'Accepted')
8282

83-
def spec_parent_by_status_parent_ref(self, parent: RouteParentStatus) -> ParentReference:
83+
def spec_parent_by_status_parent_ref(self, parent: HTTPRouteParentStatus) -> ParentReference:
8484
"""
8585
Return the spec parent for the given status parent ref of the HTTPRoute
8686
"""
@@ -92,7 +92,7 @@ def spec_parent_by_status_parent_ref(self, parent: RouteParentStatus) -> ParentR
9292
def __str__(self) -> str:
9393
return f'{self.metadata.namespace}/{self.metadata.name}'
9494

95-
class GatewayListenerSpec(PydanticIgnoreExtraFields):
95+
class KubernetesGatewayListenerSpec(PydanticIgnoreExtraFields):
9696
"""
9797
Spec for a GatewayListener
9898
"""
@@ -104,9 +104,9 @@ class KubernetesGatewaySpec(PydanticIgnoreExtraFields):
104104
"""
105105
Spec for a Gateway
106106
"""
107-
listeners: typing.List[GatewayListenerSpec] = pydantic.Field(default_factory=list)
107+
listeners: typing.List[KubernetesGatewayListenerSpec] = pydantic.Field(default_factory=list)
108108

109-
class GatewayAddresses(PydanticIgnoreExtraFields):
109+
class KubernetesGatewayAddresses(PydanticIgnoreExtraFields):
110110
"""
111111
Addresses for a Gateway
112112
"""
@@ -117,7 +117,7 @@ class KubernetesGatewayStatus(PydanticIgnoreExtraFields):
117117
"""
118118
Status for a Gateway
119119
"""
120-
addresses: typing.List[GatewayAddresses] = pydantic.Field(default_factory=list)
120+
addresses: typing.List[KubernetesGatewayAddresses] = pydantic.Field(default_factory=list)
121121

122122
class KubernetesGateway(PydanticIgnoreExtraFields):
123123
"""

tests/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import pydantic
55

66
from cloud_provider_mdns.base import KubernetesGateway, HTTPRoute, ObjectMeta, HTTPRouteSpec, \
7-
ParentReference, HTTPRouteStatus, RouteParentStatus, Condition, BaseNameserver, Record, \
8-
KubernetesGatewaySpec, GatewayListenerSpec, KubernetesGatewayStatus, GatewayAddresses
7+
ParentReference, HTTPRouteStatus, HTTPRouteParentStatus, Condition, BaseNameserver, Record, \
8+
KubernetesGatewaySpec, KubernetesGatewayListenerSpec, KubernetesGatewayStatus, KubernetesGatewayAddresses
99
from cloud_provider_mdns.registry import Registry
1010

1111
@pytest.fixture(scope='function')
@@ -21,8 +21,8 @@ def gateway(registry):
2121
apiVersion='gateway.networking.k8s.io/v1',
2222
kind='Gateway',
2323
metadata=ObjectMeta(name='gw', namespace='edge'),
24-
spec=KubernetesGatewaySpec(listeners=[GatewayListenerSpec(name='https', port=443, protocol='HTTPS')]),
25-
status=KubernetesGatewayStatus(addresses=[GatewayAddresses(type='IPAddress', value='172.18.0.2')]))
24+
spec=KubernetesGatewaySpec(listeners=[KubernetesGatewayListenerSpec(name='https', port=443, protocol='HTTPS')]),
25+
status=KubernetesGatewayStatus(addresses=[KubernetesGatewayAddresses(type='IPAddress', value='172.18.0.2')]))
2626

2727
@pytest.fixture(scope='function')
2828
def route():
@@ -32,12 +32,12 @@ def route():
3232
metadata=ObjectMeta(name='app-route', namespace='app'),
3333
spec=HTTPRouteSpec(hostnames=['app.local'], parentRefs=[ParentReference(namespace='edge', name='gw')]),
3434
status=HTTPRouteStatus(
35-
parents=[RouteParentStatus(parentRef=ParentReference(namespace='edge', name='gw'),
36-
controllerName='istio.io/gateway-controller',
37-
conditions=[
35+
parents=[HTTPRouteParentStatus(parentRef=ParentReference(namespace='edge', name='gw'),
36+
controllerName='istio.io/gateway-controller',
37+
conditions=[
3838
Condition(type='Accepted', status=True),
3939
Condition(type='ResolvedRefs', status=True)
4040
])
41-
]
41+
]
4242
)
4343
)

tests/test_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from cloud_provider_mdns.base import ParentReference, GatewayListenerSpec
3+
from cloud_provider_mdns.base import ParentReference, KubernetesGatewayListenerSpec
44

55

66
@pytest.mark.asyncio

0 commit comments

Comments
 (0)