Skip to content

Commit ce2fb70

Browse files
Revert "feat: Ability to create custom labels for namespaces created … (#455)
* Revert "feat: Ability to create custom labels for namespaces created with syncOptions CreateNamespace (#443)" This reverts commit a56a803. * remove import Signed-off-by: pashavictorovich <[email protected]> * fix test Signed-off-by: pashavictorovich <[email protected]> Signed-off-by: pashavictorovich <[email protected]>
1 parent 9970fab commit ce2fb70

File tree

2 files changed

+38
-96
lines changed

2 files changed

+38
-96
lines changed

pkg/sync/sync_context.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,10 @@ func WithResourceModificationChecker(enabled bool, diffResults *diff.DiffResultL
154154
}
155155

156156
// 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 {
158158
return func(ctx *syncContext) {
159159
ctx.createNamespace = createNamespace
160160
ctx.namespaceModifier = namespaceModifier
161-
ctx.namespaceCreator = namespaceCreator
162161
}
163162
}
164163

@@ -352,7 +351,6 @@ type syncContext struct {
352351

353352
createNamespace bool
354353
namespaceModifier func(*unstructured.Unstructured) bool
355-
namespaceCreator func(*unstructured.Unstructured) bool
356354

357355
syncWaveHook common.SyncWaveHook
358356

@@ -818,9 +816,7 @@ func (sc *syncContext) autoCreateNamespace(tasks syncTasks) syncTasks {
818816
}
819817
}
820818
} 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})
824820
} else {
825821
task := &syncTask{phase: common.SyncPhasePreSync, targetObj: unstructuredObj}
826822
sc.setResourceResult(task, common.ResultCodeSyncFailed, common.OperationError, fmt.Sprintf("Namespace auto creation failed: %s", err))

0 commit comments

Comments
 (0)