mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-02-05 08:17:59 +00:00
Compare commits
5 Commits
bats
...
kubernetes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b193bd96d4 | ||
|
|
13938f34fd | ||
|
|
9fb6b41e03 | ||
|
|
a8ba6b1328 | ||
|
|
9592f7fe46 |
2
Makefile
2
Makefile
@@ -29,8 +29,10 @@ build: build-deps
|
|||||||
|
|
||||||
repos:
|
repos:
|
||||||
rm -rf _out
|
rm -rf _out
|
||||||
|
make -C packages/library check-version-map
|
||||||
make -C packages/apps check-version-map
|
make -C packages/apps check-version-map
|
||||||
make -C packages/extra check-version-map
|
make -C packages/extra check-version-map
|
||||||
|
make -C packages/library repo
|
||||||
make -C packages/system repo
|
make -C packages/system repo
|
||||||
make -C packages/apps repo
|
make -C packages/apps repo
|
||||||
make -C packages/extra repo
|
make -C packages/extra repo
|
||||||
|
|||||||
@@ -16,13 +16,15 @@ if [ ! -f "$file" ] || [ ! -s "$file" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
miss_map=$(echo "$new_map" | awk 'NR==FNR { nm[$1 " " $2] = $3; next } { if (!($1 " " $2 in nm)) print $1, $2, $3}' - "$file")
|
miss_map=$(mktemp)
|
||||||
|
trap 'rm -f "$miss_map"' EXIT
|
||||||
|
echo -n "$new_map" | awk 'NR==FNR { nm[$1 " " $2] = $3; next } { if (!($1 " " $2 in nm)) print $1, $2, $3}' - "$file" > $miss_map
|
||||||
|
|
||||||
# search accross all tags sorted by version
|
# search accross all tags sorted by version
|
||||||
search_commits=$(git ls-remote --tags origin | awk -F/ '$3 ~ /v[0-9]+.[0-9]+.[0-9]+/ {print}' | sort -k2,2 -rV | awk '{print $1}')
|
search_commits=$(git ls-remote --tags origin | awk -F/ '$3 ~ /v[0-9]+.[0-9]+.[0-9]+/ {print}' | sort -k2,2 -rV | awk '{print $1}')
|
||||||
|
|
||||||
resolved_miss_map=$(
|
resolved_miss_map=$(
|
||||||
echo "$miss_map" | while read -r chart version commit; do
|
while read -r chart version commit; do
|
||||||
# if version is found in HEAD, it's HEAD
|
# if version is found in HEAD, it's HEAD
|
||||||
if [ "$(awk '$1 == "version:" {print $2}' ./${chart}/Chart.yaml)" = "${version}" ]; then
|
if [ "$(awk '$1 == "version:" {print $2}' ./${chart}/Chart.yaml)" = "${version}" ]; then
|
||||||
echo "$chart $version HEAD"
|
echo "$chart $version HEAD"
|
||||||
@@ -56,7 +58,7 @@ resolved_miss_map=$(
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$chart $version $found_tag"
|
echo "$chart $version $found_tag"
|
||||||
done
|
done < $miss_map
|
||||||
)
|
)
|
||||||
|
|
||||||
printf "%s\n" "$new_map" "$resolved_miss_map" | sort -k1,1 -k2,2 -V | awk '$1' > "$file"
|
printf "%s\n" "$new_map" "$resolved_miss_map" | sort -k1,1 -k2,2 -V | awk '$1' > "$file"
|
||||||
|
|||||||
65
hack/package_chart.sh
Executable file
65
hack/package_chart.sh
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf "%s\n" "Usage:" >&2 ;
|
||||||
|
printf -- "%s\n" '---' >&2 ;
|
||||||
|
printf "%s %s\n" "$0" "INPUT_DIR OUTPUT_DIR TMP_DIR [DEPENDENCY_DIR]" >&2 ;
|
||||||
|
printf -- "%s\n" '---' >&2 ;
|
||||||
|
printf "%s\n" "Takes a helm repository from INPUT_DIR, with an optional library repository in" >&2 ;
|
||||||
|
printf "%s\n" "DEPENDENCY_DIR, prepares a view of the git archive at select points in history" >&2 ;
|
||||||
|
printf "%s\n" "in TMP_DIR and packages helm charts, outputting the tarballs to OUTPUT_DIR" >&2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "x$(basename $PWD)" != "xpackages" ]
|
||||||
|
then
|
||||||
|
echo "Error: This script must run from the ./packages/ directory" >&2
|
||||||
|
echo >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x$#" != "x3" ] && [ "x$#" != "x4" ]
|
||||||
|
then
|
||||||
|
echo "Error: This script takes 3 or 4 arguments" >&2
|
||||||
|
echo "Got $# arguments:" "$@" >&2
|
||||||
|
echo >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
input_dir=$1
|
||||||
|
output_dir=$2
|
||||||
|
tmp_dir=$3
|
||||||
|
|
||||||
|
if [ "x$#" = "x4" ]
|
||||||
|
then
|
||||||
|
dependency_dir=$4
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "${output_dir:?}"
|
||||||
|
mkdir -p "${output_dir}"
|
||||||
|
while read package _ commit
|
||||||
|
do
|
||||||
|
# this lets devs build the packages from a dirty repo for quick local testing
|
||||||
|
if [ "x$commit" = "xHEAD" ]
|
||||||
|
then
|
||||||
|
helm package "${input_dir}/${package}" -d "${output_dir}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
git archive --format tar "${commit}" "${input_dir}/${package}" | tar -xf- -C "${tmp_dir}/"
|
||||||
|
|
||||||
|
# the library chart is not present in older commits and git archive doesn't fail gracefully if the path is not found
|
||||||
|
if [ "x${dependency_dir}" != "x" ] && git ls-tree --name-only "${commit}" "${dependency_dir}" | grep -qx "${dependency_dir}"
|
||||||
|
then
|
||||||
|
git archive --format tar "${commit}" "${dependency_dir}" | tar -xf- -C "${tmp_dir}/"
|
||||||
|
fi
|
||||||
|
helm package "${tmp_dir}/${input_dir}/${package}" -d "${output_dir}"
|
||||||
|
rm -rf "${tmp_dir:?}/${input_dir:?}/${package:?}"
|
||||||
|
if [ "x${dependency_dir}" != "x" ]
|
||||||
|
then
|
||||||
|
rm -rf "${tmp_dir:?}/${dependency_dir:?}"
|
||||||
|
fi
|
||||||
|
done < "${input_dir}/versions_map"
|
||||||
|
helm repo index "${output_dir}"
|
||||||
@@ -1,14 +1,8 @@
|
|||||||
OUT=../../_out/repos/apps
|
OUT=../_out/repos/apps
|
||||||
TMP=../../_out/repos/apps/historical
|
TMP := $(shell mktemp -d)
|
||||||
|
|
||||||
repo:
|
repo:
|
||||||
rm -rf "$(OUT)"
|
cd .. && ../hack/package_chart.sh apps $(OUT) $(TMP) library
|
||||||
mkdir -p "$(OUT)"
|
|
||||||
awk '$$3 != "HEAD" {print "mkdir -p $(TMP)/" $$1 "-" $$2}' versions_map | sh -ex
|
|
||||||
awk '$$3 != "HEAD" {print "git archive " $$3 " " $$1 " | tar -xf- --strip-components=1 -C $(TMP)/" $$1 "-" $$2 }' versions_map | sh -ex
|
|
||||||
helm package -d "$(OUT)" $$(find . $(TMP) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V)
|
|
||||||
cd "$(OUT)" && helm repo index . --url http://cozystack.cozy-system.svc/repos/apps
|
|
||||||
rm -rf "$(TMP)"
|
|
||||||
|
|
||||||
fix-chartnames:
|
fix-chartnames:
|
||||||
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
|
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.8.0
|
version: 0.9.0
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
|||||||
1
packages/apps/clickhouse/charts/cozy-lib
Symbolic link
1
packages/apps/clickhouse/charts/cozy-lib
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../library/cozy-lib
|
||||||
@@ -122,9 +122,9 @@ spec:
|
|||||||
- name: clickhouse
|
- name: clickhouse
|
||||||
image: clickhouse/clickhouse-server:24.9.2.42
|
image: clickhouse/clickhouse-server:24.9.2.42
|
||||||
{{- if .Values.resources }}
|
{{- if .Values.resources }}
|
||||||
resources: {{- toYaml .Values.resources | nindent 16 }}
|
resources: {{- include "cozy-lib.resources.sanitize" .Values.resources | nindent 16 }}
|
||||||
{{- else if ne .Values.resourcesPreset "none" }}
|
{{- else if ne .Values.resourcesPreset "none" }}
|
||||||
resources: {{- include "resources.preset" (dict "type" .Values.resourcesPreset "Release" .Release) | nindent 16 }}
|
resources: {{- include "cozy-lib.resources.preset" .Values.resourcesPreset | nindent 16 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data-volume-template
|
- name: data-volume-template
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
.helmignore
|
.helmignore
|
||||||
/logos
|
/logos
|
||||||
/Makefile
|
/Makefile
|
||||||
|
/hack
|
||||||
|
|||||||
90
packages/apps/kubernetes/hack/test.bats
Normal file
90
packages/apps/kubernetes/hack/test.bats
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
@test "Create a tenant with isolated mode enabled" {
|
||||||
|
kubectl create -f - <<EOF
|
||||||
|
apiVersion: apps.cozystack.io/v1alpha1
|
||||||
|
kind: Tenant
|
||||||
|
metadata:
|
||||||
|
name: test4kubernetes
|
||||||
|
namespace: tenant-root
|
||||||
|
spec:
|
||||||
|
etcd: false
|
||||||
|
host: ""
|
||||||
|
ingress: false
|
||||||
|
isolated: true
|
||||||
|
monitoring: false
|
||||||
|
resourceQuotas: {}
|
||||||
|
seaweedfs: false
|
||||||
|
EOF
|
||||||
|
kubectl wait namespace tenant-test4kubernetes --timeout=20s --for=jsonpath='{.status.phase}'=Active
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "Create a tenant Kubernetes control plane" {
|
||||||
|
kubectl create -f - <<EOF
|
||||||
|
apiVersion: apps.cozystack.io/v1alpha1
|
||||||
|
kind: Kubernetes
|
||||||
|
metadata:
|
||||||
|
name: test
|
||||||
|
namespace: tenant-test4kubernetes
|
||||||
|
spec:
|
||||||
|
addons:
|
||||||
|
certManager:
|
||||||
|
enabled: false
|
||||||
|
valuesOverride: {}
|
||||||
|
cilium:
|
||||||
|
valuesOverride: {}
|
||||||
|
fluxcd:
|
||||||
|
enabled: false
|
||||||
|
valuesOverride: {}
|
||||||
|
gatewayAPI:
|
||||||
|
enabled: false
|
||||||
|
gpuOperator:
|
||||||
|
enabled: false
|
||||||
|
valuesOverride: {}
|
||||||
|
ingressNginx:
|
||||||
|
enabled: true
|
||||||
|
hosts: []
|
||||||
|
valuesOverride: {}
|
||||||
|
monitoringAgents:
|
||||||
|
enabled: false
|
||||||
|
valuesOverride: {}
|
||||||
|
verticalPodAutoscaler:
|
||||||
|
valuesOverride: {}
|
||||||
|
controlPlane:
|
||||||
|
apiServer:
|
||||||
|
resources: {}
|
||||||
|
resourcesPreset: small
|
||||||
|
controllerManager:
|
||||||
|
resources: {}
|
||||||
|
resourcesPreset: micro
|
||||||
|
konnectivity:
|
||||||
|
server:
|
||||||
|
resources: {}
|
||||||
|
resourcesPreset: micro
|
||||||
|
replicas: 2
|
||||||
|
scheduler:
|
||||||
|
resources: {}
|
||||||
|
resourcesPreset: micro
|
||||||
|
host: ""
|
||||||
|
nodeGroups:
|
||||||
|
md0:
|
||||||
|
ephemeralStorage: 20Gi
|
||||||
|
gpus: []
|
||||||
|
instanceType: u1.medium
|
||||||
|
maxReplicas: 10
|
||||||
|
minReplicas: 0
|
||||||
|
resources:
|
||||||
|
cpu: ""
|
||||||
|
memory: ""
|
||||||
|
roles:
|
||||||
|
- ingress-nginx
|
||||||
|
storageClass: replicated
|
||||||
|
EOF
|
||||||
|
kubectl wait namespace tenant-test4kubernetes --timeout=20s --for=jsonpath='{.status.phase}'=Active
|
||||||
|
timeout 10 sh -ec 'until kubectl get kamajicontrolplane -n tenant-test4kubernetes kubernetes-test; do sleep 1; done'
|
||||||
|
kubectl wait --for=condition=TenantControlPlaneCreated kamajicontrolplane -n tenant-test4kubernetes kubernetes-test --timeout=4m
|
||||||
|
kubectl wait tcp -n tenant-test4kubernetes kubernetes-test --timeout=20s --for=jsonpath='{.status.kubernetesResources.version.status}'=Ready --timeout=2m
|
||||||
|
kubectl wait deploy --timeout=4m --for=condition=available -n tenant-test4kubernetes kubernetes-test kubernetes-test-cluster-autoscaler kubernetes-test-kccm kubernetes-test-kcsi-controller
|
||||||
|
kubectl wait machinedeployment kubernetes-test-md0 -n tenant-test4kubernetes --timeout=20s --for=jsonpath='{.status.replicas}'=2 --timeout=1m
|
||||||
|
kubectl wait machinedeployment kubernetes-test-md0 -n tenant-test4kubernetes --timeout=20s --for=jsonpath='{.status.v1beta2.readyReplicas}'=2 --timeout=2m
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ clickhouse 0.6.0 1ec10165
|
|||||||
clickhouse 0.6.1 c62a83a7
|
clickhouse 0.6.1 c62a83a7
|
||||||
clickhouse 0.6.2 8267072d
|
clickhouse 0.6.2 8267072d
|
||||||
clickhouse 0.7.0 93bdf411
|
clickhouse 0.7.0 93bdf411
|
||||||
clickhouse 0.8.0 HEAD
|
clickhouse 0.9.0 HEAD
|
||||||
ferretdb 0.1.0 e9716091
|
ferretdb 0.1.0 e9716091
|
||||||
ferretdb 0.1.1 91b0499a
|
ferretdb 0.1.1 91b0499a
|
||||||
ferretdb 0.2.0 6c5cf5bf
|
ferretdb 0.2.0 6c5cf5bf
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
OUT=../../_out/repos/extra
|
OUT=../_out/repos/extra
|
||||||
TMP=../../_out/repos/extra/historical
|
TMP := $(shell mktemp -d)
|
||||||
|
|
||||||
repo:
|
repo:
|
||||||
rm -rf "$(OUT)"
|
cd .. && ../hack/package_chart.sh extra $(OUT) $(TMP) library
|
||||||
mkdir -p "$(OUT)"
|
|
||||||
awk '$$3 != "HEAD" {print "mkdir -p $(TMP)/" $$1 "-" $$2}' versions_map | sh -ex
|
|
||||||
awk '$$3 != "HEAD" {print "git archive " $$3 " " $$1 " | tar -xf- --strip-components=1 -C $(TMP)/" $$1 "-" $$2 }' versions_map | sh -ex
|
|
||||||
helm package -d "$(OUT)" $$(find . $(TMP) -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")' | sort -V)
|
|
||||||
cd "$(OUT)" && helm repo index . --url http://cozystack.cozy-system.svc/repos/extra
|
|
||||||
rm -rf "$(TMP)"
|
|
||||||
|
|
||||||
fix-chartnames:
|
fix-chartnames:
|
||||||
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
|
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
packages/library/Makefile
Normal file
15
packages/library/Makefile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
OUT=../_out/repos/library
|
||||||
|
TMP := $(shell mktemp -d)
|
||||||
|
|
||||||
|
repo:
|
||||||
|
cd .. && ../hack/package_chart.sh library $(OUT) $(TMP)
|
||||||
|
|
||||||
|
fix-chartnames:
|
||||||
|
find . -maxdepth 2 -name Chart.yaml | awk -F/ '{print $$2}' | while read i; do sed -i "s/^name: .*/name: $$i/" "$$i/Chart.yaml"; done
|
||||||
|
|
||||||
|
gen-versions-map: fix-chartnames
|
||||||
|
../../hack/gen_versions_map.sh
|
||||||
|
|
||||||
|
check-version-map: gen-versions-map
|
||||||
|
git diff --exit-code -- versions_map
|
||||||
|
|
||||||
23
packages/library/cozy-lib/.helmignore
Normal file
23
packages/library/cozy-lib/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
18
packages/library/cozy-lib/Chart.yaml
Normal file
18
packages/library/cozy-lib/Chart.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: cozy-lib
|
||||||
|
description: Common Cozystack templates
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: library
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
6
packages/library/cozy-lib/Makefile
Normal file
6
packages/library/cozy-lib/Makefile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
include ../../../scripts/common-envs.mk
|
||||||
|
include ../../../scripts/package.mk
|
||||||
|
|
||||||
|
generate:
|
||||||
|
readme-generator -v values.yaml -s values.schema.json -r README.md
|
||||||
|
|
||||||
1
packages/library/cozy-lib/README.md
Normal file
1
packages/library/cozy-lib/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
## Parameters
|
||||||
49
packages/library/cozy-lib/templates/_resourcepresets.tpl
Normal file
49
packages/library/cozy-lib/templates/_resourcepresets.tpl
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{{/*
|
||||||
|
Copyright Broadcom, Inc. All Rights Reserved.
|
||||||
|
SPDX-License-Identifier: APACHE-2.0
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Return a resource request/limit object based on a given preset.
|
||||||
|
These presets are for basic testing and not meant to be used in production
|
||||||
|
{{ include "cozy-lib.resources.preset" "nano" -}}
|
||||||
|
*/}}
|
||||||
|
{{- define "cozy-lib.resources.preset" -}}
|
||||||
|
{{- $presets := dict
|
||||||
|
"nano" (dict
|
||||||
|
"requests" (dict "cpu" "100m" "memory" "128Mi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "128Mi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"micro" (dict
|
||||||
|
"requests" (dict "cpu" "250m" "memory" "256Mi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "256Mi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"small" (dict
|
||||||
|
"requests" (dict "cpu" "500m" "memory" "512Mi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "512Mi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"medium" (dict
|
||||||
|
"requests" (dict "cpu" "500m" "memory" "1Gi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "1Gi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"large" (dict
|
||||||
|
"requests" (dict "cpu" "1" "memory" "2Gi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "2Gi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"xlarge" (dict
|
||||||
|
"requests" (dict "cpu" "2" "memory" "4Gi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "4Gi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
"2xlarge" (dict
|
||||||
|
"requests" (dict "cpu" "4" "memory" "8Gi" "ephemeral-storage" "50Mi")
|
||||||
|
"limits" (dict "memory" "8Gi" "ephemeral-storage" "2Gi")
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{- if hasKey $presets . -}}
|
||||||
|
{{- index $presets . | toYaml -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "ERROR: Preset key '%s' invalid. Allowed values are %s" . (join "," (keys $presets)) | fail -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
53
packages/library/cozy-lib/templates/_resources.tpl
Normal file
53
packages/library/cozy-lib/templates/_resources.tpl
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{{- /*
|
||||||
|
A sanitized resource map is a dict with resource-name => resource-quantity.
|
||||||
|
If not in such a form, requests are used, then limits. All resources are set
|
||||||
|
to have equal requests and limits, except CPU, that has only requests. The
|
||||||
|
template expects to receive a dict {"requests":{...}, "limits":{...}} as
|
||||||
|
input, e.g. {{ include "cozy-lib.resources.sanitize" .Values.resources }}.
|
||||||
|
Example input:
|
||||||
|
==============
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 1024Mi
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 512Mi
|
||||||
|
memory: 256Mi
|
||||||
|
devices.com/nvidia: "1"
|
||||||
|
|
||||||
|
Example output:
|
||||||
|
===============
|
||||||
|
limits:
|
||||||
|
devices.com/nvidia: "1"
|
||||||
|
memory: 256Mi
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
devices.com/nvidia: "1"
|
||||||
|
memory: 256Mi
|
||||||
|
*/}}
|
||||||
|
{{- define "cozy-lib.resources.sanitize" }}
|
||||||
|
{{- $sanitizedMap := dict }}
|
||||||
|
{{- if hasKey . "limits" }}
|
||||||
|
{{- range $k, $v := .limits }}
|
||||||
|
{{- $_ := set $sanitizedMap $k $v }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if hasKey . "requests" }}
|
||||||
|
{{- range $k, $v := .requests }}
|
||||||
|
{{- $_ := set $sanitizedMap $k $v }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $k, $v := . }}
|
||||||
|
{{- if not (or (eq $k "requests") (eq $k "limits")) }}
|
||||||
|
{{- $_ := set $sanitizedMap $k $v }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $output := dict "requests" dict "limits" dict }}
|
||||||
|
{{- range $k, $v := $sanitizedMap }}
|
||||||
|
{{- $_ := set $output.requests $k $v }}
|
||||||
|
{{- if not (eq $k "cpu") }}
|
||||||
|
{{- $_ := set $output.limits $k $v }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $output | toYaml }}
|
||||||
|
{{- end }}
|
||||||
5
packages/library/cozy-lib/values.schema.json
Normal file
5
packages/library/cozy-lib/values.schema.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"title": "Chart Values",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {}
|
||||||
|
}
|
||||||
1
packages/library/cozy-lib/values.yaml
Normal file
1
packages/library/cozy-lib/values.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
0
packages/library/testfile
Normal file
0
packages/library/testfile
Normal file
1
packages/library/versions_map
Normal file
1
packages/library/versions_map
Normal file
@@ -0,0 +1 @@
|
|||||||
|
cozy-lib 0.1.0 HEAD
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Build the manager binary
|
# Build the manager binary
|
||||||
FROM golang:1.24 as builder
|
FROM golang:1.24 as builder
|
||||||
|
|
||||||
ARG VERSION=edge-25.3.2
|
ARG VERSION=edge-25.4.1
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ WORKDIR /
|
|||||||
COPY --from=builder /workspace/kamaji .
|
COPY --from=builder /workspace/kamaji .
|
||||||
USER 65532:65532
|
USER 65532:65532
|
||||||
|
|
||||||
ENTRYPOINT ["/kamaji"]
|
ENTRYPOINT ["/kamaji"]
|
||||||
|
|||||||
Reference in New Issue
Block a user