@@ -603,6 +603,96 @@ func TestWebhookUpdate(t *testing.T) {
603
603
},
604
604
expectError : false ,
605
605
},
606
+ {
607
+ name : "no change in access config" ,
608
+ oldClusterSpec : AWSManagedControlPlaneSpec {
609
+ EKSClusterName : "default_cluster1" ,
610
+ AccessConfig : & AccessConfig {
611
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
612
+ },
613
+ },
614
+ newClusterSpec : AWSManagedControlPlaneSpec {
615
+ EKSClusterName : "default_cluster1" ,
616
+ AccessConfig : & AccessConfig {
617
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
618
+ },
619
+ },
620
+ expectError : false ,
621
+ },
622
+ {
623
+ name : "change in access config to nil" ,
624
+ oldClusterSpec : AWSManagedControlPlaneSpec {
625
+ EKSClusterName : "default_cluster1" ,
626
+ AccessConfig : & AccessConfig {
627
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
628
+ },
629
+ },
630
+ newClusterSpec : AWSManagedControlPlaneSpec {
631
+ EKSClusterName : "default_cluster1" ,
632
+ },
633
+ expectError : true ,
634
+ },
635
+ {
636
+ name : "change in access config from nil to valid" ,
637
+ oldClusterSpec : AWSManagedControlPlaneSpec {
638
+ EKSClusterName : "default_cluster1" ,
639
+ },
640
+ newClusterSpec : AWSManagedControlPlaneSpec {
641
+ EKSClusterName : "default_cluster1" ,
642
+ AccessConfig : & AccessConfig {
643
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
644
+ },
645
+ },
646
+ expectError : false ,
647
+ },
648
+ {
649
+ name : "change in access config auth mode from ApiAndConfigMap to API is allowed" ,
650
+ oldClusterSpec : AWSManagedControlPlaneSpec {
651
+ EKSClusterName : "default_cluster1" ,
652
+ AccessConfig : & AccessConfig {
653
+ AuthenticationMode : EKSAuthenticationModeApiAndConfigMap ,
654
+ },
655
+ },
656
+ newClusterSpec : AWSManagedControlPlaneSpec {
657
+ EKSClusterName : "default_cluster1" ,
658
+ AccessConfig : & AccessConfig {
659
+ AuthenticationMode : EKSAuthenticationModeApi ,
660
+ },
661
+ },
662
+ expectError : false ,
663
+ },
664
+ {
665
+ name : "change in access config auth mode from API to Config Map is denied" ,
666
+ oldClusterSpec : AWSManagedControlPlaneSpec {
667
+ EKSClusterName : "default_cluster1" ,
668
+ AccessConfig : & AccessConfig {
669
+ AuthenticationMode : EKSAuthenticationModeApi ,
670
+ },
671
+ },
672
+ newClusterSpec : AWSManagedControlPlaneSpec {
673
+ EKSClusterName : "default_cluster1" ,
674
+ AccessConfig : & AccessConfig {
675
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
676
+ },
677
+ },
678
+ expectError : true ,
679
+ },
680
+ {
681
+ name : "change in access config auth mode from APIAndConfigMap to Config Map is denied" ,
682
+ oldClusterSpec : AWSManagedControlPlaneSpec {
683
+ EKSClusterName : "default_cluster1" ,
684
+ AccessConfig : & AccessConfig {
685
+ AuthenticationMode : EKSAuthenticationModeApiAndConfigMap ,
686
+ },
687
+ },
688
+ newClusterSpec : AWSManagedControlPlaneSpec {
689
+ EKSClusterName : "default_cluster1" ,
690
+ AccessConfig : & AccessConfig {
691
+ AuthenticationMode : EKSAuthenticationModeConfigMap ,
692
+ },
693
+ },
694
+ expectError : true ,
695
+ },
606
696
{
607
697
name : "change in encryption config to nil" ,
608
698
oldClusterSpec : AWSManagedControlPlaneSpec {
0 commit comments