Skip to content

Commit 4df736f

Browse files
authored
[AKS] Remove --enable-pod-security-policy and --disable-pod-security-policy as it's deprecated (#8720)
1 parent c8773d6 commit 4df736f

File tree

8 files changed

+5
-314
lines changed

8 files changed

+5
-314
lines changed

linter_exclusions.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ aks create:
3737
node_public_ip_prefix_id:
3838
rule_exclusions:
3939
- option_length_too_long
40-
enable_pod_security_policy:
41-
rule_exclusions:
42-
- option_length_too_long
4340
enable_private_cluster:
4441
rule_exclusions:
4542
- option_length_too_long
@@ -135,12 +132,6 @@ aks update:
135132
cluster_autoscaler_profile:
136133
rule_exclusions:
137134
- option_length_too_long
138-
disable_pod_security_policy:
139-
rule_exclusions:
140-
- option_length_too_long
141-
enable_pod_security_policy:
142-
rule_exclusions:
143-
- option_length_too_long
144135
load_balancer_idle_timeout:
145136
rule_exclusions:
146137
- option_length_too_long

src/aks-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
18.0.0b1
16+
+++++++
17+
* [BREAKING CHANGE] Remove `--enable-pod-security-policy` and `--disable-pod-security-policy` as it's deprecated.
18+
1519
17.0.0b4
1620
++++++++
1721
* Reset vm_size and count to None for `az aks update --migrate-vmas-to-vms`

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,6 @@
304304
- name: --vm-set-type
305305
type: string
306306
short-summary: Agent pool vm set type. VirtualMachineScaleSets, AvailabilitySet or VirtualMachines(Preview).
307-
- name: --enable-pod-security-policy
308-
type: bool
309-
short-summary: Enable pod security policy.
310-
long-summary: --enable-pod-security-policy is deprecated. See https://aka.ms/aks/psp for details.
311307
- name: --node-resource-group
312308
type: string
313309
short-summary: The node resource group is the resource group where all customer's resources will be created in, such as virtual machines.
@@ -864,14 +860,6 @@
864860
type: string
865861
short-summary: How outbound traffic will be configured for a cluster.
866862
long-summary: This option will change the way how the outbound connections are managed in the AKS cluster. Available options are loadbalancer, managedNATGateway, userAssignedNATGateway, userDefinedRouting, none and block. For custom vnet, loadbalancer, userAssignedNATGateway and userDefinedRouting are supported. For aks managed vnet, loadbalancer, managedNATGateway and userDefinedRouting are supported.
867-
- name: --enable-pod-security-policy
868-
type: bool
869-
short-summary: Enable pod security policy.
870-
long-summary: --enable-pod-security-policy is deprecated. See https://aka.ms/aks/psp for details.
871-
- name: --disable-pod-security-policy
872-
type: bool
873-
short-summary: Disable pod security policy
874-
long-summary: PodSecurityPolicy is deprecated. See https://aka.ms/aks/psp for details.
875863
- name: --nrg-lockdown-restriction-level
876864
type: string
877865
short-summary: Restriction level on the managed node resource.
@@ -1279,8 +1267,6 @@
12791267
text: az aks update --disable-cluster-autoscaler -g MyResourceGroup -n MyManagedCluster
12801268
- name: Update min-count or max-count for cluster autoscaler.
12811269
text: az aks update --update-cluster-autoscaler --min-count 1 --max-count 10 -g MyResourceGroup -n MyManagedCluster
1282-
- name: Disable pod security policy.
1283-
text: az aks update --disable-pod-security-policy -g MyResourceGroup -n MyManagedCluster
12841270
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
12851271
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
12861272
- name: Update a kubernetes cluster with standard SKU load balancer to use the provided public IPs for the load balancer outbound connection usage.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -767,13 +767,6 @@ def load_arguments(self, _):
767767
c.argument("pod_cidrs")
768768
c.argument("service_cidrs")
769769
c.argument("load_balancer_managed_outbound_ipv6_count", type=int)
770-
c.argument(
771-
"enable_pod_security_policy",
772-
action="store_true",
773-
deprecate_info=c.deprecate(
774-
target="--enable-pod-security-policy", hide=True
775-
),
776-
)
777770
c.argument("enable_pod_identity", action="store_true")
778771
c.argument("enable_pod_identity_with_kubenet", action="store_true")
779772
c.argument("enable_workload_identity", action="store_true")
@@ -1196,14 +1189,6 @@ def load_arguments(self, _):
11961189
)
11971190
c.argument("load_balancer_managed_outbound_ipv6_count", type=int)
11981191
c.argument("outbound_type", arg_type=get_enum_type(outbound_types))
1199-
c.argument(
1200-
"enable_pod_security_policy",
1201-
action="store_true",
1202-
deprecate_info=c.deprecate(
1203-
target="--enable-pod-security-policy", hide=True
1204-
),
1205-
)
1206-
c.argument("disable_pod_security_policy", action="store_true", is_preview=True)
12071192
c.argument("enable_pod_identity", action="store_true")
12081193
c.argument("enable_pod_identity_with_kubenet", action="store_true")
12091194
c.argument("disable_pod_identity", action="store_true")

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ def aks_create(
478478
pod_cidrs=None,
479479
service_cidrs=None,
480480
load_balancer_managed_outbound_ipv6_count=None,
481-
enable_pod_security_policy=False,
482481
enable_pod_identity=False,
483482
enable_pod_identity_with_kubenet=False,
484483
enable_workload_identity=False,
@@ -686,8 +685,6 @@ def aks_update(
686685
network_dataplane=None,
687686
ip_families=None,
688687
pod_cidr=None,
689-
enable_pod_security_policy=False,
690-
disable_pod_security_policy=False,
691688
enable_pod_identity=False,
692689
enable_pod_identity_with_kubenet=False,
693690
disable_pod_identity=False,

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -986,76 +986,6 @@ def get_force_upgrade(self) -> Union[bool, None]:
986986
return not disable_force_upgrade
987987
return None
988988

989-
def _get_enable_pod_security_policy(self, enable_validation: bool = False) -> bool:
990-
"""Internal function to obtain the value of enable_pod_security_policy.
991-
992-
This function supports the option of enable_validation. When enabled, if both enable_pod_security_policy and
993-
disable_pod_security_policy are specified, raise a MutuallyExclusiveArgumentError.
994-
995-
:return: bool
996-
"""
997-
# read the original value passed by the command
998-
enable_pod_security_policy = self.raw_param.get("enable_pod_security_policy")
999-
# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
1000-
if self.decorator_mode == DecoratorMode.CREATE:
1001-
if (
1002-
self.mc and
1003-
self.mc.enable_pod_security_policy is not None
1004-
):
1005-
enable_pod_security_policy = self.mc.enable_pod_security_policy
1006-
1007-
# this parameter does not need dynamic completion
1008-
# validation
1009-
if enable_validation:
1010-
if enable_pod_security_policy and self._get_disable_pod_security_policy(enable_validation=False):
1011-
raise MutuallyExclusiveArgumentError(
1012-
"Cannot specify --enable-pod-security-policy and "
1013-
"--disable-pod-security-policy at the same time."
1014-
)
1015-
return enable_pod_security_policy
1016-
1017-
def get_enable_pod_security_policy(self) -> bool:
1018-
"""Obtain the value of enable_pod_security_policy.
1019-
1020-
This function will verify the parameter by default. If both enable_pod_security_policy and
1021-
disable_pod_security_policy are specified, raise a MutuallyExclusiveArgumentError.
1022-
1023-
:return: bool
1024-
"""
1025-
return self._get_enable_pod_security_policy(enable_validation=True)
1026-
1027-
def _get_disable_pod_security_policy(self, enable_validation: bool = False) -> bool:
1028-
"""Internal function to obtain the value of disable_pod_security_policy.
1029-
1030-
This function supports the option of enable_validation. When enabled, if both enable_pod_security_policy and
1031-
disable_pod_security_policy are specified, raise a MutuallyExclusiveArgumentError.
1032-
1033-
:return: bool
1034-
"""
1035-
# read the original value passed by the command
1036-
disable_pod_security_policy = self.raw_param.get("disable_pod_security_policy")
1037-
# We do not support this option in create mode, therefore we do not read the value from `mc`.
1038-
1039-
# this parameter does not need dynamic completion
1040-
# validation
1041-
if enable_validation:
1042-
if disable_pod_security_policy and self._get_enable_pod_security_policy(enable_validation=False):
1043-
raise MutuallyExclusiveArgumentError(
1044-
"Cannot specify --enable-pod-security-policy and "
1045-
"--disable-pod-security-policy at the same time."
1046-
)
1047-
return disable_pod_security_policy
1048-
1049-
def get_disable_pod_security_policy(self) -> bool:
1050-
"""Obtain the value of disable_pod_security_policy.
1051-
1052-
This function will verify the parameter by default. If both enable_pod_security_policy and
1053-
disable_pod_security_policy are specified, raise a MutuallyExclusiveArgumentError.
1054-
1055-
:return: bool
1056-
"""
1057-
return self._get_disable_pod_security_policy(enable_validation=True)
1058-
1059989
# pylint: disable=unused-argument
1060990
def _get_enable_managed_identity(
1061991
self, enable_validation: bool = False, read_only: bool = False
@@ -3082,16 +3012,6 @@ def set_up_addon_profiles(self, mc: ManagedCluster) -> ManagedCluster:
30823012
mc.addon_profiles = addon_profiles
30833013
return mc
30843014

3085-
def set_up_pod_security_policy(self, mc: ManagedCluster) -> ManagedCluster:
3086-
"""Set up pod security policy for the ManagedCluster object.
3087-
3088-
:return: the ManagedCluster object
3089-
"""
3090-
self._ensure_mc(mc)
3091-
3092-
mc.enable_pod_security_policy = self.context.get_enable_pod_security_policy()
3093-
return mc
3094-
30953015
def set_up_pod_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
30963016
"""Set up pod identity profile for the ManagedCluster object.
30973017
@@ -3631,8 +3551,6 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
36313551
# DO NOT MOVE: keep this on top, construct the default ManagedCluster profile
36323552
mc = self.construct_mc_profile_default(bypass_restore_defaults=True)
36333553

3634-
# set up pod security policy
3635-
mc = self.set_up_pod_security_policy(mc)
36363554
# set up pod identity profile
36373555
mc = self.set_up_pod_identity_profile(mc)
36383556
# set up workload identity profile
@@ -4560,20 +4478,6 @@ def update_kube_proxy_config(self, mc: ManagedCluster) -> ManagedCluster:
45604478

45614479
return mc
45624480

4563-
def update_pod_security_policy(self, mc: ManagedCluster) -> ManagedCluster:
4564-
"""Update pod security policy for the ManagedCluster object.
4565-
4566-
:return: the ManagedCluster object
4567-
"""
4568-
self._ensure_mc(mc)
4569-
4570-
if self.context.get_enable_pod_security_policy():
4571-
mc.enable_pod_security_policy = True
4572-
4573-
if self.context.get_disable_pod_security_policy():
4574-
mc.enable_pod_security_policy = False
4575-
return mc
4576-
45774481
def update_pod_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
45784482
"""Update pod identity profile for the ManagedCluster object.
45794483
@@ -5384,8 +5288,6 @@ def update_mc_profile_preview(self) -> ManagedCluster:
53845288
# DO NOT MOVE: keep this on top, fetch and update the default ManagedCluster profile
53855289
mc = self.update_mc_profile_default()
53865290

5387-
# update pod security policy
5388-
mc = self.update_pod_security_policy(mc)
53895291
# update pod identity profile
53905292
mc = self.update_pod_identity_profile(mc)
53915293
# update workload identity profile

0 commit comments

Comments
 (0)