Repository: linkerd/linkerd2
Pull request #7944 (2022-02-23 03:21:06)

build(deps): bump getrandom from 0.2.4 to 0.2.5
Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.2.4 to 0.2.5.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md">getrandom's changelog</a>.</em></p>
<blockquote>
<h2>[0.2.5] - 2022-02-22</h2>
<h3>Added</h3>
<ul>
<li>ESP-IDF targets (<code>*‑espidf</code>) support <a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/245">#245</a></li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Webpack warning caused by dynamic require <a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/234">#234</a></li>
<li>Error checking on iOS for <code>SecRandomCopyBytes</code> <a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/244">#244</a></li>
</ul>
<p><a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/234">#234</a>: <a href="https://github-redirect.dependabot.com/rust-random/getrandom/pull/234">rust-random/getrandom#234</a>
<a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/244">#244</a>: <a href="https://github-redirect.dependabot.com/rust-random/getrandom/pull/244">rust-random/getrandom#244</a>
<a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/245">#245</a>: <a href="https://github-redirect.dependabot.com/rust-random/getrandom/pull/245">rust-random/getrandom#245</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rust-random/getrandom/commit/cd3a987b9b2070925f49aaffdf709fa6fbf276ab"><code>cd3a987</code></a> Release v0.2.5 (<a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/247">#247</a>)</li>
<li><a href="https://github.com/rust-random/getrandom/commit/cf02327ac9d93ef46435c86214abd708c540f7d8"><code>cf02327</code></a> Enable support for espidf (esp32 family of microcontrollers) (<a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/245">#245</a>)</li>
<li><a href="https://github.com/rust-random/getrandom/commit/e1a9c9e74068d29bb4158d7282e398591da69811"><code>e1a9c9e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/246">#246</a> from rust-random/cross_fix</li>
<li><a href="https://github.com/rust-random/getrandom/commit/f49f083412457057ad18e2bbb79306f00801d8cf"><code>f49f083</code></a> fix cross tests</li>
<li><a href="https://github.com/rust-random/getrandom/commit/21e03e8056cf60881e62184e68c38ad5b1c250a0"><code>21e03e8</code></a> ios: Fix Error checking for SecRandomCopyBytes (<a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/244">#244</a>)</li>
<li><a href="https://github.com/rust-random/getrandom/commit/e6e7dd604899cb075f99aa7f8e9f6fef6a17098f"><code>e6e7dd6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/rust-random/getrandom/issues/234">#234</a> from mjhanninen/fix-webpack-dynamic-require-error</li>
<li><a href="https://github.com/rust-random/getrandom/commit/8fad7c5ab4014ac755e6f95fb2bdeef0f674faa2"><code>8fad7c5</code></a> js: Add comment explaining why we do this hack</li>
<li><a href="https://github.com/rust-random/getrandom/commit/8372c165afcda48aade40750943eefcf12a483f6"><code>8372c16</code></a> Fix Webpack warning caused by dynamic require</li>
<li>See full diff in <a href="https://github.com/rust-random/getrandom/compare/v0.2.4...v0.2.5">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=getrandom&package-manager=cargo&previous-version=0.2.4&new-version=0.2.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index bd3f022e9..f1711703c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -401,9 +401,9 @@ dependencies = [
 
 [[package]]
 name = "getrandom"
-version = "0.2.4"
+version = "0.2.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
+checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
 dependencies = [
  "cfg-if",
  "libc",
diff --git a/charts/linkerd-crds/templates/policy/server.yaml b/charts/linkerd-crds/templates/policy/server.yaml
index ba8530f74..d9fb155f6 100644
--- a/charts/linkerd-crds/templates/policy/server.yaml
+++ b/charts/linkerd-crds/templates/policy/server.yaml
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/controller/gen/apis/server/v1beta1/types.go b/controller/gen/apis/server/v1beta1/types.go
index 099fa929c..5b5211deb 100644
--- a/controller/gen/apis/server/v1beta1/types.go
+++ b/controller/gen/apis/server/v1beta1/types.go
@@ -29,7 +29,7 @@ type Server struct {
 
 // ServerSpec specifies a Server resource.
 type ServerSpec struct {
-	PodSelector   *metav1.LabelSelector `json:"podSelector,omitempty"`
+	PodSelector   *metav1.LabelSelector `json:"podSelector"`
 	Port          intstr.IntOrString    `json:"port,omitempty"`
 	ProxyProtocol string                `json:"proxyProtocol,omitempty"`
 }
diff --git a/policy-controller/k8s/api/src/labels.rs b/policy-controller/k8s/api/src/labels.rs
index cfdd17321..3c5bbb433 100644
--- a/policy-controller/k8s/api/src/labels.rs
+++ b/policy-controller/k8s/api/src/labels.rs
@@ -27,7 +27,8 @@ pub enum Operator {
     DoesNotExist,
 }
 
-/// Selects a set of pods that expose a server.
+/// Selects a set of pods that expose a server. The result of `match_labels` and
+/// `match_expressions` are ANDed.
 #[derive(Clone, Debug, Eq, PartialEq, Default, Deserialize, Serialize, JsonSchema)]
 #[serde(rename_all = "camelCase")]
 pub struct Selector {
@@ -38,14 +39,22 @@ pub struct Selector {
 // === Selector ===
 
 impl Selector {
-    pub fn from_expressions(exprs: Expressions) -> Self {
+    #[cfg(test)]
+    fn new(labels: Map, exprs: Expressions) -> Self {
+        Self {
+            match_labels: Some(labels),
+            match_expressions: Some(exprs),
+        }
+    }
+
+    fn from_expressions(exprs: Expressions) -> Self {
         Self {
             match_labels: None,
             match_expressions: Some(exprs),
         }
     }
 
-    pub fn from_map(map: Map) -> Self {
+    fn from_map(map: Map) -> Self {
         Self {
             match_labels: Some(map),
             match_expressions: None,
@@ -201,6 +210,32 @@ mod tests {
                 true,
                 "expression match",
             ),
+            (
+                Selector::new(
+                    Map::from([("foo".to_string(), "bar".to_string())]),
+                    vec![Expression {
+                        key: "bah".into(),
+                        operator: Operator::In,
+                        values: Some(Some("bar".to_string()).into_iter().collect()),
+                    }],
+                ),
+                Labels::from_iter(vec![("foo", "bar"), ("bah", "baz")]),
+                false,
+                "matches labels but not expressions",
+            ),
+            (
+                Selector::new(
+                    Map::from([("foo".to_string(), "bar".to_string())]),
+                    vec![Expression {
+                        key: "bah".into(),
+                        operator: Operator::In,
+                        values: Some(Some("bar".to_string()).into_iter().collect()),
+                    }],
+                ),
+                Labels::from_iter(vec![("foo", "bar"), ("bah", "bar")]),
+                true,
+                "matches both labels and expressions",
+            ),
         ] {
             assert_eq!(selector.matches(labels), *matches, "{}", msg);
         }


Test patch:
diff --git a/cli/cmd/testdata/install_controlplane_tracing_output.golden b/cli/cmd/testdata/install_controlplane_tracing_output.golden
index 8e0409c21..fa5e09083 100644
--- a/cli/cmd/testdata/install_controlplane_tracing_output.golden
+++ b/cli/cmd/testdata/install_controlplane_tracing_output.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_custom_domain.golden b/cli/cmd/testdata/install_custom_domain.golden
index 8bc44caef..378cc2d95 100644
--- a/cli/cmd/testdata/install_custom_domain.golden
+++ b/cli/cmd/testdata/install_custom_domain.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_custom_registry.golden b/cli/cmd/testdata/install_custom_registry.golden
index 8e431d0ef..785183255 100644
--- a/cli/cmd/testdata/install_custom_registry.golden
+++ b/cli/cmd/testdata/install_custom_registry.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_default.golden b/cli/cmd/testdata/install_default.golden
index 8bc44caef..378cc2d95 100644
--- a/cli/cmd/testdata/install_default.golden
+++ b/cli/cmd/testdata/install_default.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_default_override_dst_get_nets.golden b/cli/cmd/testdata/install_default_override_dst_get_nets.golden
index e992de988..c7cd89d51 100644
--- a/cli/cmd/testdata/install_default_override_dst_get_nets.golden
+++ b/cli/cmd/testdata/install_default_override_dst_get_nets.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_default_token.golden b/cli/cmd/testdata/install_default_token.golden
index 24639c539..91ee17444 100644
--- a/cli/cmd/testdata/install_default_token.golden
+++ b/cli/cmd/testdata/install_default_token.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_ha_output.golden b/cli/cmd/testdata/install_ha_output.golden
index a82a5f56a..f6d1d1254 100644
--- a/cli/cmd/testdata/install_ha_output.golden
+++ b/cli/cmd/testdata/install_ha_output.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_ha_with_overrides_output.golden b/cli/cmd/testdata/install_ha_with_overrides_output.golden
index 2ff1506d9..489edcf46 100644
--- a/cli/cmd/testdata/install_ha_with_overrides_output.golden
+++ b/cli/cmd/testdata/install_ha_with_overrides_output.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_heartbeat_disabled_output.golden b/cli/cmd/testdata/install_heartbeat_disabled_output.golden
index f20376f76..fe7526249 100644
--- a/cli/cmd/testdata/install_heartbeat_disabled_output.golden
+++ b/cli/cmd/testdata/install_heartbeat_disabled_output.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_helm_crds_output.golden b/cli/cmd/testdata/install_helm_crds_output.golden
index aea4795f0..986154154 100644
--- a/cli/cmd/testdata/install_helm_crds_output.golden
+++ b/cli/cmd/testdata/install_helm_crds_output.golden
@@ -97,9 +97,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_helm_crds_output_ha.golden b/cli/cmd/testdata/install_helm_crds_output_ha.golden
index aea4795f0..986154154 100644
--- a/cli/cmd/testdata/install_helm_crds_output_ha.golden
+++ b/cli/cmd/testdata/install_helm_crds_output_ha.golden
@@ -97,9 +97,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_no_init_container.golden b/cli/cmd/testdata/install_no_init_container.golden
index 8c61af4e0..3cedeadf8 100644
--- a/cli/cmd/testdata/install_no_init_container.golden
+++ b/cli/cmd/testdata/install_no_init_container.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_output.golden b/cli/cmd/testdata/install_output.golden
index 4c6749ec8..3037eb2b7 100644
--- a/cli/cmd/testdata/install_output.golden
+++ b/cli/cmd/testdata/install_output.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_proxy_ignores.golden b/cli/cmd/testdata/install_proxy_ignores.golden
index e3c65b3f2..5e50687d1 100644
--- a/cli/cmd/testdata/install_proxy_ignores.golden
+++ b/cli/cmd/testdata/install_proxy_ignores.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object
diff --git a/cli/cmd/testdata/install_values_file.golden b/cli/cmd/testdata/install_values_file.golden
index bc04879c6..2e30c0d2c 100644
--- a/cli/cmd/testdata/install_values_file.golden
+++ b/cli/cmd/testdata/install_values_file.golden
@@ -95,9 +95,9 @@ spec:
                   type: object
                   description: >-
                     Selects pods in the same namespace.
-                  oneOf:
-                    - required: [matchExpressions]
-                    - required: [matchLabels]
+
+                    The result of matchLabels and matchExpressions are ANDed.
+                    Selects all if empty.
                   properties:
                     matchLabels:
                       type: object