@@ -1014,58 +1014,6 @@ def get_enable_pod_identity_with_kubenet(self) -> bool:
10141014 """
10151015 return self ._get_enable_pod_identity_with_kubenet (enable_validation = True )
10161016
1017- def get_workload_identity_profile (self ) -> Optional [ManagedClusterSecurityProfileWorkloadIdentity ]:
1018- """Obtrain the value of security_profile.workload_identity.
1019-
1020- :return: Optional[ManagedClusterSecurityProfileWorkloadIdentity]
1021- """
1022- # NOTE: enable_workload_identity can be one of:
1023- #
1024- # - True: sets by user, to enable the workload identity feature
1025- # - False: sets by user, to disable the workload identity feature
1026- # - None: user unspecified, don't set the profile and let server side to backfill
1027- enable_workload_identity = self .raw_param .get ("enable_workload_identity" )
1028- disable_workload_identity = self .raw_param .get ("disable_workload_identity" )
1029-
1030- if not enable_workload_identity and not disable_workload_identity :
1031- return None
1032-
1033- if enable_workload_identity and disable_workload_identity :
1034- raise MutuallyExclusiveArgumentError (
1035- "Cannot specify --enable-workload-identity and "
1036- "--disable-workload-identity at the same time."
1037- )
1038-
1039- if not hasattr (self .models , "ManagedClusterSecurityProfileWorkloadIdentity" ):
1040- raise UnknownError ("Workload Identity's data model not found" )
1041-
1042- profile = self .models .ManagedClusterSecurityProfileWorkloadIdentity ()
1043-
1044- if self .decorator_mode == DecoratorMode .UPDATE :
1045- if self .mc .security_profile is not None and self .mc .security_profile .workload_identity is not None :
1046- # reuse previous profile is has been set
1047- profile = self .mc .security_profile .workload_identity
1048-
1049- profile .enabled = bool (enable_workload_identity )
1050-
1051- if profile .enabled :
1052- # in enable case, we need to check if OIDC issuer has been enabled
1053- oidc_issuer_profile = self .get_oidc_issuer_profile ()
1054- if self .decorator_mode == DecoratorMode .UPDATE and oidc_issuer_profile is None :
1055- # if the cluster has enabled OIDC issuer before, in update call:
1056- #
1057- # az aks update --enable-workload-identity
1058- #
1059- # we need to use previous OIDC issuer profile
1060- oidc_issuer_profile = self .mc .oidc_issuer_profile
1061- oidc_issuer_enabled = oidc_issuer_profile is not None and oidc_issuer_profile .enabled
1062- if not oidc_issuer_enabled :
1063- raise RequiredArgumentMissingError (
1064- "Enabling workload identity requires enabling OIDC issuer (--enable-oidc-issuer)."
1065- )
1066-
1067- return profile
1068-
10691017 def get_enable_image_integrity (self ) -> bool :
10701018 """Obtain the value of enable_image_integrity.
10711019
@@ -2684,21 +2632,6 @@ def set_up_pod_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
26842632 mc .pod_identity_profile = pod_identity_profile
26852633 return mc
26862634
2687- def set_up_workload_identity_profile (self , mc : ManagedCluster ) -> ManagedCluster :
2688- """Set up workload identity for the ManagedCluster object.
2689-
2690- :return: the ManagedCluster object
2691- """
2692- self ._ensure_mc (mc )
2693-
2694- profile = self .context .get_workload_identity_profile ()
2695- if profile :
2696- if mc .security_profile is None :
2697- mc .security_profile = self .models .ManagedClusterSecurityProfile ()
2698- mc .security_profile .workload_identity = profile
2699-
2700- return mc
2701-
27022635 def set_up_image_integrity (self , mc : ManagedCluster ) -> ManagedCluster :
27032636 """Set up security profile imageIntegrity for the ManagedCluster object.
27042637
@@ -3697,26 +3630,6 @@ def update_pod_identity_profile(self, mc: ManagedCluster) -> ManagedCluster:
36973630 mc , enable = False , models = self .models .pod_identity_models )
36983631 return mc
36993632
3700- def update_workload_identity_profile (self , mc : ManagedCluster ) -> ManagedCluster :
3701- """Update workload identity profile for the ManagedCluster object.
3702-
3703- :return: the ManagedCluster object
3704- """
3705- self ._ensure_mc (mc )
3706-
3707- profile = self .context .get_workload_identity_profile ()
3708- if profile is None :
3709- if mc .security_profile is not None :
3710- # set the value to None to let server side to fill in the default value
3711- mc .security_profile .workload_identity = None
3712- return mc
3713-
3714- if mc .security_profile is None :
3715- mc .security_profile = self .models .ManagedClusterSecurityProfile ()
3716- mc .security_profile .workload_identity = profile
3717-
3718- return mc
3719-
37203633 def update_k8s_support_plan (self , mc : ManagedCluster ) -> ManagedCluster :
37213634 """Update supportPlan for the ManagedCluster object.
37223635 :return: the ManagedCluster object
0 commit comments