From c0332af5d71159a0a42dd20ce9a386b2279bf912 Mon Sep 17 00:00:00 2001 From: Richi Date: Tue, 10 Dec 2024 12:47:03 +0100 Subject: [PATCH] updating kuberntess settings (#2006) * - fixing rabbit mq secret - added missing prefixses - fixed hostname - removed default prefix (we dont use it on konto) * implemented comments * implementing comments. --- .../kubernetes/base/deployment.yml | 37 +++++++++++-------- nest-city-account/kubernetes/base/ingress.yml | 8 ++-- .../kubernetes/base/kustomization.yml | 8 +--- .../kubernetes/base/rabbitmq.yml | 8 ++-- .../kubernetes/base/service-app.yml | 2 +- .../kubernetes/base/service-database.yml | 2 +- .../kubernetes/base/stateful-set.yml | 6 +-- .../kubernetes/envs/Dev/kustomization.yml | 5 ++- .../kubernetes/envs/Prod/kustomization.yml | 5 ++- .../kubernetes/envs/Staging/kustomization.yml | 5 ++- 10 files changed, 47 insertions(+), 39 deletions(-) diff --git a/nest-city-account/kubernetes/base/deployment.yml b/nest-city-account/kubernetes/base/deployment.yml index 159a90287..8ebd1c902 100644 --- a/nest-city-account/kubernetes/base/deployment.yml +++ b/nest-city-account/kubernetes/base/deployment.yml @@ -1,10 +1,15 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: app + name: ${BUILD_REPOSITORY_NAME}-app namespace: ${NAMESPACE} labels: service: app + annotations: + repositoryUrl: ${BUILD_REPOSITORY_URI} + commit: ${COMMIT} + tag: ${TAG} + image: ${IMAGE} spec: selector: matchLabels: @@ -40,48 +45,48 @@ spec: - name: RABBIT_MQ_PASSWORD valueFrom: secretKeyRef: - name: rabbitmq-default-user + name: ${BUILD_REPOSITORY_NAME}-rabbitmq-default-user key: password - name: RABBIT_MQ_USERNAME valueFrom: secretKeyRef: - name: rabbitmq-default-user + name: ${BUILD_REPOSITORY_NAME}-rabbitmq-default-user key: username - name: RABBIT_MQ_PORT valueFrom: secretKeyRef: - name: rabbitmq-default-user + name: ${BUILD_REPOSITORY_NAME}-rabbitmq-default-user key: port - name: RABBIT_MQ_HOST valueFrom: secretKeyRef: - name: rabbitmq-default-user + name: ${BUILD_REPOSITORY_NAME}-rabbitmq-default-user key: host - name: DATABASE_URL value: postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@${BUILD_REPOSITORY_NAME}-database:5432/$(POSTGRES_DB)?schema=public&connection_limit=100 envFrom: - secretRef: - name: database-secret + name: ${BUILD_REPOSITORY_NAME}-database-secret - secretRef: - name: cognito-secret + name: ${BUILD_REPOSITORY_NAME}-cognito-secret - secretRef: - name: azure-magproxy-secret + name: ${BUILD_REPOSITORY_NAME}-azure-magproxy-secret - secretRef: - name: turnstile-secret + name: ${BUILD_REPOSITORY_NAME}-turnstile-secret - secretRef: - name: mailgun-secret + name: ${BUILD_REPOSITORY_NAME}-mailgun-secret - secretRef: - name: apikey-secret + name: ${BUILD_REPOSITORY_NAME}-apikey-secret - secretRef: - name: nases-secret + name: ${BUILD_REPOSITORY_NAME}-nases-secret - secretRef: - name: bloomreach-secret + name: ${BUILD_REPOSITORY_NAME}-bloomreach-secret - secretRef: - name: cipher-key-secret + name: ${BUILD_REPOSITORY_NAME}-cipher-key-secret - secretRef: - name: tax-backend-secret + name: ${BUILD_REPOSITORY_NAME}-tax-backend-secret - configMapRef: - name: env + name: ${BUILD_REPOSITORY_NAME}-env readinessProbe: httpGet: path: /healthcheck diff --git a/nest-city-account/kubernetes/base/ingress.yml b/nest-city-account/kubernetes/base/ingress.yml index 113f81e7a..6f5f96010 100644 --- a/nest-city-account/kubernetes/base/ingress.yml +++ b/nest-city-account/kubernetes/base/ingress.yml @@ -1,7 +1,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: ingress + name: ${BUILD_REPOSITORY_NAME}-ingress namespace: ${NAMESPACE} labels: service: app @@ -12,16 +12,16 @@ metadata: spec: tls: - hosts: - - ${HOSTNAME} + - ${BRATISKA_HOSTNAME} secretName: ${BUILD_REPOSITORY_NAME}-tls rules: - - host: ${HOSTNAME} + - host: ${BRATISKA_HOSTNAME} http: paths: - path: / pathType: ImplementationSpecific backend: service: - name: app + name: ${BUILD_REPOSITORY_NAME}-app port: number: 80 diff --git a/nest-city-account/kubernetes/base/kustomization.yml b/nest-city-account/kubernetes/base/kustomization.yml index 44b62b4c5..8ab98f0cf 100644 --- a/nest-city-account/kubernetes/base/kustomization.yml +++ b/nest-city-account/kubernetes/base/kustomization.yml @@ -9,8 +9,6 @@ resources: configurations: - configuration.yml -# Keep as is -namePrefix: ${BUILD_REPOSITORY_NAME}- commonLabels: app: ${BUILD_REPOSITORY_NAME} source: ${BUILD_REPOSITORY_NAME} @@ -18,12 +16,8 @@ commonLabels: generatorOptions: disableNameSuffixHash: true -commonAnnotations: - repositoryUrl: ${BUILD_REPOSITORY_URI} - image: ${IMAGE} - configMapGenerator: -- name: env +- name: ${BUILD_REPOSITORY_NAME}-env namespace: ${NAMESPACE} envs: - .env diff --git a/nest-city-account/kubernetes/base/rabbitmq.yml b/nest-city-account/kubernetes/base/rabbitmq.yml index b85cb15b7..829aa4a4e 100644 --- a/nest-city-account/kubernetes/base/rabbitmq.yml +++ b/nest-city-account/kubernetes/base/rabbitmq.yml @@ -1,7 +1,7 @@ apiVersion: rabbitmq.com/v1beta1 kind: RabbitmqCluster metadata: - name: rabbitmq + name: ${BUILD_REPOSITORY_NAME}-rabbitmq namespace: ${NAMESPACE} spec: replicas: 1 @@ -13,8 +13,8 @@ spec: cpu: ${RABBIT_CPU_REQUESTS} memory: ${RABBIT_MEMORY_REQUESTS} persistence: - storageClassName: "vsan-default-storage-policy" - storage: 10Gi + storageClassName: "vsan-default-storage-policy" + storage: 10Gi override: statefulSet: spec: @@ -45,7 +45,7 @@ spec: - curl -L -v https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.11.1/rabbitmq_delayed_message_exchange-3.11.1.ez --output /community-plugins/rabbitmq_delayed_message_exchange-3.11.1.ez image: curlimages/curl imagePullPolicy: IfNotPresent - name: copy-community-plugins + name: ${BUILD_REPOSITORY_NAME}-copy-community-plugins resources: limits: cpu: 100m diff --git a/nest-city-account/kubernetes/base/service-app.yml b/nest-city-account/kubernetes/base/service-app.yml index b1dd45606..7701d18b6 100644 --- a/nest-city-account/kubernetes/base/service-app.yml +++ b/nest-city-account/kubernetes/base/service-app.yml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: app + name: ${BUILD_REPOSITORY_NAME}-app namespace: ${NAMESPACE} labels: service: app diff --git a/nest-city-account/kubernetes/base/service-database.yml b/nest-city-account/kubernetes/base/service-database.yml index 5fa7c4bb0..9b480c674 100644 --- a/nest-city-account/kubernetes/base/service-database.yml +++ b/nest-city-account/kubernetes/base/service-database.yml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: database + name: ${BUILD_REPOSITORY_NAME}-database namespace: ${NAMESPACE} labels: service: database diff --git a/nest-city-account/kubernetes/base/stateful-set.yml b/nest-city-account/kubernetes/base/stateful-set.yml index 8805bb9a9..a79c25eee 100644 --- a/nest-city-account/kubernetes/base/stateful-set.yml +++ b/nest-city-account/kubernetes/base/stateful-set.yml @@ -1,12 +1,12 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: database + name: ${BUILD_REPOSITORY_NAME}-database namespace: ${NAMESPACE} labels: service: database spec: - serviceName: database + serviceName: ${BUILD_REPOSITORY_NAME}-database selector: matchLabels: service: database @@ -32,7 +32,7 @@ spec: subPath: postgresql envFrom: - secretRef: - name: database-secret + name: ${BUILD_REPOSITORY_NAME}-database-secret # Volume Claim volumeClaimTemplates: - metadata: diff --git a/nest-city-account/kubernetes/envs/Dev/kustomization.yml b/nest-city-account/kubernetes/envs/Dev/kustomization.yml index 3dca5f090..79990fcf1 100644 --- a/nest-city-account/kubernetes/envs/Dev/kustomization.yml +++ b/nest-city-account/kubernetes/envs/Dev/kustomization.yml @@ -3,8 +3,11 @@ resources: - secrets/database.secret.yml - scaler.yml +generatorOptions: + disableNameSuffixHash: true + configMapGenerator: - - name: env + - name: ${BUILD_REPOSITORY_NAME}-env namespace: ${NAMESPACE} behavior: merge envs: diff --git a/nest-city-account/kubernetes/envs/Prod/kustomization.yml b/nest-city-account/kubernetes/envs/Prod/kustomization.yml index 3dca5f090..79990fcf1 100644 --- a/nest-city-account/kubernetes/envs/Prod/kustomization.yml +++ b/nest-city-account/kubernetes/envs/Prod/kustomization.yml @@ -3,8 +3,11 @@ resources: - secrets/database.secret.yml - scaler.yml +generatorOptions: + disableNameSuffixHash: true + configMapGenerator: - - name: env + - name: ${BUILD_REPOSITORY_NAME}-env namespace: ${NAMESPACE} behavior: merge envs: diff --git a/nest-city-account/kubernetes/envs/Staging/kustomization.yml b/nest-city-account/kubernetes/envs/Staging/kustomization.yml index 3dca5f090..79990fcf1 100644 --- a/nest-city-account/kubernetes/envs/Staging/kustomization.yml +++ b/nest-city-account/kubernetes/envs/Staging/kustomization.yml @@ -3,8 +3,11 @@ resources: - secrets/database.secret.yml - scaler.yml +generatorOptions: + disableNameSuffixHash: true + configMapGenerator: - - name: env + - name: ${BUILD_REPOSITORY_NAME}-env namespace: ${NAMESPACE} behavior: merge envs: