@@ -20,6 +20,7 @@ type Config struct {
|
|||||||
Kubeconfig string
|
Kubeconfig string
|
||||||
FrontendImage string
|
FrontendImage string
|
||||||
BackendImage string
|
BackendImage string
|
||||||
|
LBTelegramImage string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load lit la config. Fail-secure : secret JWT obligatoire ; en prod base + Redis aussi.
|
// Load lit la config. Fail-secure : secret JWT obligatoire ; en prod base + Redis aussi.
|
||||||
@@ -43,6 +44,7 @@ func Load() (Config, error) {
|
|||||||
Kubeconfig: os.Getenv("KUBECONFIG"),
|
Kubeconfig: os.Getenv("KUBECONFIG"),
|
||||||
FrontendImage: os.Getenv("FRONTEND_IMAGE_APP"),
|
FrontendImage: os.Getenv("FRONTEND_IMAGE_APP"),
|
||||||
BackendImage: os.Getenv("BACKEND_IMAGE_APP"),
|
BackendImage: os.Getenv("BACKEND_IMAGE_APP"),
|
||||||
|
LBTelegramImage: os.Getenv("LBTELEGRAM_IMAGE_APP"),
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Env == "prod" {
|
if cfg.Env == "prod" {
|
||||||
|
|||||||
@@ -30,15 +30,16 @@ import (
|
|||||||
// HelmProvisioner : implémente Provisioner en appelant l'exécutable Helm.
|
// HelmProvisioner : implémente Provisioner en appelant l'exécutable Helm.
|
||||||
// Nécessite que helm soit installé dans le container (ex: dans /usr/local/bin/helm).
|
// Nécessite que helm soit installé dans le container (ex: dans /usr/local/bin/helm).
|
||||||
type HelmProvisioner struct {
|
type HelmProvisioner struct {
|
||||||
cfg *config.Config
|
cfg *config.Config
|
||||||
k8sClient *kubernetes.Clientset
|
k8sClient *kubernetes.Clientset
|
||||||
restConfig *rest.Config // pour l'exec dans les pods (pg_dump/restore)
|
restConfig *rest.Config // pour l'exec dans les pods (pg_dump/restore)
|
||||||
metricsClient *metricsclient.Clientset // optionnel : nil si metrics-server indisponible
|
metricsClient *metricsclient.Clientset // optionnel : nil si metrics-server indisponible
|
||||||
chartsDir string // chemin vers le dossier des charts (ex: /charts)
|
chartsDir string // chemin vers le dossier des charts (ex: /charts)
|
||||||
frontendImage string
|
frontendImage string
|
||||||
backendImage string
|
backendImage string
|
||||||
baseDomain string
|
lbtelegramImage string
|
||||||
helmPath string // chemin vers l'exécutable helm (default: "helm")
|
baseDomain string
|
||||||
|
helmPath string // chemin vers l'exécutable helm (default: "helm")
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHelmProvisioner crée un nouveau provisioner Helm.
|
// NewHelmProvisioner crée un nouveau provisioner Helm.
|
||||||
@@ -66,15 +67,16 @@ func NewHelmProvisioner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &HelmProvisioner{
|
return &HelmProvisioner{
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
k8sClient: k8sClient,
|
k8sClient: k8sClient,
|
||||||
restConfig: restConfig,
|
restConfig: restConfig,
|
||||||
metricsClient: metricsClient,
|
metricsClient: metricsClient,
|
||||||
chartsDir: chartsDir,
|
chartsDir: chartsDir,
|
||||||
frontendImage: cfg.FrontendImage,
|
frontendImage: cfg.FrontendImage,
|
||||||
backendImage: cfg.BackendImage,
|
backendImage: cfg.BackendImage,
|
||||||
baseDomain: cfg.DemoDomain,
|
lbtelegramImage: cfg.LBTelegramImage,
|
||||||
helmPath: helmPath,
|
baseDomain: cfg.DemoDomain,
|
||||||
|
helmPath: helmPath,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,8 +619,14 @@ func (h *HelmProvisioner) buildLBTelegramValues(d Demo, cfg ProvisionConfig, bac
|
|||||||
backendURL := fmt.Sprintf("http://%s-backend-gestion-backend.%s.svc.cluster.local:8080", d.Namespace, d.Namespace)
|
backendURL := fmt.Sprintf("http://%s-backend-gestion-backend.%s.svc.cluster.local:8080", d.Namespace, d.Namespace)
|
||||||
dbURL := fmt.Sprintf("postgres://postgres:demo-postgres-pass@%s-postgresql-postgresql:5432/demo_db?sslmode=disable", d.Namespace)
|
dbURL := fmt.Sprintf("postgres://postgres:demo-postgres-pass@%s-postgresql-postgresql:5432/demo_db?sslmode=disable", d.Namespace)
|
||||||
redisURL := fmt.Sprintf("redis://:demo-redis-pass@%s-redis-redis:6379/0", d.Namespace)
|
redisURL := fmt.Sprintf("redis://:demo-redis-pass@%s-redis-redis:6379/0", d.Namespace)
|
||||||
|
lbRepo, lbTag := parseImage(h.lbtelegramImage)
|
||||||
|
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
|
"image": map[string]interface{}{
|
||||||
|
"repository": lbRepo,
|
||||||
|
"tag": lbTag,
|
||||||
|
"pullPolicy": "Always",
|
||||||
|
},
|
||||||
"env": map[string]string{
|
"env": map[string]string{
|
||||||
"PORT": "8081",
|
"PORT": "8081",
|
||||||
"ENV": "production",
|
"ENV": "production",
|
||||||
|
|||||||
Reference in New Issue
Block a user