You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/SKILL.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,6 +174,7 @@ If validation fails, fix template/rules/examples first.
174
174
- MySQL cluster must follow upgraded structure (`kb.io/database: ac-mysql-8.0.30-1`, `clusterDefinitionRef: apecloud-mysql`, `clusterVersionRef: ac-mysql-8.0.30-1`, `tolerations: []`).
175
175
- Redis cluster must follow upgraded structure (`componentDef: redis-7`, `componentDef: redis-sentinel-7`, `serviceVersion: 7.2.7`, main data PVC `1Gi`, topology `replication`).
176
176
- Database cluster component resources must use `limits(cpu=500m,memory=512Mi)` and `requests(cpu=50m,memory=51Mi)` unless source docs explicitly require otherwise.
177
+
- All managed workload container resources must use the Sealos resource ladder: `limits.cpu` only `100m/200m/500m/1/2/3/4/8`, `limits.memory` only `128Mi/256Mi/512Mi/1024Mi/2G/4G/8G/16G`, and `requests` must be derived from `limits` by dropping the last numeric digit (`500m→50m`, `512Mi→51Mi`, `1→100m`, `1024Mi→102Mi`). Do not invent non-ladder values.
177
178
- Secret naming:
178
179
- MongoDB: `${{ defaults.app_name }}-mongo-mongodb-account-root` (or `${{ defaults.app_name }}-mongodb-mongodb-account-root` when the MongoDB cluster name uses `-mongodb`)
179
180
- Redis: `${{ defaults.app_name }}-redis-redis-account-default` (legacy `${{ defaults.app_name }}-redis-account-default` may be accepted for backward compatibility)
@@ -182,13 +183,33 @@ If validation fails, fix template/rules/examples first.
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/conversion-mappings.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -521,6 +521,8 @@ env:
521
521
522
522
## Resource Limits Mapping
523
523
524
+
Compose resource values must be normalized to the Sealos ladder. Use Compose limits only to choose the nearest allowed `limits` tier. Normalize 1G-class memory to `1024Mi`. Ignore Compose reservations for `requests`; Sealos `requests` are derived from the selected `limits` by dropping the last numeric digit, so `1024Mi` maps to `102Mi`.
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/frappe-bench.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,10 @@ Do not mix these models blindly. If a repo's `docker/docker-compose.yml` uses `f
17
17
18
18
- Database services from Compose (`mariadb`, `mysql`, `redis`) should follow the Sealos database strategy. Redis must use the KubeBlocks Redis `Cluster` and its generated Secret (`${{ defaults.app_name }}-redis-redis-account-default`) unless the user explicitly asks for raw containers.
19
19
- If using a prebuilt Frappe image with mounted `sites` and `logs` PVCs, set pod `securityContext.fsGroup: 1000` so the `frappe` user can write mounted volumes.
20
-
- Init containers that run `bench init`, `bench new-site`, `bench migrate`, or app install steps must set explicit resources. Do not rely on namespace defaults; `64Mi` memory is too small. Use at least:
- Init containers that run `bench init`, `bench new-site`, `bench migrate`, or app install steps must set explicit resources from the Sealos ladder. Do not rely on namespace defaults; `64Mi` memory is too small. Use at least:
Copy file name to clipboardExpand all lines: skills/docker-to-sealos/references/must-rules-map.yaml
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -236,6 +236,10 @@ must_rules:
236
236
enforcement:
237
237
type: rule
238
238
target: R019
239
+
- must: "All managed workload container resources must use the Sealos resource ladder: `limits.cpu` only `100m/200m/500m/1/2/3/4/8`, `limits.memory` only `128Mi/256Mi/512Mi/1024Mi/2G/4G/8G/16G`, and `requests` must be derived from `limits` by dropping the last numeric digit (`500m→50m`, `512Mi→51Mi`, `1→100m`, `1024Mi→102Mi`). Do not invent non-ladder values."
240
+
enforcement:
241
+
type: rule
242
+
target: R038
239
243
- must: "MongoDB: `${{ defaults.app_name }}-mongo-mongodb-account-root` (or `${{ defaults.app_name }}-mongodb-mongodb-account-root` when the MongoDB cluster name uses `-mongodb`)"
**Important: The resources field of all containers must include both requests and limits!**
906
+
**Important: The resources field of all containers must include both requests and limits.**
907
+
908
+
All containers in application Deployments or StatefulSets must use the fixed Sealos resource ladder. Do not invent intermediate values during template generation or resource tuning.
909
+
910
+
Allowed `limits.cpu` values use canonical Kubernetes quantities:
911
+
912
+
- `100m`(0.1 core)
913
+
- `200m`(0.2 core)
914
+
- `500m`(0.5 core)
915
+
- `1`
916
+
- `2`
917
+
- `3`
918
+
- `4`
919
+
- `8`
920
+
921
+
Allowed `limits.memory` values:
922
+
923
+
- `128Mi`
924
+
- `256Mi`
925
+
- `512Mi`
926
+
- `1024Mi`
927
+
- `2G`
928
+
- `4G`
929
+
- `8G`
930
+
- `16G`
931
+
932
+
`requests` must be derived from `limits` by dropping the last numeric digit:
933
+
934
+
| limits | requests |
935
+
|--------|----------|
936
+
| `cpu: 100m` | `cpu: 10m` |
937
+
| `cpu: 200m` | `cpu: 20m` |
938
+
| `cpu: 500m` | `cpu: 50m` |
939
+
| `cpu: 1` | `cpu: 100m` |
940
+
| `cpu: 2` | `cpu: 200m` |
941
+
| `cpu: 3` | `cpu: 300m` |
942
+
| `cpu: 4` | `cpu: 400m` |
943
+
| `cpu: 8` | `cpu: 800m` |
944
+
| `memory: 128Mi` | `memory: 12Mi` |
945
+
| `memory: 256Mi` | `memory: 25Mi` |
946
+
| `memory: 512Mi` | `memory: 51Mi` |
947
+
| `memory: 1024Mi` | `memory: 102Mi` |
948
+
| `memory: 2G` | `memory: 200Mi` |
949
+
| `memory: 4G` | `memory: 400Mi` |
950
+
| `memory: 8G` | `memory: 800Mi` |
951
+
| `memory: 16G` | `memory: 1600Mi` |
952
+
953
+
**Default lightweight application quota:**
907
954
908
-
All containers in application Deployments or StatefulSets must have resource quotas configured:
955
+
```yaml
956
+
resources:
957
+
requests:
958
+
cpu: 20m
959
+
memory: 25Mi
960
+
limits:
961
+
cpu: 200m
962
+
memory: 256Mi
963
+
```
964
+
965
+
**Standard backend or broker quota after validation:**
909
966
910
967
```yaml
911
-
containers:
912
-
- name: ${{ defaults.app_name }}
913
-
image: example/app:1.0.0
914
-
imagePullPolicy: IfNotPresent
915
-
resources:
916
-
requests:
917
-
cpu: 100m # Minimum CPU request (required)
918
-
memory: 128Mi # Minimum memory request (required)
919
-
limits:
920
-
cpu: 500m # CPU upper limit (required)
921
-
memory: 512Mi # Memory upper limit (required)
968
+
resources:
969
+
requests:
970
+
cpu: 50m
971
+
memory: 51Mi
972
+
limits:
973
+
cpu: 500m
974
+
memory: 512Mi
922
975
```
923
976
924
-
**Quota setting guidelines**:
925
-
926
-
1. **Lightweight frontend applications** (static file serving, simple web applications):
3. **Heavy-load applications** (AI processing, video processing, big data processing):
949
-
```yaml
950
-
resources:
951
-
requests:
952
-
cpu: 500m
953
-
memory: 512Mi
954
-
limits:
955
-
cpu: 2000m
956
-
memory: 2Gi
957
-
```
958
-
959
-
4. **AI/Machine Learning applications** (requiring GPU or large computational resources):
960
-
```yaml
961
-
resources:
962
-
requests:
963
-
cpu: 1000m
964
-
memory: 1Gi
965
-
limits:
966
-
cpu: 4000m
967
-
memory: 4Gi
968
-
```
969
-
970
-
**Quota setting explanation**:
971
-
972
-
- **requests (request values)**: The minimum resources guaranteed for the container
973
-
- CPU uses `m` units (1000m = 1 CPU core)
974
-
- Memory uses `Mi` or `Gi` units
975
-
- Recommendation: Set requests to 70-80% of actual usage
976
-
977
-
- **limits (limit values)**: The maximum resources the container can use
978
-
- CPU can burst up to the limit value
979
-
- Memory exceeding the limit will trigger OOM Kill
980
-
- Recommendation: Set limits to 2-4 times the requests
981
-
982
-
**Golden rules for quota settings**:
983
-
984
-
1. **Always set both requests and limits**
985
-
- Incorrect: Setting only requests may lead to resource starvation
986
-
- Incorrect: Setting only limits may cause scheduling failures
987
-
- Correct: Setting both guarantees performance and stability
988
-
989
-
2. **Reasonable requests/limits ratio**
990
-
- CPU: limits can be 2-10 times the requests (CPU is compressible)
991
-
- Memory: limits should be 1.5-2 times the requests (memory is incompressible)
992
-
993
-
3. **Adjust based on application type**
994
-
- Compute-intensive: Increase CPU quota
995
-
- Memory-intensive: Increase memory quota
996
-
- I/O-intensive: Balance CPU and memory
997
-
998
-
4. **Monitor and adjust**
999
-
- Use conservative quotas for initial deployment
1000
-
- Monitor actual resource usage
1001
-
- Dynamically adjust based on monitoring data
1002
-
1003
-
**Comparison examples**:
977
+
**Heavy workload quota:**
1004
978
1005
979
```yaml
1006
-
# Incorrect: No resource limits
1007
-
containers:
1008
-
- name: app
1009
-
image: app:1.0.0
1010
-
imagePullPolicy: IfNotPresent
1011
-
1012
-
# Incorrect: Only requests
1013
-
containers:
1014
-
- name: app
1015
-
image: app:1.0.0
1016
-
imagePullPolicy: IfNotPresent
1017
-
resources:
1018
-
requests:
1019
-
cpu: 100m
1020
-
memory: 128Mi
1021
-
1022
-
# Incorrect: Only limits
1023
-
containers:
1024
-
- name: app
1025
-
image: app:1.0.0
1026
-
imagePullPolicy: IfNotPresent
1027
-
resources:
1028
-
limits:
1029
-
cpu: 500m
1030
-
memory: 512Mi
1031
-
1032
-
# Correct: Both requests and limits are present
1033
-
containers:
1034
-
- name: app
1035
-
image: app:1.0.0
1036
-
imagePullPolicy: IfNotPresent
1037
-
resources:
1038
-
requests:
1039
-
cpu: 100m
1040
-
memory: 128Mi
1041
-
limits:
1042
-
cpu: 500m
1043
-
memory: 512Mi
980
+
resources:
981
+
requests:
982
+
cpu: 200m
983
+
memory: 200Mi
984
+
limits:
985
+
cpu: 2
986
+
memory: 2G
1044
987
```
1045
988
989
+
**Invalid examples:**
990
+
991
+
```yaml
992
+
# Incorrect: non-ladder values
993
+
resources:
994
+
requests:
995
+
cpu: 30m
996
+
memory: 160Mi
997
+
limits:
998
+
cpu: 300m
999
+
memory: 384Mi
1000
+
1001
+
# Incorrect: requests copied from old ratio guidance instead of deriving from limits
1002
+
resources:
1003
+
requests:
1004
+
cpu: 100m
1005
+
memory: 256Mi
1006
+
limits:
1007
+
cpu: 1
1008
+
memory: 1024Mi
1009
+
1010
+
# Incorrect: decimal G form is not the canonical 1G-class ladder value
1011
+
resources:
1012
+
requests:
1013
+
cpu: 100m
1014
+
memory: 100Mi
1015
+
limits:
1016
+
cpu: 1
1017
+
memory: 1G
1018
+
```
1019
+
1020
+
**Tuning guidance:**
1021
+
1022
+
1. Move only between allowed `limits` ladder values.
1023
+
2. Recompute `requests` from the selected `limits`; do not preserve old requests.
1024
+
3. If a StatefulSet fails readiness at a lower resource tier, recreate or cleanly roll the Pod before testing the next tier so a stale non-ready Pod is not mistaken for the next tier's result.
1025
+
4. Choose the lowest tier that becomes Ready and passes application-level probes.
0 commit comments