@@ -154,11 +154,10 @@ func WithResourceModificationChecker(enabled bool, diffResults *diff.DiffResultL
154
154
}
155
155
156
156
// WithNamespaceCreation will create non-exist namespace
157
- func WithNamespaceCreation (createNamespace bool , namespaceModifier func (* unstructured.Unstructured ) bool , namespaceCreator func ( * unstructured. Unstructured ) bool ) SyncOpt {
157
+ func WithNamespaceCreation (createNamespace bool , namespaceModifier func (* unstructured.Unstructured ) bool ) SyncOpt {
158
158
return func (ctx * syncContext ) {
159
159
ctx .createNamespace = createNamespace
160
160
ctx .namespaceModifier = namespaceModifier
161
- ctx .namespaceCreator = namespaceCreator
162
161
}
163
162
}
164
163
@@ -352,7 +351,6 @@ type syncContext struct {
352
351
353
352
createNamespace bool
354
353
namespaceModifier func (* unstructured.Unstructured ) bool
355
- namespaceCreator func (* unstructured.Unstructured ) bool
356
354
357
355
syncWaveHook common.SyncWaveHook
358
356
@@ -818,9 +816,7 @@ func (sc *syncContext) autoCreateNamespace(tasks syncTasks) syncTasks {
818
816
}
819
817
}
820
818
} else if apierr .IsNotFound (err ) {
821
- if sc .namespaceCreator (unstructuredObj ) {
822
- tasks = append (tasks , & syncTask {phase : common .SyncPhasePreSync , targetObj : unstructuredObj , liveObj : nil })
823
- }
819
+ tasks = append (tasks , & syncTask {phase : common .SyncPhasePreSync , targetObj : unstructuredObj , liveObj : nil })
824
820
} else {
825
821
task := & syncTask {phase : common .SyncPhasePreSync , targetObj : unstructuredObj }
826
822
sc .setResourceResult (task , common .ResultCodeSyncFailed , common .OperationError , fmt .Sprintf ("Namespace auto creation failed: %s" , err ))
0 commit comments