Skip to content

Commit

Permalink
feat: remove resource constraints and autoscaling
Browse files Browse the repository at this point in the history
You can have the same features by using the
eduNEXT/tutor-contrib-pod-autoscaling
  • Loading branch information
igobranco committed Feb 5, 2025
1 parent 4094b09 commit e66156d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 68 deletions.
45 changes: 0 additions & 45 deletions tutorprint_course_certificates/patches/k8s-deployments
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ spec:
name: print-course-certificates
ports:
- containerPort: {{ PRINT_COURSE_CERTIFICATES_PORT }}
resources:
requests:
memory: {{ PRINT_COURSE_CERTIFICATES_MEMORY_REQUEST }}
{%- if PRINT_COURSE_CERTIFICATES_CPU_REQUEST is defined %}
cpu: {{ PRINT_COURSE_CERTIFICATES_CPU_REQUEST }}
{%- endif %}
limits:
memory: {{ PRINT_COURSE_CERTIFICATES_MEMORY_LIMIT }}
{%- if PRINT_COURSE_CERTIFICATES_CPU_LIMIT is defined %}
cpu: {{ PRINT_COURSE_CERTIFICATES_CPU_LIMIT }}
{%- endif %}
volumeMounts:
- mountPath: /app/config.yml
name: config
Expand All @@ -59,38 +48,4 @@ spec:
name: print-course-certificates-digital-signature-file-p12
{% endif %}

{% if PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING %}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: print-course-certificates-hpa
labels:
app.kubernetes.io/name: print-course-certificates-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: print-course-certificates
minReplicas: {{ PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_MIN_REPLICAS }}
maxReplicas: {{ PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_MAX_REPLICAS }}
metrics:
{%- if PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_CPU > 0 %}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_CPU }}
{%- endif %}
{%- if PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_MEMORY|length %}
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: {{ PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_MEMORY }}
{%- endif %}
{% endif %}

{% endif %}
23 changes: 0 additions & 23 deletions tutorprint_course_certificates/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,6 @@
("PRINT_COURSE_CERTIFICATES_PORT", 5000),
("PRINT_COURSE_CERTIFICATES_CERTIFICATE_P12_PATH", None),
("PRINT_COURSE_CERTIFICATES_CONFIG", {"some": "value"}),
# Resource constraints
(
"PRINT_COURSE_CERTIFICATES_MEMORY_REQUEST",
"{{ PRINT_COURSE_CERTIFICATES_UWSGI_WORKERS * 100 }}Mi",
),
(
"PRINT_COURSE_CERTIFICATES_MEMORY_LIMIT",
"{{ PRINT_COURSE_CERTIFICATES_UWSGI_WORKERS * 200 }}Mi",
),
(
"PRINT_COURSE_CERTIFICATES_CPU_REQUEST",
"{{ ( PRINT_COURSE_CERTIFICATES_UWSGI_WORKERS / 2 * 1000) | round | int }}m",
),
(
"PRINT_COURSE_CERTIFICATES_CPU_LIMIT",
"{{ ( PRINT_COURSE_CERTIFICATES_UWSGI_WORKERS * 1000 ) | round | int }}m",
),
# Kubernetes HPA autoscaling settings
("PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING", True),
("PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_MIN_REPLICAS", 1),
("PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_MAX_REPLICAS", 1),
("PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_CPU", 80),
("PRINT_COURSE_CERTIFICATES_POD_AUTOSCALING_AVG_MEMORY", ""),
]
)

Expand Down

0 comments on commit e66156d

Please sign in to comment.