This commit is contained in:
2023-05-20 11:28:54 -05:00
parent 82193797f9
commit 3f812bd1ce
4 changed files with 42 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ spec:
selector: selector:
matchLabels: matchLabels:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
replicas: {{ .Values.deployment.replicas }} replicas: {{ .Values.deployment.hpa.minReplicas }}
template: template:
metadata: metadata:
labels: labels:
@@ -25,3 +25,9 @@ spec:
envFrom: envFrom:
- secretRef: - secretRef:
name: {{ .Values.deployment.secretfile }} name: {{ .Values.deployment.secretfile }}
resources:
requests:
memory: {{ .Values.deployment.resources.requests.cpu }}
cpu: {{ .Values.deployment.resources.requests.memory }}
limits:
memory: {{ .Values.deployment.resources.limits.memory }}

View File

@@ -0,0 +1,24 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Chart.Name }}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: ctix
minReplicas: {{ .Values.deployment.hpa.minReplicas }}
maxReplicas: {{ .Values.deployment.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 40

View File

@@ -1,9 +1,17 @@
deployment: deployment:
replicas: 1
image: registry.gitlab.com/developerdurp/durpapi image: registry.gitlab.com/developerdurp/durpapi
tag: "" tag: ""
imagePullPolicy: Always imagePullPolicy: Always
secretfile: durpapi-secret secretfile: durpapi-secret
hpa:
minReplicas: 3
maxReplicas: 10
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
memory: "150Mi"
ingress: ingress:
clusterissuer: letsencrypt-production clusterissuer: letsencrypt-production

View File

@@ -86,7 +86,7 @@ func authMiddleware(allowedGroups []string) gin.HandlerFunc {
if !isAllowed { if !isAllowed {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{ c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{
"message": "Unauthorized access", "message": "Unauthorized access",
"groups": groupsHeader, "groups": allowedGroups,
}) })
return return
} }