Skip to content
Closed
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
7 changes: 7 additions & 0 deletions policy-controller/k8s/status/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub(crate) struct RouteRef<S> {
pub(crate) parents: Vec<routes::ParentReference>,
pub(crate) backends: Vec<routes::BackendReference>,
pub(crate) statuses: Vec<S>,
pub(crate) generation: Option<i64>,
}

pub(crate) type HTTPRouteRef = RouteRef<gateway::HTTPRouteStatus>;
Expand Down Expand Up @@ -948,6 +949,7 @@ impl Index {

let status = gateway::HTTPRouteStatus {
parents: all_statuses,
observed_generation: route.generation,
};

make_patch(id, status)
Expand Down Expand Up @@ -1367,6 +1369,7 @@ impl kubert::index::IndexNamespacedResource<policy::HttpRoute> for Index {
parents,
backends,
statuses: vec![gateway::HTTPRouteStatus { parents: statuses }],
generation: resource.metadata.generation,
};
tracing::trace!(?route);
// Insert into the index; if the route is already in the index, and it hasn't
Expand Down Expand Up @@ -1437,6 +1440,7 @@ impl kubert::index::IndexNamespacedResource<gateway::HTTPRoute> for Index {
parents,
backends,
statuses: vec![gateway::HTTPRouteStatus { parents: statuses }],
generation: resource.metadata.generation,
};
tracing::trace!(?route);
// Insert into the index; if the route is already in the index, and it hasn't
Expand Down Expand Up @@ -1507,6 +1511,7 @@ impl kubert::index::IndexNamespacedResource<gateway::GRPCRoute> for Index {
parents,
backends,
statuses: vec![gateway::GRPCRouteStatus { parents: statuses }],
generation: resource.metadata.generation,
};
tracing::trace!(?route);
// Insert into the index; if the route is already in the index, and it hasn't
Expand Down Expand Up @@ -1575,6 +1580,7 @@ impl kubert::index::IndexNamespacedResource<gateway::TLSRoute> for Index {
let route = RouteRef {
parents,
backends,
generation: resource.metadata.generation,
statuses: vec![gateway::TLSRouteStatus { parents: statuses }],
};
tracing::trace!(?route);
Expand Down Expand Up @@ -1645,6 +1651,7 @@ impl kubert::index::IndexNamespacedResource<gateway::TCPRoute> for Index {
parents,
backends,
statuses: vec![gateway::TCPRouteStatus { parents: statuses }],
generation: resource.metadata.generation,
};
tracing::trace!(?route);
// Insert into the index; if the route is already in the index, and it hasn't
Expand Down
16 changes: 16 additions & 0 deletions policy-controller/k8s/status/src/tests/conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_http_route(
Expand All @@ -77,6 +78,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_tls_route(
Expand All @@ -92,6 +94,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_tcp_route(
Expand All @@ -107,6 +110,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -143,6 +147,7 @@ fn http_route_conflict_grpc(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -179,6 +184,7 @@ fn http_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_tls_route(
Expand All @@ -194,6 +200,7 @@ fn http_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_tcp_route(
Expand All @@ -209,6 +216,7 @@ fn http_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -245,6 +253,7 @@ fn tls_route_conflict_http(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -281,6 +290,7 @@ fn tls_route_conflict_grpc(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -317,6 +327,7 @@ fn tls_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);
index.write().update_tcp_route(
Expand All @@ -332,6 +343,7 @@ fn tls_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -368,6 +380,7 @@ fn tcp_route_conflict_grpc(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -404,6 +417,7 @@ fn tcp_route_conflict_http(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -440,6 +454,7 @@ fn tcp_route_conflict_tls(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down Expand Up @@ -476,6 +491,7 @@ fn tcp_route_no_conflict(p: ParentRefType) {
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
generation: None,
},
);

Expand Down