Skip to content

Commit 49221ba

Browse files
author
jaime merino
committed
feat: add helm support
1 parent 694d4d8 commit 49221ba

File tree

10 files changed

+314
-0
lines changed

10 files changed

+314
-0
lines changed

charts/sysbox/.helmignore

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/

charts/sysbox/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: sysbox
3+
description: A Helm chart for Kubernetes
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: application
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
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "v0.6.7-0"

charts/sysbox/templates/NOTES.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Sysbox has been installed!
2+
3+
1. Check that the Sysbox DaemonSet is running on your nodes:
4+
kubectl get pods -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "sysbox.name" . }}" -o wide
5+
6+
2. Verify that the RuntimeClass has been created:
7+
kubectl get runtimeclass sysbox-runc
8+
9+
3. You can now deploy pods using Sysbox by adding the runtimeClassName:
10+
11+
apiVersion: v1
12+
kind: Pod
13+
metadata:
14+
name: my-sysbox-pod
15+
spec:
16+
runtimeClassName: sysbox-runc
17+
containers:
18+
- name: system-container
19+
image: ubuntu
20+
command: ["sleep", "inf"]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "sysbox.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "sysbox.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "sysbox.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "sysbox.labels" -}}
37+
helm.sh/chart: {{ include "sysbox.chart" . }}
38+
{{ include "sysbox.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "sysbox.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "sysbox.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "sysbox.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "sysbox.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: sysbox-operational-attributes
5+
namespace: kube-system
6+
data:
7+
SYSBOX_MGR_CONFIG: ""
8+
SYSBOX_FS_CONFIG: ""
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: {{ include "sysbox.fullname" . }}
5+
namespace: kube-system
6+
spec:
7+
selector:
8+
matchLabels:
9+
sysbox-install: "yes"
10+
template:
11+
metadata:
12+
labels:
13+
sysbox-install: "yes"
14+
spec:
15+
serviceAccountName: sysbox-label-node
16+
nodeSelector:
17+
sysbox-install: "yes"
18+
tolerations:
19+
- key: "sysbox-runtime"
20+
operator: "Equal"
21+
value: "not-running"
22+
effect: "NoSchedule"
23+
containers:
24+
- name: sysbox-deploy-k8s
25+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
26+
imagePullPolicy: {{ .Values.image.pullPolicy }}
27+
command: [ "bash", "-c", "/opt/sysbox/scripts/sysbox-deploy-k8s.sh ce install" ]
28+
env:
29+
- name: NODE_NAME
30+
valueFrom:
31+
fieldRef:
32+
fieldPath: spec.nodeName
33+
- name: SYSBOX_MGR_CONFIG
34+
valueFrom:
35+
configMapKeyRef:
36+
name: sysbox-operational-attributes
37+
key: SYSBOX_MGR_CONFIG
38+
- name: SYSBOX_FS_CONFIG
39+
valueFrom:
40+
configMapKeyRef:
41+
name: sysbox-operational-attributes
42+
key: SYSBOX_FS_CONFIG
43+
securityContext:
44+
privileged: true
45+
volumeMounts:
46+
- name: host-etc
47+
mountPath: /mnt/host/etc
48+
- name: host-osrelease
49+
mountPath: /mnt/host/os-release
50+
- name: host-dbus
51+
mountPath: /var/run/dbus
52+
- name: host-run-systemd
53+
mountPath: /run/systemd
54+
- name: host-lib-systemd
55+
mountPath: /mnt/host/lib/systemd/system
56+
- name: host-etc-systemd
57+
mountPath: /mnt/host/etc/systemd/system
58+
- name: host-lib-sysctl
59+
mountPath: /mnt/host/lib/sysctl.d
60+
- name: host-opt-lib-sysctl
61+
mountPath: /mnt/host/opt/lib/sysctl.d
62+
- name: host-usr-bin
63+
mountPath: /mnt/host/usr/bin
64+
- name: host-opt-bin
65+
mountPath: /mnt/host/opt/bin
66+
- name: host-usr-local-bin
67+
mountPath: /mnt/host/usr/local/bin
68+
- name: host-opt-local-bin
69+
mountPath: /mnt/host/opt/local/bin
70+
- name: host-usr-lib-mod-load
71+
mountPath: /mnt/host/usr/lib/modules-load.d
72+
- name: host-opt-lib-mod-load
73+
mountPath: /mnt/host/opt/lib/modules-load.d
74+
- name: host-run
75+
mountPath: /mnt/host/run
76+
- name: host-var-lib
77+
mountPath: /mnt/host/var/lib
78+
volumes:
79+
- name: host-etc
80+
hostPath:
81+
path: /etc
82+
- name: host-osrelease
83+
hostPath:
84+
path: /etc/os-release
85+
- name: host-dbus
86+
hostPath:
87+
path: /var/run/dbus
88+
- name: host-run-systemd
89+
hostPath:
90+
path: /run/systemd
91+
- name: host-lib-systemd
92+
hostPath:
93+
path: /lib/systemd/system
94+
- name: host-etc-systemd
95+
hostPath:
96+
path: /etc/systemd/system
97+
- name: host-lib-sysctl
98+
hostPath:
99+
path: /lib/sysctl.d
100+
- name: host-opt-lib-sysctl
101+
hostPath:
102+
path: /opt/lib/sysctl.d
103+
- name: host-usr-bin
104+
hostPath:
105+
path: /usr/bin/
106+
- name: host-opt-bin
107+
hostPath:
108+
path: /opt/bin/
109+
- name: host-usr-local-bin
110+
hostPath:
111+
path: /usr/local/bin/
112+
- name: host-opt-local-bin
113+
hostPath:
114+
path: /opt/local/bin/
115+
- name: host-usr-lib-mod-load
116+
hostPath:
117+
path: /usr/lib/modules-load.d
118+
- name: host-opt-lib-mod-load
119+
hostPath:
120+
path: /opt/lib/modules-load.d
121+
- name: host-run
122+
hostPath:
123+
path: /run
124+
- name: host-var-lib
125+
hostPath:
126+
path: /var/lib
127+
updateStrategy:
128+
rollingUpdate:
129+
maxUnavailable: 1
130+
type: RollingUpdate

charts/sysbox/templates/roles.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: ClusterRole
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: sysbox-node-labeler
5+
rules:
6+
- apiGroups: [""]
7+
resources: ["nodes"]
8+
verbs: ["get", "patch"]
9+
- apiGroups: [""]
10+
resources: ["pods"]
11+
verbs: ["get", "list", "delete", "watch"]
12+
---
13+
kind: ClusterRoleBinding
14+
apiVersion: rbac.authorization.k8s.io/v1
15+
metadata:
16+
name: sysbox-label-node-rb
17+
roleRef:
18+
apiGroup: rbac.authorization.k8s.io
19+
kind: ClusterRole
20+
name: sysbox-node-labeler
21+
subjects:
22+
- kind: ServiceAccount
23+
name: sysbox-label-node
24+
namespace: kube-system
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: node.k8s.io/v1
2+
kind: RuntimeClass
3+
metadata:
4+
name: sysbox-runc
5+
handler: sysbox-runc
6+
scheduling:
7+
nodeSelector:
8+
sysbox-runtime: running
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: sysbox-label-node
5+
namespace: kube-system

charts/sysbox/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
image:
2+
repository: registry.nestybox.com/nestybox/sysbox-deploy-k8s
3+
tag: "v0.6.7-0"
4+
pullPolicy: Always
5+
6+
httpRoute:
7+
enabled: false
8+
9+
ingress:
10+
enabled: false

0 commit comments

Comments
 (0)