Skip to content

Commit

Permalink
feat: add resource management resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Dec 10, 2024
1 parent 667eb57 commit 43b3b4e
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drydock/patches/kustomization-resources
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
- plugins/drydock/k8s/debug/services.yml
- plugins/drydock/k8s/debug/ingress.yml
{%- endif %}
{% if DRYDOCK_RESOURCE_MANAGEMENT -%}
- plugins/drydock/k8s/resources/limits.yml
{%- endif %}
1 change: 1 addition & 0 deletions drydock/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def get_sync_waves_for_resource(resource_name: str) -> SYNC_WAVES_ORDER_ATTRS_TY
"superset-celery-beat",
],
"NGINX_STATIC_CACHE_CONFIG": {},
"RESOURCE_MANAGEMENT": False,
},
# Add here settings that don't have a reasonable default for all users. For
# instance: passwords, secret keys, etc.
Expand Down
70 changes: 70 additions & 0 deletions drydock/templates/drydock/k8s/resources/limits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-resources
spec:
hard:
requests.cpu: "8"
requests.memory: 16Gi
limits.cpu: "16"
limits.memory: 32Gi
---
apiVersion: v1
kind: ResourceQuota
metadata:
name: object-counts
spec:
hard:
pods: "30"
---
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-resource-constraint
spec:
limits:
- default: # this section defines default limits
cpu: 1000m
defaultRequest: # this section defines default requests
cpu: 100m
max: # max and min define the limit range
cpu: "2"
type: Container
---
apiVersion: v1
kind: LimitRange
metadata:
name: memory-resource-constraint
spec:
limits:
- default: # this section defines default limits
memory: 512Mi
defaultRequest: # this section defines default requests
memory: 256Mi
max: # max and min define the limit range
memory: 4Gi
type: Container
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-intranamespace-traffic
spec:
podSelector:
matchLabels:
app.kubernetes.io/instance: openedx-{{ ID }}
ingress:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/instance: openedx-{{ ID }}
egress:
- to:
- podSelector:
matchLabels:
app.kubernetes.io/instance: openedx-{{ ID }}
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: shipyard-harmony

0 comments on commit 43b3b4e

Please sign in to comment.