@@ -858,69 +858,6 @@ func TestHostedControlPlane_FullLifecycle(t *testing.T) {
858858 ).Error ().To (Succeed ())
859859 },
860860 },
861- {
862- name : "Verify CoreDNS and Konnectivity Deployments are scaled to 0" ,
863- verifyResources : func (ctx context.Context , g * WithT ) {
864- deploymentInterface := workloadClusterClient .AppsV1 ().Deployments (metav1 .NamespaceSystem )
865- corednsDeployment , err := deploymentInterface .Get (ctx , "coredns" , metav1.GetOptions {})
866- g .Expect (err ).To (Succeed ())
867- g .Expect (corednsDeployment .Spec .Replicas ).To (PointTo (Equal (int32 (0 ))))
868- konnectivityDeployment , err := deploymentInterface .Get (ctx , "konnectivity-agent" , metav1.GetOptions {})
869- g .Expect (err ).To (Succeed ())
870- g .Expect (konnectivityDeployment .Spec .Replicas ).To (PointTo (Equal (int32 (0 ))))
871- },
872- },
873- {
874- name : "Add Node to Cluster" ,
875- simulateExternalSystems : func (ctx context.Context , g * WithT ) {
876- g .Expect (workloadClusterClient .CoreV1 ().Nodes ().Create (ctx , & corev1.Node {
877- ObjectMeta : metav1.ObjectMeta {
878- Name : "node-1" ,
879- },
880- }, metav1.CreateOptions {FieldManager : k8sFieldManager })).Error ().To (Succeed ())
881- },
882- verifyConditionsAfter : map [bool ][]types2.GomegaMatcher {
883- false : {
884- NewConditionVerification (
885- v1alpha1 .WorkloadClusterResourcesReadyCondition ,
886- Equal ("KubeProxyDaemonsetNotReady" ),
887- ),
888- NewConditionVerification (
889- v1alpha1 .WorkloadKubeProxyReadyCondition ,
890- Equal ("KubeProxyDaemonsetNotReady" ),
891- ),
892- },
893- },
894- },
895- {
896- name : "Make Kube Proxy Daemonset Ready" ,
897- simulateExternalSystems : func (ctx context.Context , g * WithT ) {
898- daemonSetInterface := workloadClusterClient .AppsV1 ().DaemonSets (metav1 .NamespaceSystem )
899- daemonSet , err := daemonSetInterface .Get (ctx , "kube-proxy" , metav1.GetOptions {})
900- g .Expect (err ).To (Succeed ())
901- daemonSetApplyConfiguration , err := appsv1ac .ExtractDaemonSet (
902- daemonSet , k8sFieldManager ,
903- )
904- g .Expect (err ).To (Succeed ())
905- g .Expect (daemonSetInterface .ApplyStatus (
906- ctx , daemonSetApplyConfiguration .
907- WithStatus (
908- appsv1ac .DaemonSetStatus ().
909- WithNumberAvailable (1 ).
910- WithNumberReady (1 ).
911- WithUpdatedNumberScheduled (daemonSet .Status .UpdatedNumberScheduled ).
912- WithDesiredNumberScheduled (daemonSet .Status .DesiredNumberScheduled ),
913- ), k8sOptions ,
914- )).Error ().To (Succeed ())
915- },
916- verifyConditionsAfter : map [bool ][]types2.GomegaMatcher {
917- true : {
918- NewConditionVerification (
919- v1alpha1 .WorkloadKubeProxyReadyCondition ,
920- ),
921- },
922- },
923- },
924861 {
925862 name : "Verify CoreDNS Deployment is scaled to 1" ,
926863 verifyResources : func (ctx context.Context , g * WithT ) {
@@ -958,12 +895,12 @@ func TestHostedControlPlane_FullLifecycle(t *testing.T) {
958895 },
959896 },
960897 {
961- name : "Verify Konnectivity Agent Deployment is scaled to 1" ,
898+ name : "Verify Konnectivity Deployment is scaled to 1" ,
962899 verifyResources : func (ctx context.Context , g * WithT ) {
963900 deploymentInterface := workloadClusterClient .AppsV1 ().Deployments (metav1 .NamespaceSystem )
964- konnectivityDeployment , err := deploymentInterface .Get (ctx , "konnectivity-agent" , metav1.GetOptions {})
901+ corednsDeployment , err := deploymentInterface .Get (ctx , "konnectivity-agent" , metav1.GetOptions {})
965902 g .Expect (err ).To (Succeed ())
966- g .Expect (konnectivityDeployment .Spec .Replicas ).To (PointTo (Equal (int32 (1 ))))
903+ g .Expect (corednsDeployment .Spec .Replicas ).To (PointTo (Equal (int32 (1 ))))
967904 },
968905 },
969906 {
@@ -996,6 +933,68 @@ func TestHostedControlPlane_FullLifecycle(t *testing.T) {
996933 },
997934 },
998935 },
936+ {
937+ name : "Add Node to Cluster" ,
938+ simulateExternalSystems : func (ctx context.Context , g * WithT ) {
939+ g .Expect (workloadClusterClient .CoreV1 ().Nodes ().Create (ctx , & corev1.Node {
940+ ObjectMeta : metav1.ObjectMeta {
941+ Name : "node-1" ,
942+ },
943+ }, metav1.CreateOptions {FieldManager : k8sFieldManager })).Error ().To (Succeed ())
944+ },
945+ verifyConditionsAfter : map [bool ][]types2.GomegaMatcher {
946+ false : {
947+ NewConditionVerification (
948+ v1alpha1 .WorkloadClusterResourcesReadyCondition ,
949+ Equal ("KubeProxyDaemonsetNotReady" ),
950+ ),
951+ NewConditionVerification (
952+ v1alpha1 .WorkloadKubeProxyReadyCondition ,
953+ Equal ("KubeProxyDaemonsetNotReady" ),
954+ ),
955+ },
956+ },
957+ },
958+ {
959+ name : "Verify CoreDNS and Konnectivity Agent Deployments are still scaled to 1" ,
960+ verifyResources : func (ctx context.Context , g * WithT ) {
961+ deploymentInterface := workloadClusterClient .AppsV1 ().Deployments (metav1 .NamespaceSystem )
962+ for _ , name := range []string {"coredns" , "konnectivity-agent" } {
963+ deployment , err := deploymentInterface .Get (ctx , name , metav1.GetOptions {})
964+ g .Expect (err ).To (Succeed ())
965+ g .Expect (deployment .Spec .Replicas ).To (PointTo (Equal (int32 (1 ))))
966+ }
967+ },
968+ },
969+ {
970+ name : "Make Kube Proxy Daemonset Ready" ,
971+ simulateExternalSystems : func (ctx context.Context , g * WithT ) {
972+ daemonSetInterface := workloadClusterClient .AppsV1 ().DaemonSets (metav1 .NamespaceSystem )
973+ daemonSet , err := daemonSetInterface .Get (ctx , "kube-proxy" , metav1.GetOptions {})
974+ g .Expect (err ).To (Succeed ())
975+ daemonSetApplyConfiguration , err := appsv1ac .ExtractDaemonSet (
976+ daemonSet , k8sFieldManager ,
977+ )
978+ g .Expect (err ).To (Succeed ())
979+ g .Expect (daemonSetInterface .ApplyStatus (
980+ ctx , daemonSetApplyConfiguration .
981+ WithStatus (
982+ appsv1ac .DaemonSetStatus ().
983+ WithNumberAvailable (1 ).
984+ WithNumberReady (1 ).
985+ WithUpdatedNumberScheduled (daemonSet .Status .UpdatedNumberScheduled ).
986+ WithDesiredNumberScheduled (daemonSet .Status .DesiredNumberScheduled ),
987+ ), k8sOptions ,
988+ )).Error ().To (Succeed ())
989+ },
990+ verifyConditionsAfter : map [bool ][]types2.GomegaMatcher {
991+ true : {
992+ NewConditionVerification (
993+ v1alpha1 .WorkloadKubeProxyReadyCondition ,
994+ ),
995+ },
996+ },
997+ },
999998 {
1000999 name : "Add 3 Nodes to Cluster" ,
10011000 simulateExternalSystems : func (ctx context.Context , g * WithT ) {
0 commit comments