fix: recreate namespace after manual deletion
This commit is contained in:
@@ -49,7 +49,7 @@ spec:
|
||||
serviceAccountName: fission-console
|
||||
containers:
|
||||
- name: console
|
||||
image: naeel/fission-console@sha256:765fecf927e64ca50fffbb1bf50169ab318ab7bb2e0878493dd2b3aaf11989c3
|
||||
image: naeel/fission-console@sha256:5f0846c53267bd275f173981afbc8181e7808c3cf98c3902acaa659d6183e8a9
|
||||
ports:
|
||||
- containerPort: 8090
|
||||
env:
|
||||
|
||||
@@ -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