chore: build
ci-api / test (push) Successful in 28m19s

This commit is contained in:
Xor290
2026-10-26 20:58:30 +01:00
parent e9659854db
commit 5061095fe2
21 changed files with 1303 additions and 26 deletions
@@ -7,6 +7,7 @@ import (
"strconv"
corev1 "k8s.io/api/core/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -150,6 +151,20 @@ func (h *HelmProvisioner) ProjectState(ctx context.Context, namespace string) (R
return buildProjectState(pods.Items, h.podUsage(ctx, namespace)), nil
}
// NamespaceExists : le namespace existe-t-il dans le cluster ? Seule une erreur
// « not found » explicite signifie « absent » ; toute autre erreur (API
// injoignable, droits) est renvoyée pour que l'appelant ne conclue rien.
func (h *HelmProvisioner) NamespaceExists(ctx context.Context, namespace string) (bool, error) {
_, err := h.k8sClient.CoreV1().Namespaces().Get(ctx, namespace, metav1.GetOptions{})
if k8sErrors.IsNotFound(err) {
return false, nil
}
if err != nil {
return false, err
}
return true, nil
}
// buildProjectState range les pods d'un projet par composant (voir
// ProjectState). usage : nom de pod -> [cpuMilli, memMi].
func buildProjectState(pods []corev1.Pod, usage map[string][2]int64) ResourceState {