From a77220b1b522a4cbfe9b1e7428b7b27fbe25286a Mon Sep 17 00:00:00 2001 From: Takumi Sue <23391543+mikutas@users.noreply.github.com> Date: Thu, 7 Sep 2023 21:28:33 +0900 Subject: [PATCH] Update apiVersions of webhook rule (#11149) HTTPRoute resources are sent to the validator regardless of their version (v1beta2, v1beta3) due to the match policy of the resource (resource is sent for any version of the API being served). However, it is good practice to consider all versions explicitly in the webhook rule. This change adds a wildcard operator to consider any HTTPRoute version for admission. Signed-off-by: Takumi Sue --- charts/linkerd-control-plane/templates/destination-rbac.yaml | 2 +- cli/cmd/testdata/install_controlplane_tracing_output.golden | 2 +- cli/cmd/testdata/install_custom_domain.golden | 2 +- cli/cmd/testdata/install_custom_registry.golden | 2 +- cli/cmd/testdata/install_default.golden | 2 +- cli/cmd/testdata/install_default_override_dst_get_nets.golden | 2 +- cli/cmd/testdata/install_default_token.golden | 2 +- cli/cmd/testdata/install_ha_output.golden | 2 +- cli/cmd/testdata/install_ha_with_overrides_output.golden | 2 +- cli/cmd/testdata/install_heartbeat_disabled_output.golden | 2 +- cli/cmd/testdata/install_helm_control_plane_output.golden | 2 +- cli/cmd/testdata/install_helm_control_plane_output_ha.golden | 2 +- cli/cmd/testdata/install_helm_output_ha_labels.golden | 2 +- .../testdata/install_helm_output_ha_namespace_selector.golden | 2 +- cli/cmd/testdata/install_no_init_container.golden | 2 +- cli/cmd/testdata/install_output.golden | 2 +- cli/cmd/testdata/install_proxy_ignores.golden | 2 +- cli/cmd/testdata/install_values_file.golden | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/charts/linkerd-control-plane/templates/destination-rbac.yaml b/charts/linkerd-control-plane/templates/destination-rbac.yaml index 6bbc4731b5745..840be6272a27b 100644 --- a/charts/linkerd-control-plane/templates/destination-rbac.yaml +++ b/charts/linkerd-control-plane/templates/destination-rbac.yaml @@ -171,7 +171,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_controlplane_tracing_output.golden b/cli/cmd/testdata/install_controlplane_tracing_output.golden index 65bdd80ddd3bc..e64900ad6722c 100644 --- a/cli/cmd/testdata/install_controlplane_tracing_output.golden +++ b/cli/cmd/testdata/install_controlplane_tracing_output.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_custom_domain.golden b/cli/cmd/testdata/install_custom_domain.golden index cb250f3d30ffd..8979e757903f4 100644 --- a/cli/cmd/testdata/install_custom_domain.golden +++ b/cli/cmd/testdata/install_custom_domain.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_custom_registry.golden b/cli/cmd/testdata/install_custom_registry.golden index 005676af26c39..0e8c04d51b302 100644 --- a/cli/cmd/testdata/install_custom_registry.golden +++ b/cli/cmd/testdata/install_custom_registry.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_default.golden b/cli/cmd/testdata/install_default.golden index cb250f3d30ffd..8979e757903f4 100644 --- a/cli/cmd/testdata/install_default.golden +++ b/cli/cmd/testdata/install_default.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes 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 0dd29f8743d69..560964755f790 100644 --- a/cli/cmd/testdata/install_default_override_dst_get_nets.golden +++ b/cli/cmd/testdata/install_default_override_dst_get_nets.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_default_token.golden b/cli/cmd/testdata/install_default_token.golden index 7ef6479f2d34d..cc99a748d5e63 100644 --- a/cli/cmd/testdata/install_default_token.golden +++ b/cli/cmd/testdata/install_default_token.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_ha_output.golden b/cli/cmd/testdata/install_ha_output.golden index 5ab6ca9b33f5e..0f6e85269596b 100644 --- a/cli/cmd/testdata/install_ha_output.golden +++ b/cli/cmd/testdata/install_ha_output.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_ha_with_overrides_output.golden b/cli/cmd/testdata/install_ha_with_overrides_output.golden index e1dec0be73bbf..f4b34f8cd2cc1 100644 --- a/cli/cmd/testdata/install_ha_with_overrides_output.golden +++ b/cli/cmd/testdata/install_ha_with_overrides_output.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_heartbeat_disabled_output.golden b/cli/cmd/testdata/install_heartbeat_disabled_output.golden index 56db0da6a1e81..ad1e1c37da569 100644 --- a/cli/cmd/testdata/install_heartbeat_disabled_output.golden +++ b/cli/cmd/testdata/install_heartbeat_disabled_output.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_helm_control_plane_output.golden b/cli/cmd/testdata/install_helm_control_plane_output.golden index 022da068ed1b1..246eab695938b 100644 --- a/cli/cmd/testdata/install_helm_control_plane_output.golden +++ b/cli/cmd/testdata/install_helm_control_plane_output.golden @@ -158,7 +158,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_helm_control_plane_output_ha.golden b/cli/cmd/testdata/install_helm_control_plane_output_ha.golden index 5de329a9812d2..d3d9307fcf170 100644 --- a/cli/cmd/testdata/install_helm_control_plane_output_ha.golden +++ b/cli/cmd/testdata/install_helm_control_plane_output_ha.golden @@ -158,7 +158,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_helm_output_ha_labels.golden b/cli/cmd/testdata/install_helm_output_ha_labels.golden index 4c4970b6fbd92..cb1688b9a745f 100644 --- a/cli/cmd/testdata/install_helm_output_ha_labels.golden +++ b/cli/cmd/testdata/install_helm_output_ha_labels.golden @@ -158,7 +158,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden b/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden index ddf61c4aeb5dc..42da2b22344d1 100644 --- a/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden +++ b/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden @@ -158,7 +158,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_no_init_container.golden b/cli/cmd/testdata/install_no_init_container.golden index a4237060c5dda..df5197f6ea8f7 100644 --- a/cli/cmd/testdata/install_no_init_container.golden +++ b/cli/cmd/testdata/install_no_init_container.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_output.golden b/cli/cmd/testdata/install_output.golden index 1ef4316d98080..b14675bee51ae 100644 --- a/cli/cmd/testdata/install_output.golden +++ b/cli/cmd/testdata/install_output.golden @@ -164,7 +164,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_proxy_ignores.golden b/cli/cmd/testdata/install_proxy_ignores.golden index cb8a886cf4696..27ca3caf2c85d 100644 --- a/cli/cmd/testdata/install_proxy_ignores.golden +++ b/cli/cmd/testdata/install_proxy_ignores.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes diff --git a/cli/cmd/testdata/install_values_file.golden b/cli/cmd/testdata/install_values_file.golden index 53f068aebf89a..6e6ce65b35ed4 100644 --- a/cli/cmd/testdata/install_values_file.golden +++ b/cli/cmd/testdata/install_values_file.golden @@ -167,7 +167,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["policy.linkerd.io"] - apiVersions: ["v1alpha1", "v1beta1"] + apiVersions: ["*"] resources: - authorizationpolicies - httproutes