@@ -669,6 +669,96 @@ func TestWebhookUpdate(t *testing.T) {
669669 },
670670 expectError : false ,
671671 },
672+ {
673+ name : "no change in access config" ,
674+ oldClusterSpec : AWSManagedControlPlaneSpec {
675+ EKSClusterName : "default_cluster1" ,
676+ AccessConfig : & AccessConfig {
677+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
678+ },
679+ },
680+ newClusterSpec : AWSManagedControlPlaneSpec {
681+ EKSClusterName : "default_cluster1" ,
682+ AccessConfig : & AccessConfig {
683+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
684+ },
685+ },
686+ expectError : false ,
687+ },
688+ {
689+ name : "change in access config to nil" ,
690+ oldClusterSpec : AWSManagedControlPlaneSpec {
691+ EKSClusterName : "default_cluster1" ,
692+ AccessConfig : & AccessConfig {
693+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
694+ },
695+ },
696+ newClusterSpec : AWSManagedControlPlaneSpec {
697+ EKSClusterName : "default_cluster1" ,
698+ },
699+ expectError : true ,
700+ },
701+ {
702+ name : "change in access config from nil to valid" ,
703+ oldClusterSpec : AWSManagedControlPlaneSpec {
704+ EKSClusterName : "default_cluster1" ,
705+ },
706+ newClusterSpec : AWSManagedControlPlaneSpec {
707+ EKSClusterName : "default_cluster1" ,
708+ AccessConfig : & AccessConfig {
709+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
710+ },
711+ },
712+ expectError : false ,
713+ },
714+ {
715+ name : "change in access config auth mode from ApiAndConfigMap to API is allowed" ,
716+ oldClusterSpec : AWSManagedControlPlaneSpec {
717+ EKSClusterName : "default_cluster1" ,
718+ AccessConfig : & AccessConfig {
719+ AuthenticationMode : EKSAuthenticationModeApiAndConfigMap ,
720+ },
721+ },
722+ newClusterSpec : AWSManagedControlPlaneSpec {
723+ EKSClusterName : "default_cluster1" ,
724+ AccessConfig : & AccessConfig {
725+ AuthenticationMode : EKSAuthenticationModeApi ,
726+ },
727+ },
728+ expectError : false ,
729+ },
730+ {
731+ name : "change in access config auth mode from API to Config Map is denied" ,
732+ oldClusterSpec : AWSManagedControlPlaneSpec {
733+ EKSClusterName : "default_cluster1" ,
734+ AccessConfig : & AccessConfig {
735+ AuthenticationMode : EKSAuthenticationModeApi ,
736+ },
737+ },
738+ newClusterSpec : AWSManagedControlPlaneSpec {
739+ EKSClusterName : "default_cluster1" ,
740+ AccessConfig : & AccessConfig {
741+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
742+ },
743+ },
744+ expectError : true ,
745+ },
746+ {
747+ name : "change in access config auth mode from APIAndConfigMap to Config Map is denied" ,
748+ oldClusterSpec : AWSManagedControlPlaneSpec {
749+ EKSClusterName : "default_cluster1" ,
750+ AccessConfig : & AccessConfig {
751+ AuthenticationMode : EKSAuthenticationModeApiAndConfigMap ,
752+ },
753+ },
754+ newClusterSpec : AWSManagedControlPlaneSpec {
755+ EKSClusterName : "default_cluster1" ,
756+ AccessConfig : & AccessConfig {
757+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
758+ },
759+ },
760+ expectError : true ,
761+ },
672762 {
673763 name : "change in encryption config to nil" ,
674764 oldClusterSpec : AWSManagedControlPlaneSpec {
0 commit comments