fix: recreate namespace after manual deletion
This commit is contained in:
@@ -65,7 +65,13 @@ func (m *NSManager) EnsureUserNS(ctx context.Context, ns string) error {
|
||||
m.ensuredNSMu.Lock()
|
||||
if _, ok := m.ensuredNS[ns]; ok {
|
||||
m.ensuredNSMu.Unlock()
|
||||
return nil // быстрый путь: уже создан
|
||||
if m.namespaceExists(ctx, ns) {
|
||||
return nil // быстрый путь: уже создан и реально существует
|
||||
}
|
||||
|
||||
m.ensuredNSMu.Lock()
|
||||
delete(m.ensuredNS, ns)
|
||||
m.ensuredNSMu.Unlock()
|
||||
}
|
||||
if inflight, ok := m.ensuredNSInFlight[ns]; ok {
|
||||
m.ensuredNSMu.Unlock()
|
||||
@@ -107,6 +113,11 @@ func (m *NSManager) EnsureUserNS(ctx context.Context, ns string) error {
|
||||
return inflight.err
|
||||
}
|
||||
|
||||
func (m *NSManager) namespaceExists(ctx context.Context, ns string) bool {
|
||||
_, err := m.dyn.Resource(fission.NamespaceGVR).Get(ctx, ns, metav1.GetOptions{})
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// provisionNamespace выполняет полный lifecycle setup нового namespace:
|
||||
// 1. fission.SetupFissionNamespace — создаёт NS с меткой fission.io/managed=true
|
||||
// + Fission ServiceAccounts + Fission RoleBindings (Fission-специфичная часть)
|
||||
|
||||
Reference in New Issue
Block a user