From d3cdc14d674bdc5e2a6e93d51f3ea7554e96e229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cguiherme=E2=80=9D?= <“guilherme@agapesistemas.com.br”> Date: Wed, 19 Nov 2025 14:12:55 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20adicionar=20arquivos=20de=20configura?= =?UTF-8?q?=C3=A7=C3=A3o=20para=20ambiente=20Docker=20e=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 26 +++++++++++ .editorconfig | 12 +++++ .prettierignore | 2 + .prettierrc | 11 +++++ Dockerfile | 12 +++++ Jenkinsfile | 72 +++++++++++++++++++++++++++++ k8s/BETA/certificate.yaml | 13 ++++++ k8s/BETA/deployment-withrole.yaml | 64 +++++++++++++++++++++++++ k8s/BETA/deployment.yaml | 51 ++++++++++++++++++++ k8s/BETA/hpa.yaml | 19 ++++++++ k8s/BETA/ingress.yaml | 23 +++++++++ k8s/BETA/service.yaml | 18 ++++++++ k8s/BETA/storage/configmap.yaml | 5 ++ k8s/BETA/storage/secret.yaml | 5 ++ k8s/HML/certificate.yaml | 13 ++++++ k8s/HML/deployment-withrole.yaml | 61 ++++++++++++++++++++++++ k8s/HML/deployment.yaml | 48 +++++++++++++++++++ k8s/HML/hpa.yaml | 19 ++++++++ k8s/HML/ingress.yaml | 23 +++++++++ k8s/HML/service.yaml | 18 ++++++++ k8s/HML/storage/configmap.yaml | 8 ++++ k8s/HML/storage/secret.yaml | 7 +++ k8s/PRD/certificate.yaml | 13 ++++++ k8s/PRD/deployment-high.yaml | 58 +++++++++++++++++++++++ k8s/PRD/deployment-withrole.yaml | 61 ++++++++++++++++++++++++ k8s/PRD/deployment.yaml | 48 +++++++++++++++++++ k8s/PRD/hpa-high.yaml | 19 ++++++++ k8s/PRD/hpa.yaml | 19 ++++++++ k8s/PRD/ingress.yaml | 23 +++++++++ k8s/PRD/service.yaml | 18 ++++++++ k8s/PRD/storage/configmap-high.yaml | 5 ++ k8s/PRD/storage/configmap.yaml | 8 ++++ k8s/PRD/storage/secret-high.yaml | 5 ++ k8s/PRD/storage/secret.yaml | 5 ++ 34 files changed, 812 insertions(+) create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 k8s/BETA/certificate.yaml create mode 100644 k8s/BETA/deployment-withrole.yaml create mode 100644 k8s/BETA/deployment.yaml create mode 100644 k8s/BETA/hpa.yaml create mode 100644 k8s/BETA/ingress.yaml create mode 100644 k8s/BETA/service.yaml create mode 100644 k8s/BETA/storage/configmap.yaml create mode 100644 k8s/BETA/storage/secret.yaml create mode 100644 k8s/HML/certificate.yaml create mode 100644 k8s/HML/deployment-withrole.yaml create mode 100644 k8s/HML/deployment.yaml create mode 100644 k8s/HML/hpa.yaml create mode 100644 k8s/HML/ingress.yaml create mode 100644 k8s/HML/service.yaml create mode 100644 k8s/HML/storage/configmap.yaml create mode 100644 k8s/HML/storage/secret.yaml create mode 100644 k8s/PRD/certificate.yaml create mode 100644 k8s/PRD/deployment-high.yaml create mode 100644 k8s/PRD/deployment-withrole.yaml create mode 100644 k8s/PRD/deployment.yaml create mode 100644 k8s/PRD/hpa-high.yaml create mode 100644 k8s/PRD/hpa.yaml create mode 100644 k8s/PRD/ingress.yaml create mode 100644 k8s/PRD/service.yaml create mode 100644 k8s/PRD/storage/configmap-high.yaml create mode 100644 k8s/PRD/storage/configmap.yaml create mode 100644 k8s/PRD/storage/secret-high.yaml create mode 100644 k8s/PRD/storage/secret.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..52d53b9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ + Created by https://www.toptal.com/developers/gitignore/api/maven +# Edit at https://www.toptal.com/developers/gitignore?templates=maven + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/maven + +.idea +.env* diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5d47c21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b947077 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..ba33bd1 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": true, + "endOfLine": "lf", + "bracketSpacing": true, + "bracketSameLine": true, + "arrowParens": "always", + "tabWidth": 2, + "semi": true, + "trailingComma": "all", + "useTabs": false +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ddc1455 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:20-alpine + +WORKDIR /code + +COPY package.json package.json +COPY package-lock.json package-lock.json + +RUN npm install + +COPY . . + +CMD [ "npm", "run", "dev" ] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3a008ac --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,72 @@ +@Library('jenkins-library') _ +pipeline { + agent {label 'docker-slave'} + parameters { + string(name: 'PROJETO', defaultValue: 'agfrotapainelweb', description: 'Digite o nome do projeto:') + choice(name: 'AMBIENTE', choices: ['HML','BETA','PRD'], description: 'Selecione o Ambiente para publicação:') + string(name: 'TAG', defaultValue: '', description: 'Digite a tag da imagem caso deseje republicar uma versão já existente:') + } + environment { + DOCKERIMAGE = " " + MAIL_NOTIFICATION_RECIPIENTS = "rafael.deda@gmail.com" + } + stages{ + stage('Build e Construção da Imagem') { + when { + environment name: 'TAG', value: '' + } + steps{ + script{ + DOCKERIMAGE = buildImages(DOCKERIMAGE) + } + } + } + + stage('Submeter Imagem ao Registry') { + when { + environment name: 'TAG', value: '' + } + steps{ + script{ + DOCKERIMAGE = publishImages(DOCKERIMAGE) + } + } + } + stage('Deploy no Ambiente Selecionado no Cluster') { + when { + anyOf { + environment name: 'AMBIENTE', value: 'BETA' + environment name: 'AMBIENTE', value: 'PRD' + } + } + steps { + deployCluster() + } + } + + stage('Deploy no Ambiente on Promise') { + when { + allOf { + environment name: 'AMBIENTE', value: 'HML' + environment name: 'ON_PROMISE', value: '1' + } + } + steps{ + deployCluster('k8s-inovesolutions-hml') + } + } + + // stage('Limpando Imagens') { + // agent {label 'conteiner'} + // steps{ + // limpandoImagens() + // } + // } + } + post { + always { + //sendNotification() + cleanWorkspace() + } + } +} diff --git a/k8s/BETA/certificate.yaml b/k8s/BETA/certificate.yaml new file mode 100644 index 0000000..9cbfdca --- /dev/null +++ b/k8s/BETA/certificate.yaml @@ -0,0 +1,13 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: agapesistemas-PROJETOAMBIENTE-tls + namespace: agapesistemas-ns-AMBIENTE +spec: + dnsNames: + - PROJETOAMBIENTE.agapesistemas.com.br + issuerRef: + group: cert-manager.io + kind: ClusterIssuer + name: letsencrypt-prod + secretName: agapesistemas-PROJETOAMBIENTE-tls \ No newline at end of file diff --git a/k8s/BETA/deployment-withrole.yaml b/k8s/BETA/deployment-withrole.yaml new file mode 100644 index 0000000..bd86a8f --- /dev/null +++ b/k8s/BETA/deployment-withrole.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 1 + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - PROJETO + topologyKey: kubernetes.io/hostname + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + - secretRef: + name: agapesistemas-db-role-credential-sc + optional: false + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 1000Mi + requests: + memory: 780Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/BETA/deployment.yaml b/k8s/BETA/deployment.yaml new file mode 100644 index 0000000..8ed355e --- /dev/null +++ b/k8s/BETA/deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 1 + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 1200Mi + requests: + memory: 1000Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/BETA/hpa.yaml b/k8s/BETA/hpa.yaml new file mode 100644 index 0000000..9eeb673 --- /dev/null +++ b/k8s/BETA/hpa.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: agapesistemas-PROJETO-hpa + namespace: agapesistemas-ns-AMBIENTE +spec: + maxReplicas: 1 + metrics: + - resource: + name: memory + target: + averageValue: 780Mi + type: AverageValue + type: Resource + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: PROJETO-dp-AMBIENTE \ No newline at end of file diff --git a/k8s/BETA/ingress.yaml b/k8s/BETA/ingress.yaml new file mode 100644 index 0000000..6361f24 --- /dev/null +++ b/k8s/BETA/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + traefik.ingress.kubernetes.io/router.middlewares: traefik-http-to-https-redirectscheme@kubernetescrd,traefik-enable-cors-header@kubernetescrd + name: agapesistemas-PROJETO-ing + namespace: agapesistemas-ns-AMBIENTE +spec: + ingressClassName: traefik + rules: + - host: PROJETOAMBIENTE.agapesistemas.com.br + http: + paths: + - backend: + service: + name: agapesistemas-PROJETO-svc + port: + number: 8080 + pathType: ImplementationSpecific + tls: + - hosts: + - PROJETOAMBIENTE.agapesistemas.com.br + secretName: agapesistemas-PROJETOAMBIENTE-tls diff --git a/k8s/BETA/service.yaml b/k8s/BETA/service.yaml new file mode 100644 index 0000000..07cab40 --- /dev/null +++ b/k8s/BETA/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + traefik.ingress.kubernetes.io/service.sticky.cookie: 'true' + #traefik.ingress.kubernetes.io/service.sticky.cookie.name: JSESSIONID + traefik.ingress.kubernetes.io/service.sticky.cookie.secure: 'true' + name: agapesistemas-PROJETO-svc + namespace: agapesistemas-ns-AMBIENTE +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: PROJETO + type: ClusterIP diff --git a/k8s/BETA/storage/configmap.yaml b/k8s/BETA/storage/configmap.yaml new file mode 100644 index 0000000..7c2d8cf --- /dev/null +++ b/k8s/BETA/storage/configmap.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agapesistemas-PROJETO-cm + namespace: agapesistemas-ns-AMBIENTE \ No newline at end of file diff --git a/k8s/BETA/storage/secret.yaml b/k8s/BETA/storage/secret.yaml new file mode 100644 index 0000000..b0b32d5 --- /dev/null +++ b/k8s/BETA/storage/secret.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: Secret +metadata: + name: agapesistemas-PROJETO-sc + namespace: agapesistemas-ns-AMBIENTE \ No newline at end of file diff --git a/k8s/HML/certificate.yaml b/k8s/HML/certificate.yaml new file mode 100644 index 0000000..9cbfdca --- /dev/null +++ b/k8s/HML/certificate.yaml @@ -0,0 +1,13 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: agapesistemas-PROJETOAMBIENTE-tls + namespace: agapesistemas-ns-AMBIENTE +spec: + dnsNames: + - PROJETOAMBIENTE.agapesistemas.com.br + issuerRef: + group: cert-manager.io + kind: ClusterIssuer + name: letsencrypt-prod + secretName: agapesistemas-PROJETOAMBIENTE-tls \ No newline at end of file diff --git a/k8s/HML/deployment-withrole.yaml b/k8s/HML/deployment-withrole.yaml new file mode 100644 index 0000000..f0416d4 --- /dev/null +++ b/k8s/HML/deployment-withrole.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - PROJETO + topologyKey: kubernetes.io/hostname + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + - secretRef: + name: agapesistemas-db-role-credential-sc + optional: false + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 857Mi + requests: + memory: 720Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/HML/deployment.yaml b/k8s/HML/deployment.yaml new file mode 100644 index 0000000..47a690c --- /dev/null +++ b/k8s/HML/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 1800Mi + requests: + memory: 1008Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas diff --git a/k8s/HML/hpa.yaml b/k8s/HML/hpa.yaml new file mode 100644 index 0000000..dd0d71f --- /dev/null +++ b/k8s/HML/hpa.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: agapesistemas-PROJETO-hpa + namespace: agapesistemas-ns-AMBIENTE +spec: + maxReplicas: 1 + metrics: + - resource: + name: memory + target: + averageValue: 720Mi + type: AverageValue + type: Resource + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: PROJETO-dp-AMBIENTE \ No newline at end of file diff --git a/k8s/HML/ingress.yaml b/k8s/HML/ingress.yaml new file mode 100644 index 0000000..6361f24 --- /dev/null +++ b/k8s/HML/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + traefik.ingress.kubernetes.io/router.middlewares: traefik-http-to-https-redirectscheme@kubernetescrd,traefik-enable-cors-header@kubernetescrd + name: agapesistemas-PROJETO-ing + namespace: agapesistemas-ns-AMBIENTE +spec: + ingressClassName: traefik + rules: + - host: PROJETOAMBIENTE.agapesistemas.com.br + http: + paths: + - backend: + service: + name: agapesistemas-PROJETO-svc + port: + number: 8080 + pathType: ImplementationSpecific + tls: + - hosts: + - PROJETOAMBIENTE.agapesistemas.com.br + secretName: agapesistemas-PROJETOAMBIENTE-tls diff --git a/k8s/HML/service.yaml b/k8s/HML/service.yaml new file mode 100644 index 0000000..07cab40 --- /dev/null +++ b/k8s/HML/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + traefik.ingress.kubernetes.io/service.sticky.cookie: 'true' + #traefik.ingress.kubernetes.io/service.sticky.cookie.name: JSESSIONID + traefik.ingress.kubernetes.io/service.sticky.cookie.secure: 'true' + name: agapesistemas-PROJETO-svc + namespace: agapesistemas-ns-AMBIENTE +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: PROJETO + type: ClusterIP diff --git a/k8s/HML/storage/configmap.yaml b/k8s/HML/storage/configmap.yaml new file mode 100644 index 0000000..9411f3f --- /dev/null +++ b/k8s/HML/storage/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agapesistemas-PROJETO-cm + namespace: agapesistemas-ns-AMBIENTE + +data: + VITE_API_URL: 'https://agpainelapi.hml.agapesistemas.com.br' \ No newline at end of file diff --git a/k8s/HML/storage/secret.yaml b/k8s/HML/storage/secret.yaml new file mode 100644 index 0000000..5052dcd --- /dev/null +++ b/k8s/HML/storage/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: agapesistemas-PROJETO-sc + namespace: agapesistemas-ns-AMBIENTE + + diff --git a/k8s/PRD/certificate.yaml b/k8s/PRD/certificate.yaml new file mode 100644 index 0000000..9cbfdca --- /dev/null +++ b/k8s/PRD/certificate.yaml @@ -0,0 +1,13 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: agapesistemas-PROJETOAMBIENTE-tls + namespace: agapesistemas-ns-AMBIENTE +spec: + dnsNames: + - PROJETOAMBIENTE.agapesistemas.com.br + issuerRef: + group: cert-manager.io + kind: ClusterIssuer + name: letsencrypt-prod + secretName: agapesistemas-PROJETOAMBIENTE-tls \ No newline at end of file diff --git a/k8s/PRD/deployment-high.yaml b/k8s/PRD/deployment-high.yaml new file mode 100644 index 0000000..75d867b --- /dev/null +++ b/k8s/PRD/deployment-high.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 2 + strategy: + type: Recreate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - PROJETO + topologyKey: kubernetes.io/hostname + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 7142Mi + requests: + memory: 6000Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE-high + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/PRD/deployment-withrole.yaml b/k8s/PRD/deployment-withrole.yaml new file mode 100644 index 0000000..885f0da --- /dev/null +++ b/k8s/PRD/deployment-withrole.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 2 + strategy: + type: Recreate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app + operator: In + values: + - PROJETO + topologyKey: kubernetes.io/hostname + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + - secretRef: + name: agapesistemas-db-role-credential-sc + optional: false + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 1000Mi + requests: + memory: 780Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/PRD/deployment.yaml b/k8s/PRD/deployment.yaml new file mode 100644 index 0000000..d86d91b --- /dev/null +++ b/k8s/PRD/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + name: PROJETO-dp-AMBIENTE + namespace: agapesistemas-ns-AMBIENTE +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + template: + metadata: + labels: + app: PROJETO + workload.user.cattle.io/workloadselector: apps.deployment-agapesistemas-ns-AMBIENTE-PROJETO + namespace: agapesistemas-ns-AMBIENTE + spec: + containers: + - env: + - name: TZ + value: America/Maceio + envFrom: + - secretRef: + name: agapesistemas-db-credential-sc + - secretRef: + name: agapesistemas-PROJETO-sc + - configMapRef: + name: agapesistemas-PROJETO-cm + image: IMAGEM:TAG + name: PROJETO + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + memory: 1200Mi + requests: + memory: 1000Mi + nodeSelector: + doks.digitalocean.com/node-pool: pool-k8s-agapesistemas-app-AMBIENTE + imagePullSecrets: + - name: registry-agapesistemas \ No newline at end of file diff --git a/k8s/PRD/hpa-high.yaml b/k8s/PRD/hpa-high.yaml new file mode 100644 index 0000000..39ae4d5 --- /dev/null +++ b/k8s/PRD/hpa-high.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: agapesistemas-PROJETO-hpa + namespace: agapesistemas-ns-AMBIENTE +spec: + maxReplicas: 3 + metrics: + - resource: + name: memory + target: + averageValue: 6000Mi + type: AverageValue + type: Resource + minReplicas: 2 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: PROJETO-dp-AMBIENTE \ No newline at end of file diff --git a/k8s/PRD/hpa.yaml b/k8s/PRD/hpa.yaml new file mode 100644 index 0000000..9eeb673 --- /dev/null +++ b/k8s/PRD/hpa.yaml @@ -0,0 +1,19 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: agapesistemas-PROJETO-hpa + namespace: agapesistemas-ns-AMBIENTE +spec: + maxReplicas: 1 + metrics: + - resource: + name: memory + target: + averageValue: 780Mi + type: AverageValue + type: Resource + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: PROJETO-dp-AMBIENTE \ No newline at end of file diff --git a/k8s/PRD/ingress.yaml b/k8s/PRD/ingress.yaml new file mode 100644 index 0000000..6361f24 --- /dev/null +++ b/k8s/PRD/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + traefik.ingress.kubernetes.io/router.middlewares: traefik-http-to-https-redirectscheme@kubernetescrd,traefik-enable-cors-header@kubernetescrd + name: agapesistemas-PROJETO-ing + namespace: agapesistemas-ns-AMBIENTE +spec: + ingressClassName: traefik + rules: + - host: PROJETOAMBIENTE.agapesistemas.com.br + http: + paths: + - backend: + service: + name: agapesistemas-PROJETO-svc + port: + number: 8080 + pathType: ImplementationSpecific + tls: + - hosts: + - PROJETOAMBIENTE.agapesistemas.com.br + secretName: agapesistemas-PROJETOAMBIENTE-tls diff --git a/k8s/PRD/service.yaml b/k8s/PRD/service.yaml new file mode 100644 index 0000000..07cab40 --- /dev/null +++ b/k8s/PRD/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + traefik.ingress.kubernetes.io/service.sticky.cookie: 'true' + #traefik.ingress.kubernetes.io/service.sticky.cookie.name: JSESSIONID + traefik.ingress.kubernetes.io/service.sticky.cookie.secure: 'true' + name: agapesistemas-PROJETO-svc + namespace: agapesistemas-ns-AMBIENTE +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: PROJETO + type: ClusterIP diff --git a/k8s/PRD/storage/configmap-high.yaml b/k8s/PRD/storage/configmap-high.yaml new file mode 100644 index 0000000..7c2d8cf --- /dev/null +++ b/k8s/PRD/storage/configmap-high.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agapesistemas-PROJETO-cm + namespace: agapesistemas-ns-AMBIENTE \ No newline at end of file diff --git a/k8s/PRD/storage/configmap.yaml b/k8s/PRD/storage/configmap.yaml new file mode 100644 index 0000000..ea54b7f --- /dev/null +++ b/k8s/PRD/storage/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agapesistemas-PROJETO-cm + namespace: agapesistemas-ns-AMBIENTE + +data: + VITE_API_URL: 'https://agpainelapiprd.agapesistemas.com.br' \ No newline at end of file diff --git a/k8s/PRD/storage/secret-high.yaml b/k8s/PRD/storage/secret-high.yaml new file mode 100644 index 0000000..b0b32d5 --- /dev/null +++ b/k8s/PRD/storage/secret-high.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: Secret +metadata: + name: agapesistemas-PROJETO-sc + namespace: agapesistemas-ns-AMBIENTE \ No newline at end of file diff --git a/k8s/PRD/storage/secret.yaml b/k8s/PRD/storage/secret.yaml new file mode 100644 index 0000000..b0b32d5 --- /dev/null +++ b/k8s/PRD/storage/secret.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: Secret +metadata: + name: agapesistemas-PROJETO-sc + namespace: agapesistemas-ns-AMBIENTE \ No newline at end of file