From 7a0d0746d4fc99e903bf0afea378b76f101a11d7 Mon Sep 17 00:00:00 2001 From: Anton Kuznetcov Date: Tue, 28 Oct 2025 11:58:22 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=B2=D0=B5=D1=82=D0=BA?= =?UTF-8?q?=D0=B5=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.txt | 2 +- deploy/3.deployment.tmpl.yaml | 6 +++--- deploy/6.full-build.sh | 13 +++++++++++-- deploy/VERSION.txt | 2 +- kustomize/configmap.yaml | 2 +- kustomize/deployment.yaml | 12 ++++++------ kustomize/ingress-route.yaml | 2 +- kustomize/kustomization.yaml | 4 ++-- kustomize/service.yaml | 4 ++-- ssl/ssl.go | 18 ++++++++---------- 10 files changed, 36 insertions(+), 29 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index f256be6..8a5b818 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -v2.0.3 +v2.0.4 diff --git a/deploy/3.deployment.tmpl.yaml b/deploy/3.deployment.tmpl.yaml index 5eb6bf3..d1395f0 100644 --- a/deploy/3.deployment.tmpl.yaml +++ b/deploy/3.deployment.tmpl.yaml @@ -59,20 +59,20 @@ spec: # Health checks startupProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 10 periodSeconds: 5 failureThreshold: 30 readinessProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 10 periodSeconds: 60 diff --git a/deploy/6.full-build.sh b/deploy/6.full-build.sh index 953220d..a54ad6e 100755 --- a/deploy/6.full-build.sh +++ b/deploy/6.full-build.sh @@ -127,15 +127,24 @@ fi if [ "$current_branch" != "main" ]; then git checkout main git merge --no-ff -m "Merged branch '$current_branch' into main while building $VERSION" "$current_branch" + git push origin main elif [ "$current_branch" = "main" ]; then log "🔄 Вы находитесь на ветке main. Слияние с release..." git add . git commit -m "Исправления в ветке $current_branch" + git push origin main fi # переключиться на ветку release и слить с веткой main -git checkout release -git merge --no-ff -m "Merged main into release while building $VERSION" main +if git show-ref --quiet refs/heads/release; then + log "ℹ️ Branch 'release' exists. Proceeding with merge." + git checkout release + git merge --no-ff -m "Merged main into release while building $VERSION" main +else + log "❌ Branch 'release' does not exist. Please create the branch before proceeding." + git checkout -b release + git merge --no-ff -m "Merged main into release while building $VERSION" main +fi # если тег $VERSION существует, удалить его и принудительно запушить tag_exists=$(git tag -l "$VERSION") diff --git a/deploy/VERSION.txt b/deploy/VERSION.txt index f256be6..8a5b818 100644 --- a/deploy/VERSION.txt +++ b/deploy/VERSION.txt @@ -1 +1 @@ -v2.0.3 +v2.0.4 diff --git a/kustomize/configmap.yaml b/kustomize/configmap.yaml index 0aca463..de43877 100644 --- a/kustomize/configmap.yaml +++ b/kustomize/configmap.yaml @@ -5,7 +5,7 @@ metadata: namespace: lcg data: # Основные настройки - LCG_VERSION: "v2.0.3" + LCG_VERSION: "v2.0.4" LCG_BASE_PATH: "/lcg" LCG_SERVER_HOST: "0.0.0.0" LCG_SERVER_PORT: "8080" diff --git a/kustomize/deployment.yaml b/kustomize/deployment.yaml index f630dcb..cce6280 100644 --- a/kustomize/deployment.yaml +++ b/kustomize/deployment.yaml @@ -5,7 +5,7 @@ metadata: namespace: lcg labels: app: lcg - version: v2.0.3 + version: v2.0.4 spec: replicas: 1 selector: @@ -15,11 +15,11 @@ spec: metadata: labels: app: lcg - version: v2.0.3 + version: v2.0.4 spec: containers: - name: lcg - image: kuznetcovay/lcg:v2.0.3 + image: kuznetcovay/lcg:v2.0.4 imagePullPolicy: Always ports: - containerPort: 8080 @@ -59,20 +59,20 @@ spec: # Health checks startupProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 10 periodSeconds: 5 failureThreshold: 30 readinessProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: httpGet: - path: /login + path: /lcg port: 8080 initialDelaySeconds: 10 periodSeconds: 60 diff --git a/kustomize/ingress-route.yaml b/kustomize/ingress-route.yaml index 77db26b..30819e4 100644 --- a/kustomize/ingress-route.yaml +++ b/kustomize/ingress-route.yaml @@ -5,7 +5,7 @@ metadata: namespace: lcg labels: app: lcg - version: v2.0.3 + version: v2.0.4 spec: entryPoints: - websecure diff --git a/kustomize/kustomization.yaml b/kustomize/kustomization.yaml index 027db87..d03fb97 100644 --- a/kustomize/kustomization.yaml +++ b/kustomize/kustomization.yaml @@ -15,11 +15,11 @@ resources: # Common labels commonLabels: app: lcg - version: v2.0.3 + version: v2.0.4 managed-by: kustomize # Images images: - name: lcg newName: kuznetcovay/lcg - newTag: v2.0.3 + newTag: v2.0.4 diff --git a/kustomize/service.yaml b/kustomize/service.yaml index d515c36..c4459c6 100644 --- a/kustomize/service.yaml +++ b/kustomize/service.yaml @@ -5,7 +5,7 @@ metadata: namespace: lcg labels: app: lcg - version: v2.0.3 + version: v2.0.4 spec: type: ClusterIP ports: @@ -15,4 +15,4 @@ spec: name: http selector: app: lcg - version: v2.0.3 + version: v2.0.4 diff --git a/ssl/ssl.go b/ssl/ssl.go index ffdcfa9..a814b98 100644 --- a/ssl/ssl.go +++ b/ssl/ssl.go @@ -1,6 +1,7 @@ package ssl import ( + "slices" "crypto/rand" "crypto/rsa" "crypto/tls" @@ -139,25 +140,22 @@ func LoadOrGenerateCert(host string) (*tls.Certificate, error) { // IsSecureHost проверяет, является ли хост безопасным для HTTP func IsSecureHost(host string) bool { secureHosts := []string{"localhost", "127.0.0.1", "::1"} - for _, secureHost := range secureHosts { - if host == secureHost { - return true - } - } - return false + return slices.Contains(secureHosts, host) } // ShouldUseHTTPS определяет, нужно ли использовать HTTPS func ShouldUseHTTPS(host string) bool { + + // Если явно разрешен HTTP, используем HTTP + if config.AppConfig.Server.AllowHTTP { + return false + } + // Если хост не localhost/127.0.0.1, принуждаем к HTTPS if !IsSecureHost(host) { return true } - // Если явно разрешен HTTP, используем HTTP - if config.AppConfig.Server.AllowHTTP { - return false - } // По умолчанию для localhost используем HTTP return false