feat: initial commit

This commit is contained in:
2022-10-09 15:23:52 +02:00
commit a1b4d4fc27
39 changed files with 5810 additions and 0 deletions
View File
+20
View File
@@ -0,0 +1,20 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
labels:
app: schemas
name: schemas
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: schemas
minReplicas: 2
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
+81
View File
@@ -0,0 +1,81 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: schemas
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: schemas
name: schemas
annotations:
kubernetes.io/change-cause: "${TIMESTAMP} Deployed commit id: ${COMMIT}"
spec:
replicas: 1
selector:
matchLabels:
app: schemas
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: schemas
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- schemas
topologyKey: kubernetes.io/hostname
containers:
- name: schemas
resources:
limits:
memory: "100Mi"
requests:
memory: "100Mi"
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
imagePullPolicy: IfNotPresent
image: registry.gitlab.com/unboundsoftware/schemas:${COMMIT}
ports:
- name: api
containerPort: 8080
envFrom:
- secretRef:
name: schemas
- secretRef:
name: rabbitmq
restartPolicy: Always
serviceAccountName: schemas
---
apiVersion: v1
kind: Service
metadata:
name: schemas
spec:
ports:
- port: 80
name: api
protocol: TCP
targetPort: 8080
selector:
app: schemas
type: NodePort
+19
View File
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: schemas-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/enable-cors: "true"
spec:
rules:
- host: "local-schemas.unbound.se"
http:
paths:
- path: /query
pathType: ImplementationSpecific
backend:
service:
name: schemas
port:
number: 80
+23
View File
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: schemas-ingress
annotations:
kubernetes.io/ingress.class: "alb"
alb.ingress.kubernetes.io/group.name: "unbound"
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80},{"HTTPS": 443}]'
alb.ingress.kubernetes.io/ssl-redirect: "443"
spec:
rules:
- host: "schemas.unbound.se"
http:
paths:
- path: /query
pathType: ImplementationSpecific
backend:
service:
name: schemas
port:
name: api
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: schemas
stringData:
API_KEY: supersecret123!
POSTGRES_URL: "postgres://postgres:postgres@postgres:5432/schemas?sslmode=disable"
+21
View File
@@ -0,0 +1,21 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: schemas
namespace: default
spec:
refreshInterval: 1h
secretStoreRef:
name: external-secrets
kind: ClusterSecretStore
target:
creationPolicy: Owner
template:
data:
POSTGRES_URL: "postgres://{{ .DB_USERNAME }}:{{ .DB_PASSWORD }}@{{ .DB_HOST }}:{{ .DB_PORT }}/schemas?sslmode=disable"
API_KEY: "{{ .API_KEY }}"
dataFrom:
- extract:
key: services/schemas
- extract:
key: rds/postgres/prod-psql