simplify TestValidateControllersOptions test
This commit is contained in:
		@@ -660,24 +660,26 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
		name                   string
 | 
							name                   string
 | 
				
			||||||
		expectErrors           bool
 | 
							expectErrors           bool
 | 
				
			||||||
		expectedErrorSubString string
 | 
							expectedErrorSubString string
 | 
				
			||||||
		validate               func() []error
 | 
							options                interface {
 | 
				
			||||||
 | 
								Validate() []error
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}{
 | 
						}{
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "AttachDetachControllerOptions reconciler sync loop period less than one second",
 | 
								name:                   "AttachDetachControllerOptions reconciler sync loop period less than one second",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "duration time must be greater than one second",
 | 
								expectedErrorSubString: "duration time must be greater than one second",
 | 
				
			||||||
			validate: (&AttachDetachControllerOptions{
 | 
								options: &AttachDetachControllerOptions{
 | 
				
			||||||
				&attachdetachconfig.AttachDetachControllerConfiguration{
 | 
									&attachdetachconfig.AttachDetachControllerConfiguration{
 | 
				
			||||||
					ReconcilerSyncLoopPeriod:          metav1.Duration{Duration: time.Second / 2},
 | 
										ReconcilerSyncLoopPeriod:          metav1.Duration{Duration: time.Second / 2},
 | 
				
			||||||
					DisableAttachDetachReconcilerSync: true,
 | 
										DisableAttachDetachReconcilerSync: true,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeletServingSignerConfiguration no cert file",
 | 
								name:                   "CSRSigningControllerOptions KubeletServingSignerConfiguration no cert file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify key without cert",
 | 
								expectedErrorSubString: "cannot specify key without cert",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -699,13 +701,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeletServingSignerConfiguration no key file",
 | 
								name:                   "CSRSigningControllerOptions KubeletServingSignerConfiguration no key file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify cert without key",
 | 
								expectedErrorSubString: "cannot specify cert without key",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -727,13 +729,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeletClientSignerConfiguration no cert file",
 | 
								name:                   "CSRSigningControllerOptions KubeletClientSignerConfiguration no cert file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify key without cert",
 | 
								expectedErrorSubString: "cannot specify key without cert",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -755,13 +757,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeletClientSignerConfiguration no key file",
 | 
								name:                   "CSRSigningControllerOptions KubeletClientSignerConfiguration no key file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify cert without key",
 | 
								expectedErrorSubString: "cannot specify cert without key",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -783,13 +785,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeAPIServerClientSignerConfiguration no cert file",
 | 
								name:                   "CSRSigningControllerOptions KubeAPIServerClientSignerConfiguration no cert file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify key without cert",
 | 
								expectedErrorSubString: "cannot specify key without cert",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -811,13 +813,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions KubeAPIServerClientSignerConfiguration no key file",
 | 
								name:                   "CSRSigningControllerOptions KubeAPIServerClientSignerConfiguration no key file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify cert without key",
 | 
								expectedErrorSubString: "cannot specify cert without key",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -839,13 +841,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions LegacyUnknownSignerConfiguration no cert file",
 | 
								name:                   "CSRSigningControllerOptions LegacyUnknownSignerConfiguration no cert file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify key without cert",
 | 
								expectedErrorSubString: "cannot specify key without cert",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -867,13 +869,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
											KeyFile:  "/cluster-signing-legacy-unknown/key-file",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions LegacyUnknownSignerConfiguration no key file",
 | 
								name:                   "CSRSigningControllerOptions LegacyUnknownSignerConfiguration no key file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify cert without key",
 | 
								expectedErrorSubString: "cannot specify cert without key",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "",
 | 
										ClusterSigningCertFile: "",
 | 
				
			||||||
					ClusterSigningKeyFile:  "",
 | 
										ClusterSigningKeyFile:  "",
 | 
				
			||||||
@@ -895,13 +897,13 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "",
 | 
											KeyFile:  "",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CSRSigningControllerOptions specific file set along with cluster single signing file",
 | 
								name:                   "CSRSigningControllerOptions specific file set along with cluster single signing file",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "cannot specify --cluster-signing-{cert,key}-file and other --cluster-signing-*-file flags at the same time",
 | 
								expectedErrorSubString: "cannot specify --cluster-signing-{cert,key}-file and other --cluster-signing-*-file flags at the same time",
 | 
				
			||||||
			validate: (&CSRSigningControllerOptions{
 | 
								options: &CSRSigningControllerOptions{
 | 
				
			||||||
				&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
									&csrsigningconfig.CSRSigningControllerConfiguration{
 | 
				
			||||||
					ClusterSigningCertFile: "/cluster-signing-cert-file",
 | 
										ClusterSigningCertFile: "/cluster-signing-cert-file",
 | 
				
			||||||
					ClusterSigningKeyFile:  "/cluster-signing-key-file",
 | 
										ClusterSigningKeyFile:  "/cluster-signing-key-file",
 | 
				
			||||||
@@ -923,111 +925,111 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
						KeyFile:  "",
 | 
											KeyFile:  "",
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceControllerOptions ConcurrentServiceEndpointSyncs lower than minConcurrentServiceEndpointSyncs (1)",
 | 
								name:                   "EndpointSliceControllerOptions ConcurrentServiceEndpointSyncs lower than minConcurrentServiceEndpointSyncs (1)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-service-endpoint-syncs must not be less than 1",
 | 
								expectedErrorSubString: "concurrent-service-endpoint-syncs must not be less than 1",
 | 
				
			||||||
			validate: (&EndpointSliceControllerOptions{
 | 
								options: &EndpointSliceControllerOptions{
 | 
				
			||||||
				&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
									&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
				
			||||||
					ConcurrentServiceEndpointSyncs: 0,
 | 
										ConcurrentServiceEndpointSyncs: 0,
 | 
				
			||||||
					MaxEndpointsPerSlice:           200,
 | 
										MaxEndpointsPerSlice:           200,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceControllerOptions ConcurrentServiceEndpointSyncs greater than maxConcurrentServiceEndpointSyncs (50)",
 | 
								name:                   "EndpointSliceControllerOptions ConcurrentServiceEndpointSyncs greater than maxConcurrentServiceEndpointSyncs (50)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-service-endpoint-syncs must not be more than 50",
 | 
								expectedErrorSubString: "concurrent-service-endpoint-syncs must not be more than 50",
 | 
				
			||||||
			validate: (&EndpointSliceControllerOptions{
 | 
								options: &EndpointSliceControllerOptions{
 | 
				
			||||||
				&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
									&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
				
			||||||
					ConcurrentServiceEndpointSyncs: 51,
 | 
										ConcurrentServiceEndpointSyncs: 51,
 | 
				
			||||||
					MaxEndpointsPerSlice:           200,
 | 
										MaxEndpointsPerSlice:           200,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceControllerOptions MaxEndpointsPerSlice lower than minMaxEndpointsPerSlice (1)",
 | 
								name:                   "EndpointSliceControllerOptions MaxEndpointsPerSlice lower than minMaxEndpointsPerSlice (1)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "max-endpoints-per-slice must not be less than 1",
 | 
								expectedErrorSubString: "max-endpoints-per-slice must not be less than 1",
 | 
				
			||||||
			validate: (&EndpointSliceControllerOptions{
 | 
								options: &EndpointSliceControllerOptions{
 | 
				
			||||||
				&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
									&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
				
			||||||
					ConcurrentServiceEndpointSyncs: 10,
 | 
										ConcurrentServiceEndpointSyncs: 10,
 | 
				
			||||||
					MaxEndpointsPerSlice:           0,
 | 
										MaxEndpointsPerSlice:           0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceControllerOptions MaxEndpointsPerSlice greater than maxMaxEndpointsPerSlice (1000)",
 | 
								name:                   "EndpointSliceControllerOptions MaxEndpointsPerSlice greater than maxMaxEndpointsPerSlice (1000)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "max-endpoints-per-slice must not be more than 1000",
 | 
								expectedErrorSubString: "max-endpoints-per-slice must not be more than 1000",
 | 
				
			||||||
			validate: (&EndpointSliceControllerOptions{
 | 
								options: &EndpointSliceControllerOptions{
 | 
				
			||||||
				&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
									&endpointsliceconfig.EndpointSliceControllerConfiguration{
 | 
				
			||||||
					ConcurrentServiceEndpointSyncs: 10,
 | 
										ConcurrentServiceEndpointSyncs: 10,
 | 
				
			||||||
					MaxEndpointsPerSlice:           1001,
 | 
										MaxEndpointsPerSlice:           1001,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceMirroringControllerOptions MirroringConcurrentServiceEndpointSyncs lower than mirroringMinConcurrentServiceEndpointSyncs (1)",
 | 
								name:                   "EndpointSliceMirroringControllerOptions MirroringConcurrentServiceEndpointSyncs lower than mirroringMinConcurrentServiceEndpointSyncs (1)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "mirroring-concurrent-service-endpoint-syncs must not be less than 1",
 | 
								expectedErrorSubString: "mirroring-concurrent-service-endpoint-syncs must not be less than 1",
 | 
				
			||||||
			validate: (&EndpointSliceMirroringControllerOptions{
 | 
								options: &EndpointSliceMirroringControllerOptions{
 | 
				
			||||||
				&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
									&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
				
			||||||
					MirroringConcurrentServiceEndpointSyncs: 0,
 | 
										MirroringConcurrentServiceEndpointSyncs: 0,
 | 
				
			||||||
					MirroringMaxEndpointsPerSubset:          100,
 | 
										MirroringMaxEndpointsPerSubset:          100,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceMirroringControllerOptions MirroringConcurrentServiceEndpointSyncs greater than mirroringMaxConcurrentServiceEndpointSyncs (50)",
 | 
								name:                   "EndpointSliceMirroringControllerOptions MirroringConcurrentServiceEndpointSyncs greater than mirroringMaxConcurrentServiceEndpointSyncs (50)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "mirroring-concurrent-service-endpoint-syncs must not be more than 50",
 | 
								expectedErrorSubString: "mirroring-concurrent-service-endpoint-syncs must not be more than 50",
 | 
				
			||||||
			validate: (&EndpointSliceMirroringControllerOptions{
 | 
								options: &EndpointSliceMirroringControllerOptions{
 | 
				
			||||||
				&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
									&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
				
			||||||
					MirroringConcurrentServiceEndpointSyncs: 51,
 | 
										MirroringConcurrentServiceEndpointSyncs: 51,
 | 
				
			||||||
					MirroringMaxEndpointsPerSubset:          100,
 | 
										MirroringMaxEndpointsPerSubset:          100,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceMirroringControllerOptions MirroringMaxEndpointsPerSubset lower than mirroringMinMaxEndpointsPerSubset (1)",
 | 
								name:                   "EndpointSliceMirroringControllerOptions MirroringMaxEndpointsPerSubset lower than mirroringMinMaxEndpointsPerSubset (1)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "mirroring-max-endpoints-per-subset must not be less than 1",
 | 
								expectedErrorSubString: "mirroring-max-endpoints-per-subset must not be less than 1",
 | 
				
			||||||
			validate: (&EndpointSliceMirroringControllerOptions{
 | 
								options: &EndpointSliceMirroringControllerOptions{
 | 
				
			||||||
				&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
									&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
				
			||||||
					MirroringConcurrentServiceEndpointSyncs: 10,
 | 
										MirroringConcurrentServiceEndpointSyncs: 10,
 | 
				
			||||||
					MirroringMaxEndpointsPerSubset:          0,
 | 
										MirroringMaxEndpointsPerSubset:          0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EndpointSliceMirroringControllerOptions MirroringMaxEndpointsPerSubset greater than mirroringMaxMaxEndpointsPerSubset (1000)",
 | 
								name:                   "EndpointSliceMirroringControllerOptions MirroringMaxEndpointsPerSubset greater than mirroringMaxMaxEndpointsPerSubset (1000)",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "mirroring-max-endpoints-per-subset must not be more than 1000",
 | 
								expectedErrorSubString: "mirroring-max-endpoints-per-subset must not be more than 1000",
 | 
				
			||||||
			validate: (&EndpointSliceMirroringControllerOptions{
 | 
								options: &EndpointSliceMirroringControllerOptions{
 | 
				
			||||||
				&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
									&endpointslicemirroringconfig.EndpointSliceMirroringControllerConfiguration{
 | 
				
			||||||
					MirroringConcurrentServiceEndpointSyncs: 10,
 | 
										MirroringConcurrentServiceEndpointSyncs: 10,
 | 
				
			||||||
					MirroringMaxEndpointsPerSubset:          1001,
 | 
										MirroringMaxEndpointsPerSubset:          1001,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "EphemeralVolumeControllerOptions ConcurrentEphemeralVolumeSyncs equal 0",
 | 
								name:                   "EphemeralVolumeControllerOptions ConcurrentEphemeralVolumeSyncs equal 0",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-ephemeralvolume-syncs must be greater than 0",
 | 
								expectedErrorSubString: "concurrent-ephemeralvolume-syncs must be greater than 0",
 | 
				
			||||||
			validate: (&EphemeralVolumeControllerOptions{
 | 
								options: &EphemeralVolumeControllerOptions{
 | 
				
			||||||
				&ephemeralvolumeconfig.EphemeralVolumeControllerConfiguration{
 | 
									&ephemeralvolumeconfig.EphemeralVolumeControllerConfiguration{
 | 
				
			||||||
					ConcurrentEphemeralVolumeSyncs: 0,
 | 
										ConcurrentEphemeralVolumeSyncs: 0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "HPAControllerOptions ConcurrentHorizontalPodAutoscalerSyncs equal 0",
 | 
								name:                   "HPAControllerOptions ConcurrentHorizontalPodAutoscalerSyncs equal 0",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-horizontal-pod-autoscaler-syncs must be greater than 0",
 | 
								expectedErrorSubString: "concurrent-horizontal-pod-autoscaler-syncs must be greater than 0",
 | 
				
			||||||
			validate: (&HPAControllerOptions{
 | 
								options: &HPAControllerOptions{
 | 
				
			||||||
				&poautosclerconfig.HPAControllerConfiguration{
 | 
									&poautosclerconfig.HPAControllerConfiguration{
 | 
				
			||||||
					ConcurrentHorizontalPodAutoscalerSyncs:              0,
 | 
										ConcurrentHorizontalPodAutoscalerSyncs:              0,
 | 
				
			||||||
					HorizontalPodAutoscalerSyncPeriod:                   metav1.Duration{Duration: 45 * time.Second},
 | 
										HorizontalPodAutoscalerSyncPeriod:                   metav1.Duration{Duration: 45 * time.Second},
 | 
				
			||||||
@@ -1038,99 +1040,99 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
					HorizontalPodAutoscalerInitialReadinessDelay:        metav1.Duration{Duration: 50 * time.Second},
 | 
										HorizontalPodAutoscalerInitialReadinessDelay:        metav1.Duration{Duration: 50 * time.Second},
 | 
				
			||||||
					HorizontalPodAutoscalerTolerance:                    0.1,
 | 
										HorizontalPodAutoscalerTolerance:                    0.1,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "NodeIPAMControllerOptions service cluster ip range more than two entries",
 | 
								name:                   "NodeIPAMControllerOptions service cluster ip range more than two entries",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "--service-cluster-ip-range can not contain more than two entries",
 | 
								expectedErrorSubString: "--service-cluster-ip-range can not contain more than two entries",
 | 
				
			||||||
			validate: (&NodeIPAMControllerOptions{
 | 
								options: &NodeIPAMControllerOptions{
 | 
				
			||||||
				&nodeipamconfig.NodeIPAMControllerConfiguration{
 | 
									&nodeipamconfig.NodeIPAMControllerConfiguration{
 | 
				
			||||||
					ServiceCIDR:          "10.0.0.0/16,244.0.0.0/16,3000::/108",
 | 
										ServiceCIDR:          "10.0.0.0/16,244.0.0.0/16,3000::/108",
 | 
				
			||||||
					NodeCIDRMaskSize:     48,
 | 
										NodeCIDRMaskSize:     48,
 | 
				
			||||||
					NodeCIDRMaskSizeIPv4: 48,
 | 
										NodeCIDRMaskSizeIPv4: 48,
 | 
				
			||||||
					NodeCIDRMaskSizeIPv6: 108,
 | 
										NodeCIDRMaskSizeIPv6: 108,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "StatefulSetControllerOptions ConcurrentStatefulSetSyncs equal 0",
 | 
								name:                   "StatefulSetControllerOptions ConcurrentStatefulSetSyncs equal 0",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-statefulset-syncs must be greater than 0",
 | 
								expectedErrorSubString: "concurrent-statefulset-syncs must be greater than 0",
 | 
				
			||||||
			validate: (&StatefulSetControllerOptions{
 | 
								options: &StatefulSetControllerOptions{
 | 
				
			||||||
				&statefulsetconfig.StatefulSetControllerConfiguration{
 | 
									&statefulsetconfig.StatefulSetControllerConfiguration{
 | 
				
			||||||
					ConcurrentStatefulSetSyncs: 0,
 | 
										ConcurrentStatefulSetSyncs: 0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "JobControllerOptions ConcurrentJobSyncs equal 0",
 | 
								name:                   "JobControllerOptions ConcurrentJobSyncs equal 0",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-job-syncs must be greater than 0",
 | 
								expectedErrorSubString: "concurrent-job-syncs must be greater than 0",
 | 
				
			||||||
			validate: (&JobControllerOptions{
 | 
								options: &JobControllerOptions{
 | 
				
			||||||
				&jobconfig.JobControllerConfiguration{
 | 
									&jobconfig.JobControllerConfiguration{
 | 
				
			||||||
					ConcurrentJobSyncs: 0,
 | 
										ConcurrentJobSyncs: 0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:                   "CronJobControllerOptions ConcurrentCronJobSyncs equal 0",
 | 
								name:                   "CronJobControllerOptions ConcurrentCronJobSyncs equal 0",
 | 
				
			||||||
			expectErrors:           true,
 | 
								expectErrors:           true,
 | 
				
			||||||
			expectedErrorSubString: "concurrent-cron-job-syncs must be greater than 0",
 | 
								expectedErrorSubString: "concurrent-cron-job-syncs must be greater than 0",
 | 
				
			||||||
			validate: (&CronJobControllerOptions{
 | 
								options: &CronJobControllerOptions{
 | 
				
			||||||
				&cronjobconfig.CronJobControllerConfiguration{
 | 
									&cronjobconfig.CronJobControllerConfiguration{
 | 
				
			||||||
					ConcurrentCronJobSyncs: 0,
 | 
										ConcurrentCronJobSyncs: 0,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		/* empty errs */
 | 
							/* empty errs */
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "CronJobControllerOptions",
 | 
								name:         "CronJobControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&CronJobControllerOptions{
 | 
								options: &CronJobControllerOptions{
 | 
				
			||||||
				&cronjobconfig.CronJobControllerConfiguration{
 | 
									&cronjobconfig.CronJobControllerConfiguration{
 | 
				
			||||||
					ConcurrentCronJobSyncs: 10,
 | 
										ConcurrentCronJobSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "DaemonSetControllerOptions",
 | 
								name:         "DaemonSetControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&DaemonSetControllerOptions{
 | 
								options: &DaemonSetControllerOptions{
 | 
				
			||||||
				&daemonconfig.DaemonSetControllerConfiguration{
 | 
									&daemonconfig.DaemonSetControllerConfiguration{
 | 
				
			||||||
					ConcurrentDaemonSetSyncs: 2,
 | 
										ConcurrentDaemonSetSyncs: 2,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "DeploymentControllerOptions",
 | 
								name:         "DeploymentControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&DeploymentControllerOptions{
 | 
								options: &DeploymentControllerOptions{
 | 
				
			||||||
				&deploymentconfig.DeploymentControllerConfiguration{
 | 
									&deploymentconfig.DeploymentControllerConfiguration{
 | 
				
			||||||
					ConcurrentDeploymentSyncs: 10,
 | 
										ConcurrentDeploymentSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "DeprecatedControllerOptions",
 | 
								name:         "DeprecatedControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&DeprecatedControllerOptions{
 | 
								options: &DeprecatedControllerOptions{
 | 
				
			||||||
				&kubectrlmgrconfig.DeprecatedControllerConfiguration{},
 | 
									&kubectrlmgrconfig.DeprecatedControllerConfiguration{},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "EndpointControllerOptions",
 | 
								name:         "EndpointControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&EndpointControllerOptions{
 | 
								options: &EndpointControllerOptions{
 | 
				
			||||||
				&endpointconfig.EndpointControllerConfiguration{
 | 
									&endpointconfig.EndpointControllerConfiguration{
 | 
				
			||||||
					ConcurrentEndpointSyncs: 10,
 | 
										ConcurrentEndpointSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "GarbageCollectorControllerOptions",
 | 
								name:         "GarbageCollectorControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&GarbageCollectorControllerOptions{
 | 
								options: &GarbageCollectorControllerOptions{
 | 
				
			||||||
				&garbagecollectorconfig.GarbageCollectorControllerConfiguration{
 | 
									&garbagecollectorconfig.GarbageCollectorControllerConfiguration{
 | 
				
			||||||
					ConcurrentGCSyncs: 30,
 | 
										ConcurrentGCSyncs: 30,
 | 
				
			||||||
					GCIgnoredResources: []garbagecollectorconfig.GroupResource{
 | 
										GCIgnoredResources: []garbagecollectorconfig.GroupResource{
 | 
				
			||||||
@@ -1139,31 +1141,31 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
					},
 | 
										},
 | 
				
			||||||
					EnableGarbageCollector: false,
 | 
										EnableGarbageCollector: false,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "JobControllerOptions",
 | 
								name:         "JobControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&JobControllerOptions{
 | 
								options: &JobControllerOptions{
 | 
				
			||||||
				&jobconfig.JobControllerConfiguration{
 | 
									&jobconfig.JobControllerConfiguration{
 | 
				
			||||||
					ConcurrentJobSyncs: 10,
 | 
										ConcurrentJobSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "NamespaceControllerOptions",
 | 
								name:         "NamespaceControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&NamespaceControllerOptions{
 | 
								options: &NamespaceControllerOptions{
 | 
				
			||||||
				&namespaceconfig.NamespaceControllerConfiguration{
 | 
									&namespaceconfig.NamespaceControllerConfiguration{
 | 
				
			||||||
					NamespaceSyncPeriod:      metav1.Duration{Duration: 10 * time.Minute},
 | 
										NamespaceSyncPeriod:      metav1.Duration{Duration: 10 * time.Minute},
 | 
				
			||||||
					ConcurrentNamespaceSyncs: 20,
 | 
										ConcurrentNamespaceSyncs: 20,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "NodeLifecycleControllerOptions",
 | 
								name:         "NodeLifecycleControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&NodeLifecycleControllerOptions{
 | 
								options: &NodeLifecycleControllerOptions{
 | 
				
			||||||
				&nodelifecycleconfig.NodeLifecycleControllerConfiguration{
 | 
									&nodelifecycleconfig.NodeLifecycleControllerConfiguration{
 | 
				
			||||||
					NodeEvictionRate:          0.2,
 | 
										NodeEvictionRate:          0.2,
 | 
				
			||||||
					SecondaryNodeEvictionRate: 0.05,
 | 
										SecondaryNodeEvictionRate: 0.05,
 | 
				
			||||||
@@ -1172,78 +1174,78 @@ func TestValidateControllersOptions(t *testing.T) {
 | 
				
			|||||||
					LargeClusterSizeThreshold: 100,
 | 
										LargeClusterSizeThreshold: 100,
 | 
				
			||||||
					UnhealthyZoneThreshold:    0.6,
 | 
										UnhealthyZoneThreshold:    0.6,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "PodGCControllerOptions",
 | 
								name:         "PodGCControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&PodGCControllerOptions{
 | 
								options: &PodGCControllerOptions{
 | 
				
			||||||
				&podgcconfig.PodGCControllerConfiguration{
 | 
									&podgcconfig.PodGCControllerConfiguration{
 | 
				
			||||||
					TerminatedPodGCThreshold: 12000,
 | 
										TerminatedPodGCThreshold: 12000,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "ReplicaSetControllerOptions",
 | 
								name:         "ReplicaSetControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&ReplicaSetControllerOptions{
 | 
								options: &ReplicaSetControllerOptions{
 | 
				
			||||||
				&replicasetconfig.ReplicaSetControllerConfiguration{
 | 
									&replicasetconfig.ReplicaSetControllerConfiguration{
 | 
				
			||||||
					ConcurrentRSSyncs: 10,
 | 
										ConcurrentRSSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "ReplicationControllerOptions",
 | 
								name:         "ReplicationControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&ReplicationControllerOptions{
 | 
								options: &ReplicationControllerOptions{
 | 
				
			||||||
				&replicationconfig.ReplicationControllerConfiguration{
 | 
									&replicationconfig.ReplicationControllerConfiguration{
 | 
				
			||||||
					ConcurrentRCSyncs: 10,
 | 
										ConcurrentRCSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "ResourceQuotaControllerOptions",
 | 
								name:         "ResourceQuotaControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&ResourceQuotaControllerOptions{
 | 
								options: &ResourceQuotaControllerOptions{
 | 
				
			||||||
				&resourcequotaconfig.ResourceQuotaControllerConfiguration{
 | 
									&resourcequotaconfig.ResourceQuotaControllerConfiguration{
 | 
				
			||||||
					ResourceQuotaSyncPeriod:      metav1.Duration{Duration: 10 * time.Minute},
 | 
										ResourceQuotaSyncPeriod:      metav1.Duration{Duration: 10 * time.Minute},
 | 
				
			||||||
					ConcurrentResourceQuotaSyncs: 10,
 | 
										ConcurrentResourceQuotaSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "SAControllerOptions",
 | 
								name:         "SAControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&SAControllerOptions{
 | 
								options: &SAControllerOptions{
 | 
				
			||||||
				&serviceaccountconfig.SAControllerConfiguration{
 | 
									&serviceaccountconfig.SAControllerConfiguration{
 | 
				
			||||||
					ServiceAccountKeyFile:  "/service-account-private-key",
 | 
										ServiceAccountKeyFile:  "/service-account-private-key",
 | 
				
			||||||
					ConcurrentSATokenSyncs: 10,
 | 
										ConcurrentSATokenSyncs: 10,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "LegacySATokenCleanerOptions",
 | 
								name:         "LegacySATokenCleanerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&LegacySATokenCleanerOptions{
 | 
								options: &LegacySATokenCleanerOptions{
 | 
				
			||||||
				&serviceaccountconfig.LegacySATokenCleanerConfiguration{
 | 
									&serviceaccountconfig.LegacySATokenCleanerConfiguration{
 | 
				
			||||||
					CleanUpPeriod: metav1.Duration{Duration: 24 * 365 * time.Hour},
 | 
										CleanUpPeriod: metav1.Duration{Duration: 24 * 365 * time.Hour},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			name:         "TTLAfterFinishedControllerOptions",
 | 
								name:         "TTLAfterFinishedControllerOptions",
 | 
				
			||||||
			expectErrors: false,
 | 
								expectErrors: false,
 | 
				
			||||||
			validate: (&TTLAfterFinishedControllerOptions{
 | 
								options: &TTLAfterFinishedControllerOptions{
 | 
				
			||||||
				&ttlafterfinishedconfig.TTLAfterFinishedControllerConfiguration{
 | 
									&ttlafterfinishedconfig.TTLAfterFinishedControllerConfiguration{
 | 
				
			||||||
					ConcurrentTTLSyncs: 8,
 | 
										ConcurrentTTLSyncs: 8,
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}).Validate,
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, tc := range testCases {
 | 
						for _, tc := range testCases {
 | 
				
			||||||
		t.Run(tc.name, func(t *testing.T) {
 | 
							t.Run(tc.name, func(t *testing.T) {
 | 
				
			||||||
			errs := tc.validate()
 | 
								errs := tc.options.Validate()
 | 
				
			||||||
			if len(errs) > 0 && !tc.expectErrors {
 | 
								if len(errs) > 0 && !tc.expectErrors {
 | 
				
			||||||
				t.Errorf("expected no errors, errors found %+v", errs)
 | 
									t.Errorf("expected no errors, errors found %+v", errs)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user