Skip to content
Draft
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
151 changes: 87 additions & 64 deletions policy-controller/k8s/status/src/index.rs

Large diffs are not rendered by default.

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 @@ -59,6 +59,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
},
},
&GRPCRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -74,6 +75,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
},
},
&HTTPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -89,6 +91,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
},
},
&TLSRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -104,6 +107,7 @@ fn grpc_route_no_conflict(p: ParentRefType) {
},
},
&TCPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -140,6 +144,7 @@ fn http_route_conflict_grpc(p: ParentRefType) {
},
},
&GRPCRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -176,6 +181,7 @@ fn http_route_no_conflict(p: ParentRefType) {
},
},
&HTTPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -191,6 +197,7 @@ fn http_route_no_conflict(p: ParentRefType) {
},
},
&TLSRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -206,6 +213,7 @@ fn http_route_no_conflict(p: ParentRefType) {
},
},
&TCPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -242,6 +250,7 @@ fn tls_route_conflict_http(p: ParentRefType) {
},
},
&HTTPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -278,6 +287,7 @@ fn tls_route_conflict_grpc(p: ParentRefType) {
},
},
&GRPCRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -314,6 +324,7 @@ fn tls_route_no_conflict(p: ParentRefType) {
},
},
&TLSRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand All @@ -329,6 +340,7 @@ fn tls_route_no_conflict(p: ParentRefType) {
},
},
&TCPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -365,6 +377,7 @@ fn tcp_route_conflict_grpc(p: ParentRefType) {
},
},
&GRPCRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -401,6 +414,7 @@ fn tcp_route_conflict_http(p: ParentRefType) {
},
},
&HTTPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -437,6 +451,7 @@ fn tcp_route_conflict_tls(p: ParentRefType) {
},
},
&TLSRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down Expand Up @@ -473,6 +488,7 @@ fn tcp_route_no_conflict(p: ParentRefType) {
},
},
&TCPRouteRef {
generation: None,
parents: vec![parent.clone()],
statuses: vec![],
backends: vec![],
Expand Down
7 changes: 4 additions & 3 deletions policy-controller/k8s/status/src/tests/egress_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn egress_network_with_no_networks_specified() {

// Create the expected update.
let status = EgressNetworkStatus {
conditions: vec![accepted()],
conditions: vec![accepted(None)],
};
let patch = crate::index::make_patch(&id, status).unwrap();

Expand Down Expand Up @@ -120,7 +120,7 @@ fn egress_network_with_nonoverlapping_networks_specified() {

// Create the expected update.
let status = EgressNetworkStatus {
conditions: vec![accepted()],
conditions: vec![accepted(None)],
};
let patch = crate::index::make_patch(&id, status).unwrap();

Expand Down Expand Up @@ -160,6 +160,7 @@ fn egress_network_with_overlapping_networks_specified() {
metadata: k8s_core_api::ObjectMeta {
name: Some(id.gkn.name.to_string()),
namespace: Some(id.namespace.clone()),
generation: Some(3),
..Default::default()
},
spec: linkerd_k8s_api::EgressNetworkSpec {
Expand All @@ -180,7 +181,7 @@ fn egress_network_with_overlapping_networks_specified() {

// Create the expected update.
let status = EgressNetworkStatus {
conditions: vec![in_cluster_net_overlap()],
conditions: vec![in_cluster_net_overlap(egress_network.metadata.generation)],
};
let patch = crate::index::make_patch(&id, status).unwrap();
let update = updates_rx.try_recv().unwrap();
Expand Down
8 changes: 4 additions & 4 deletions policy-controller/k8s/status/src/tests/ratelimit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn ratelimit_accepted() {
index.write().apply(ratelimit);

let expected_status = linkerd_k8s_api::HttpLocalRateLimitPolicyStatus {
conditions: vec![accepted()],
conditions: vec![accepted(None)],
target_ref: linkerd_k8s_api::LocalTargetRef {
group: Some("policy.linkerd.io".to_string()),
kind: "Server".to_string(),
Expand Down Expand Up @@ -74,7 +74,7 @@ fn ratelimit_not_accepted_no_matching_target() {
index.write().apply(ratelimit);

let expected_status = linkerd_k8s_api::HttpLocalRateLimitPolicyStatus {
conditions: vec![no_matching_target()],
conditions: vec![no_matching_target(None)],
target_ref: linkerd_k8s_api::LocalTargetRef {
group: Some("policy.linkerd.io".to_string()),
kind: "Server".to_string(),
Expand Down Expand Up @@ -110,7 +110,7 @@ fn ratelimit_not_accepted_already_exists() {
index.write().apply(rl_1);

let expected_status = linkerd_k8s_api::HttpLocalRateLimitPolicyStatus {
conditions: vec![accepted()],
conditions: vec![accepted(None)],
target_ref: linkerd_k8s_api::LocalTargetRef {
group: Some("policy.linkerd.io".to_string()),
kind: "Server".to_string(),
Expand All @@ -130,7 +130,7 @@ fn ratelimit_not_accepted_already_exists() {
index.write().apply(rl_2);

let expected_status = linkerd_k8s_api::HttpLocalRateLimitPolicyStatus {
conditions: vec![ratelimit_already_exists()],
conditions: vec![ratelimit_already_exists(None)],
target_ref: linkerd_k8s_api::LocalTargetRef {
group: Some("policy.linkerd.io".to_string()),
kind: "Server".to_string(),
Expand Down
Loading
Loading