Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resource management resources #151

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "20"
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
Loading