add ingress for api in staging and test environments (#169)

This commit is contained in:
ftocal 2023-02-28 15:44:45 -03:00 committed by GitHub
parent cd99c446e1
commit b1583d5e21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 44 deletions

View File

@ -1,5 +1,4 @@
{{ if eq .ENVIRONMENT "production" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
@ -14,13 +13,15 @@ metadata:
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: "5"
alb.ingress.kubernetes.io/healthy-threshold-count: "2"
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80} ]'
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/success-codes: "200"
alb.ingress.kubernetes.io/tags: createdBy=aws-controller
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/unhealthy-threshold-count: "2"
alb.ingress.kubernetes.io/group.name: wormscan-group
alb.ingress.kubernetes.io/group.name: {{ .ALB_GROUP_NAME }}
alb.ingress.kubernetes.io/certificate-arn: {{ .ALB_SSL_CERT }}
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
external-dns.alpha.kubernetes.io/hostname: {{ .HOSTNAME }}
spec:
rules:
@ -34,4 +35,3 @@ spec:
name: {{ .NAME }}
port:
number: 80
{{ end }}

View File

@ -1,5 +1,3 @@
{{ if eq .ENVIRONMENT "production" }}
---
apiVersion: v1
kind: Service
@ -17,36 +15,6 @@ spec:
targetPort: {{ .PORT }}
name: {{ .NAME }}
protocol: TCP
{{ else }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .NAME }}
namespace: {{ .NAMESPACE }}
annotations:
external-dns.alpha.kubernetes.io/hostname: {{ .HOSTNAME }}
{{ if eq .ENVIRONMENT "test" }}
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .SSL_CERT }}
{{ end }}
labels:
app: {{ .NAME }}
spec:
type: LoadBalancer
selector:
app: {{ .NAME }}
ports:
- name: http
port: 80
targetPort: {{ .PORT }}
protocol: TCP
- name: https
port: 443
targetPort: {{ .PORT }}
protocol: TCP
{{ end }}
---
apiVersion: apps/v1
kind: Deployment
@ -111,7 +79,7 @@ spec:
- name: WORMSCAN_CACHE_ENABLED
value: "true"
- name: WORMSCAN_PPROF_ENABLED
value: {{ .WORMSCAN_PPROF_ENABLED }}
value: "{{ .WORMSCAN_PPROF_ENABLED }}"
resources:
limits:
memory: {{ .RESOURCES_LIMITS_MEMORY }}

View File

@ -12,4 +12,6 @@ WORMSCAN_RUNMODE=PRODUCTION
WORMSCAN_LOGLEVEL=INFO
WORMSCAN_P2PNETWORK=mainnet
WORMSCAN_PPROF_ENABLED=false
HOSTNAME=api.wormscan.io
HOSTNAME=api.wormscan.io
ALB_GROUP_NAME=wormscan-group
ALB_SSL_CERT=

View File

@ -12,4 +12,6 @@ WORMSCAN_RUNMODE=DEVELOPMENT
WORMSCAN_LOGLEVEL=INFO
WORMSCAN_P2PNETWORK=mainnet
WORMSCAN_PPROF_ENABLED=true
HOSTNAME=api.staging.wormscan.io
HOSTNAME=api.staging.wormscan.io
ALB_GROUP_NAME=wormscan-group-staging
ALB_SSL_CERT=

View File

@ -13,4 +13,5 @@ WORMSCAN_LOGLEVEL=INFO
WORMSCAN_P2PNETWORK=testnet
WORMSCAN_PPROF_ENABLED=false
HOSTNAME=api.testnet.wormscan.io
SSL_CERT=
ALB_GROUP_NAME=wormscan-group-test
ALB_SSL_CERT=

View File

@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .NAMESPACE }}
labels:
name: {{ .NAMESPACE }}

View File

@ -51,10 +51,8 @@ spec:
key: mongo-database
- name: P2P_NETWORK
value: {{ .P2P_NETWORK }}
- name: MAX_HEALTH_TIME_SECONDS
value: "{{ .MAX_HEALTH_TIME_SECONDS }}"
- name: PPROF_ENABLED
value: {{ .PPROF_ENABLED }}
value: "{{ .PPROF_ENABLED }}"
- name: SQS_URL
value: {{ .SQS_URL }}
- name: AWS_REGION

View File

@ -70,7 +70,7 @@ spec:
- name: PORT
value: "8000"
- name: PPROF_ENABLED
value: {{ .PPROF_ENABLED }}
value: "{{ .PPROF_ENABLED }}"
resources:
limits:
memory: {{ .RESOURCES_LIMITS_MEMORY }}