Skip to content

Commit c19f470

Browse files
committed
Remove user-facing config of limits and requests
This patch introduces reusable library charts that provide backward-compatibility for users that specify their resources as explicit requests and limits for cpu, however this input is processed so that limits are set equal to requests except for CPU which only gets requests. Users can now embrace the new form by directly specifying resources in the first level of nesting (e.g. resources.cpu=100m instead of .resources.requests.cpu=100m). The order of precedence is top-level, then requests, then limits, ensuring that nothing will break in terms of scheduling, however workloads that specified limits much higher than requests might get a performance hit, now that they cannot use all this excess capacity. This should only affect memory-hungry workloads in low-contention environments. Signed-off-by: Timofei Larkin <[email protected]>
1 parent db34f31 commit c19f470

16 files changed

Lines changed: 202 additions & 10 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ build: build-deps
2828

2929
repos:
3030
rm -rf _out
31+
make -C packages/library check-version-map
3132
make -C packages/apps check-version-map
3233
make -C packages/extra check-version-map
34+
make -C packages/library repo
3335
make -C packages/system repo
3436
make -C packages/apps repo
3537
make -C packages/extra repo

‎packages/apps/Makefile‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
OUT=../../_out/repos/apps
2-
TMP=../../_out/repos/apps/historical
2+
TMP := $(shell mktemp -d)
33

44
repo:
55
rm -rf "$(OUT)"
66
mkdir -p "$(OUT)"
7-
awk '$$3 != "HEAD" {print "mkdir -p $(TMP)/" $$1 "-" $$2}' versions_map | sh -ex
8-
awk '$$3 != "HEAD" {print "git archive " $$3 " " $$1 " | tar -xf- --strip-components=1 -C $(TMP)/" $$1 "-" $$2 }' versions_map | sh -ex
9-
helm package -d "$(OUT)" $$(find . $(TMP) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V)
10-
cd "$(OUT)" && helm repo index . --url http://cozystack.cozy-system.svc/repos/apps
11-
rm -rf "$(TMP)"
7+
cd .. && cat apps/versions_map2 | while read package version commit ; \
8+
do \
9+
if git ls-tree --name-only $${commit} library | grep -qx library ; \
10+
then \
11+
git archive --format tar $${commit} apps/$${package} library | tar -xf- -C $(TMP)/ ; \
12+
else \
13+
git archive --format tar $${commit} apps/$${package} | tar -xf- -C $(TMP)/ ; \
14+
fi ; \
15+
helm package $(TMP)/apps/$${package} -d apps/$(OUT) ; \
16+
rm -rf $(TMP)/apps/$${package} $(TMP)/library ; \
17+
done
1218

1319
fix-chartnames:
1420
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done

‎packages/apps/clickhouse/Chart.yaml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 0.8.0
19+
version: 0.9.0
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to
2323
# follow Semantic Versioning. They should reflect the version the application is using.
2424
# It is recommended to use it with quotes.
2525
appVersion: "24.9.2"
26+
27+
dependencies:
28+
- name: cozy-lib
29+
version: 0.1.0
30+
repository: "http://cozystack.cozy-system.svc/repos/library"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../library/cozy-lib

‎packages/apps/clickhouse/templates/clickhouse.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ spec:
122122
- name: clickhouse
123123
image: clickhouse/clickhouse-server:24.9.2.42
124124
{{- if .Values.resources }}
125-
resources: {{- toYaml .Values.resources | nindent 16 }}
125+
resources: {{- include "cozy-lib.resources.sanitize" .Values.resources | nindent 16 }}
126126
{{- else if ne .Values.resourcesPreset "none" }}
127-
resources: {{- include "resources.preset" (dict "type" .Values.resourcesPreset "Release" .Release) | nindent 16 }}
127+
resources: {{- include "cozy-lib.resources.preset" .Values.resourcesPreset | nindent 16 }}
128128
{{- end }}
129129
volumeMounts:
130130
- name: data-volume-template

‎packages/apps/versions_map‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ clickhouse 0.6.0 1ec10165
99
clickhouse 0.6.1 c62a83a7
1010
clickhouse 0.6.2 8267072d
1111
clickhouse 0.7.0 93bdf411
12-
clickhouse 0.8.0 HEAD
12+
clickhouse 0.9.0 HEAD
1313
ferretdb 0.1.0 e9716091
1414
ferretdb 0.1.1 91b0499a
1515
ferretdb 0.2.0 6c5cf5bf

‎packages/library/Makefile‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
OUT=../../_out/repos/library
2+
TMP := $(shell mktemp -d)
3+
4+
repo:
5+
rm -rf "$(OUT)"
6+
mkdir -p "$(OUT)"
7+
cd .. && cat library/versions_map | while read package version commit ; \
8+
do git archive --format tar $${commit} library/$${package} | tar -xf- -C $(TMP)/ ; \
9+
helm package $(TMP)/library/$${package} -d $(OUT) ; \
10+
rm -rf $(TMP)/library/$${package} ; \
11+
done
12+
13+
fix-chartnames:
14+
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
15+
16+
gen-versions-map: fix-chartnames
17+
../../hack/gen_versions_map.sh
18+
19+
check-version-map: gen-versions-map
20+
git diff --exit-code -- versions_map
21+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v2
2+
name: cozy-lib
3+
description: Common Cozystack templates
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: library
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0

‎packages/library/cozy-lib/Makefile‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include ../../../scripts/common-envs.mk
2+
include ../../../scripts/package.mk
3+
4+
generate:
5+
readme-generator -v values.yaml -s values.schema.json -r README.md
6+

0 commit comments

Comments
 (0)