From 84e49ad0177836ace7e6fb36243a5db05fbfe2fc Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Fri, 25 Oct 2024 15:04:42 +0200 Subject: [PATCH] set APP_ENV in helm --- Jenkinsfile | 4 +--- config/config-production.yml | 2 +- internal/config/config.go | 1 + src/main/helm/templates/deployment.yaml | 4 +++- src/main/helm/values.yaml | 4 +--- src/test/helm/deployment_env_test.yaml | 11 ++++++++--- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f36238f..40f9cb5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,10 +75,8 @@ tools { go 'go-1.22.0' } chmod +x ./buf ./buf generate #to compile go statically with these tags, so that the binary is not dynamically linked and from scratch in Dockerfile will work - APP_ENV=production go build -tags osusergo,netgo cmd/antragsraum-proxy/main.go - - ''' + ''' } } } diff --git a/config/config-production.yml b/config/config-production.yml index 06bfbda..fbfedf2 100755 --- a/config/config-production.yml +++ b/config/config-production.yml @@ -1,6 +1,6 @@ http: server: - port: 8082 + port: 8083 grpc: server: mock: false diff --git a/internal/config/config.go b/internal/config/config.go index 49ecde6..8eb97bb 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -66,6 +66,7 @@ func LoadConfig(configFilePath ...string) Config { if env == "" { env = defaultEnv } + fmt.Printf("APP_ENV: %v\n", env) fp := fmt.Sprintf("config/config-%s.yml", env) diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 0020d63..b4a6d8c 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -59,7 +59,9 @@ spec: containers: - env: - name: GRPC_SERVER_PORT - value: "{{ .Values.grpc.server.port }}" + value: "{{ ((.Values.grpc).server).port }}" + - name: APP_ENV + value: "production" {{- with include "app.getCustomList" . }} {{ . | indent 10 }} {{- end }} diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index 401690d..759391b 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -31,8 +31,6 @@ image: name: antragraum-proxy tag: latest # [default: latest] - - grpc: server: - mock: false \ No newline at end of file + port: 9090 \ No newline at end of file diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index b531380..885ca83 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -69,15 +69,20 @@ tests: path: spec.template.spec.containers[0].env content: name: GRPC_SERVER_PORT - value: "" + value: "9090" + - contains: + path: spec.template.spec.containers[0].env + content: + name: APP_ENV + value: "production" - it: check set envs set: grpc: server: - port: 9090 + port: 9091 asserts: - contains: path: spec.template.spec.containers[0].env content: name: GRPC_SERVER_PORT - value: "9090" \ No newline at end of file + value: "9091" \ No newline at end of file -- GitLab