Primeiro commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
NAMESPACE="${NAMESPACE:-ci-cd}"
|
||||
SECRET_NAME="${SECRET_NAME:-sla-separacao-env}"
|
||||
|
||||
: "${DB_HOST:?DB_HOST is required}"
|
||||
: "${DB_PORT:?DB_PORT is required}"
|
||||
: "${DB_NAME:?DB_NAME is required}"
|
||||
: "${DB_USER:?DB_USER is required}"
|
||||
: "${DB_PASSWORD:?DB_PASSWORD is required}"
|
||||
: "${DB_ENCRYPT:?DB_ENCRYPT is required}"
|
||||
: "${DB_TRUST_SERVER_CERT:?DB_TRUST_SERVER_CERT is required}"
|
||||
: "${DB_SERVER_NAME:?DB_SERVER_NAME is required}"
|
||||
: "${SESSION_SECRET:?SESSION_SECRET is required}"
|
||||
|
||||
kubectl create secret generic "${SECRET_NAME}" \
|
||||
--namespace "${NAMESPACE}" \
|
||||
--from-literal=DB_HOST="${DB_HOST}" \
|
||||
--from-literal=DB_PORT="${DB_PORT}" \
|
||||
--from-literal=DB_NAME="${DB_NAME}" \
|
||||
--from-literal=DB_USER="${DB_USER}" \
|
||||
--from-literal=DB_PASSWORD="${DB_PASSWORD}" \
|
||||
--from-literal=DB_ENCRYPT="${DB_ENCRYPT}" \
|
||||
--from-literal=DB_TRUST_SERVER_CERT="${DB_TRUST_SERVER_CERT}" \
|
||||
--from-literal=DB_SERVER_NAME="${DB_SERVER_NAME}" \
|
||||
--from-literal=SESSION_SECRET="${SESSION_SECRET}" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
echo "Secret ${SECRET_NAME} aplicado no namespace ${NAMESPACE}."
|
||||
@@ -0,0 +1,66 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sla-separacao-deployment
|
||||
namespace: ci-cd
|
||||
labels:
|
||||
app: sla-separacao
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sla-separacao
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sla-separacao
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: 10.77.77.41:5000/slalog/sla-separacao:IMAGE_TAG
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: sla-separacao-env
|
||||
env:
|
||||
- name: PORT
|
||||
value: "8000"
|
||||
- name: HOST
|
||||
value: "0.0.0.0"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 300m
|
||||
memory: 512Mi
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8000
|
||||
failureThreshold: 30
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8000
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: sla-separacao-hpa
|
||||
namespace: ci-cd
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: sla-separacao-deployment
|
||||
minReplicas: 1
|
||||
maxReplicas: 3
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 70
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: sla-separacao-env
|
||||
namespace: ci-cd
|
||||
type: Opaque
|
||||
stringData:
|
||||
DB_HOST: "10.77.77.10"
|
||||
DB_PORT: "1433"
|
||||
DB_NAME: "GINSENG"
|
||||
DB_USER: "suprimentos"
|
||||
DB_PASSWORD: "trocar-antes-de-aplicar"
|
||||
DB_ENCRYPT: "true"
|
||||
DB_TRUST_SERVER_CERT: "true"
|
||||
DB_SERVER_NAME: "sqlserver.local"
|
||||
SESSION_SECRET: "trocar-por-um-segredo-longo-com-32-caracteres-ou-mais"
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sla-separacao-service
|
||||
namespace: ci-cd
|
||||
labels:
|
||||
app: sla-separacao
|
||||
spec:
|
||||
selector:
|
||||
app: sla-separacao
|
||||
type: NodePort
|
||||
sessionAffinity: ClientIP
|
||||
sessionAffinityConfig:
|
||||
clientIP:
|
||||
timeoutSeconds: 3600
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
nodePort: 30310
|
||||
Reference in New Issue
Block a user