Skip to content

Commit

Permalink
Merge pull request #7 from knawd/schema
Browse files Browse the repository at this point in the history
feature: streamline schema definition
  • Loading branch information
No9 authored Feb 5, 2023
2 parents 4db3bc3 + 3bee918 commit 6baa259
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --config ct.yaml
run: ct install --config ct.yaml --helm-extra-set-args "--set target=ubuntu_18_04"
2 changes: 0 additions & 2 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- main
paths:
- charts/**
paths-ignore:
- "**.md"

jobs:
release:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The deployment is performed copying files to 3 locations on each node:

|Release|WASMEdge|WASMtime|crun|Ubuntu|OpenShift|
|---|---|---|---|---|---|
|v1.0.0-theta|0.11.2|5.0.0|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11|
|v1.0.0-gamma|0.11.2|5.0.0|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11|
|v1.0.0-beta|0.11.2|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11|
|v1.0.0-alpha|0.11.2|N/A|[main](https://github.com/containers/crun/commit/26fe1383a05279935e67ee31e7ff10c43e7d87ea)|18.04, 20.04|4.10, 4.11|
Expand Down
10 changes: 8 additions & 2 deletions charts/knawd-deployer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ sources:

type: application

version: v1.0.0-gamma
version: v1.0.0-theta

appVersion: "v1.0.0-gamma"
appVersion: "v1.0.0-theta"

# icon: https://raw.githubusercontent.com/No9/core-dump-handler/master/assets/handle-with-care-svgrepo-com.svg

Expand All @@ -23,6 +23,12 @@ maintainers:
url: https://github.com/No9/

annotations:
artifacthub.io/changes: |
- kind: added
description: Streamline the chart options
links:
- name: GitHub PR
url: https://github.com/knawd/deployer/pull/7
artifacthub.io/images: |
- name: knawd-deployer
image: quay.io/knawd/deployer:v1.0.0-beta
Expand Down
44 changes: 9 additions & 35 deletions charts/knawd-deployer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ If you would prefer to manually restart the CRI service run this chart with the

```
cd charts/knawd-deployer
helm install knawd-deployer --create-namespace --namespace knawd .
helm install knawd-deployer --create-namespace --namespace knawd --set target=ubuntu18 .
```

## Ubuntu 20.04

```
cd charts/knawd-deployer
helm install knawd-deployer --create-namespace --namespace knawd -f ubuntu20-values.yaml .
helm install knawd-deployer --create-namespace --namespace knawd --set target=ubuntu20 .
```

## OpenShift
Expand All @@ -26,7 +26,7 @@ Red Hat Core OS based services have yet to be tested. We expect there to be some

```
cd charts/knawd-deployer
helm install knawd-deployer --create-namespace --namespace knawd -f rhel8-values.yaml .
helm install knawd-deployer --create-namespace --namespace knawd .
```

## Knative
Expand All @@ -40,35 +40,9 @@ If you wish to use this chart to obtain a crun enabled cluster but without knati

These are the values particular to the deployer service.

image:

registry: The registry where the image is stored used to specifiy a custom image (default: quay.io)

repository: The repository in the registry where the image is located used to specifiy a custom image (default: knawd/deployer)

tag: The tag in the repository where the image is located used to specifiy a custom image (default: latest)
pullPolicy: The pull policy for the image (default: Always)

daemonset:

name: The name of the job (default: "knawd-deployer")

vendor: The type of node the job will be deployed on (default: "ubuntu_18_04")

libLocation: The location where the external WASM library will be copied to so that crun can find it (default: "/lib")

logLevel: The log level (default: "info")

ociLocation: The location on the host where the custom crun build will be placed (default: "/usr/local/sbin")

configLocation: The location of the OCI configuration on the node (default: "/etc/containerd")

ociType: The type of the OCI Runtime to deploy. Currently "crun-wasmedge" and "crun-wasmtime" are supported (default: "crun-wasmedge")

nodeRoot: The location in the deployer where the node file system is mounted (default: "/mnt/node-root")

isMicroK8s: Is this a microK8s installation (default: false)

autoRestart: Should the deployer automatically restart the CRI service? Required for the config to be applied (default: true)

patchKnative: Runs the patch to enable setting the runtime in a knative service definition.
**target**: The type of kubernetes cluster to be configured. Supported versions are `ubuntu_18_04`, `ubuntu_20_04`, `microk8s` `rhel8` (default: rhel8)
**tag**: The tag in the repository where the image is located used to specifiy a custom image (default: latest)
**autoRestart**: Should the deployer automatically restart the CRI service? Required for the config to be applied (default: true)
**logLevel**: The log level. Supported options `info`, `error`, `warn`, `debug` (default: "info")
**ociType**: The type of the OCI Runtime to deploy. Currently `crun-wasmedge` and `crun-wasmtime` are supported (default: "crun-wasmedge")
**patchKnative**: Runs the patch to enable setting the runtime in a knative service definition.
13 changes: 0 additions & 13 deletions charts/knawd-deployer/rhel8-values.yaml

This file was deleted.

52 changes: 48 additions & 4 deletions charts/knawd-deployer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,53 @@ app.kubernetes.io/instance: {{ .Release.Name }}
Create the name of the service account to use
*/}}
{{- define "knawd-deployer.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "knawd-deployer.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
"knawd-deployer-sa"
{{- end }}

{{/*
Create the name of the Security Context Constraint to use
*/}}
{{- define "knawd-deployer.sccName" -}}
"knawd-deployer-scc"
{{- end }}

{{/*
Create the role name to use
*/}}
{{- define "knawd-deployer.roleName" -}}
"knawd-deployer-role"
{{- end }}

{{/*
Calculate the location for the library
*/}}
{{- define "knawd-deployer.libLocation" -}}
{{- if eq .Values.target "rhel8" }}"/usr/lib64"{{- else }}"/lib"{{- end }}
{{- end }}

{{/*
Calculate the OCI Binary
*/}}
{{- define "knawd-deployer.ociLocation" -}}
"/usr/local/sbin"
{{- end }}

{{/*
Calculate the location to mount the host route in the container
*/}}
{{- define "knawd-deployer.nodeRoot" -}}
"/mnt/node-root"
{{- end }}

{{/*
Calculate the location for configuration
*/}}
{{- define "knawd-deployer.configLocation" -}}
{{- if eq .Values.target "rhel8" }}"/etc/crio"{{- else }}"/etc/containerd"{{- end}}
{{- end }}

{{- define "knawd-deployer.isMicroK8s" -}}
{{- if eq .Values.target "microk8s" }}"true"{{- else }}"false"{{- end}}
{{- end }}


41 changes: 25 additions & 16 deletions charts/knawd-deployer/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: knawd-deployer-daemonset
labels:
{{ include "knawd-deployer.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
name: {{ .Values.daemonset.label }}
name: knawd-deployer-ds
template:
metadata:
labels:
name: {{ .Values.daemonset.label }}
name: knawd-deployer-ds
spec:
restartPolicy: Always
hostPID: true
Expand All @@ -23,35 +25,42 @@ spec:
defaultMode: 0744
serviceAccountName: {{ include "knawd-deployer.serviceAccountName" . }}
containers:
- image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: deploy-remove
- image: quay.io/knawd/deployer:{{ .Values.tag }}
imagePullPolicy: Always
name: deploy
env:
- name: VENDOR
value: {{ .Values.daemonset.vendor | quote }}
value: {{ .Values.target }}
- name: LIB_LOCATION
value: {{ .Values.daemonset.libLocation | quote }}
value: {{ include "knawd-deployer.libLocation" . }}
- name: LOG_LEVEL
value: {{ .Values.daemonset.logLevel | quote }}
value: {{ .Values.logLevel }}
- name: OCI_LOCATION
value: {{ .Values.daemonset.ociLocation | quote }}
value: {{ include "knawd-deployer.ociLocation" . }}
- name: OCI_TYPE
value: {{ .Values.daemonset.ociType | quote }}
value: {{ .Values.ociType }}
- name: NODE_ROOT
value: {{ .Values.daemonset.nodeRoot | quote }}
value: {{ include "knawd-deployer.nodeRoot" . }}
- name: IS_MICROK8S
value: {{ .Values.daemonset.isMicroK8s | quote }}
value: {{ include "knawd-deployer.isMicroK8s" . }}
- name: AUTO_RESTART
value: {{ .Values.daemonset.autoRestart | quote }}
value: {{ .Values.autoRestart | quote }}
- name: CONFIG_LOCATION
value: {{ .Values.daemonset.configLocation | quote }}
value: {{ include "knawd-deployer.configLocation" . }}
- name: LOOP
value: "true"
- name: PATCH_KNATIVE
value: {{ .Values.daemonset.patchKnative | quote }}
value: {{ .Values.patchKnative | quote }}
securityContext:
privileged: true
volumeMounts:
- name: node-root
mountPath: /mnt/node-root/
command: ["/app/manager"]
command: ["/app/manager"]
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
20 changes: 14 additions & 6 deletions charts/knawd-deployer/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
{{- if .Values.scc.create }}
{{- if eq .Values.target "rhel8" }}
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.scc.rolename }}
name: {{ include "knawd-deployer.roleName" . }}
labels:
{{ include "knawd-deployer.labels" . | nindent 4 }}
annotations:
kubernetes.io/description: "Role for configuring node"
"helm.sh/hook": pre-install
rules:
- apiGroups: ["security.openshift.io"]
resources: ["securitycontextconstraints"]
resourceNames: [{{ .Values.scc.name }}]
resourceNames: [{{ include "knawd-deployer.sccName" . }}]
verbs: ["use"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Values.scc.rolename }}
name: {{ include "knawd-deployer.roleName" . }}
labels:
{{ include "knawd-deployer.labels" . | nindent 4 }}
annotations:
kubernetes.io/description: "RoleBinding for configuring node"
"helm.sh/hook": pre-install
Expand All @@ -25,14 +29,16 @@ subjects:
name: {{ include "knawd-deployer.serviceAccountName" . }}
roleRef:
kind: Role
name: {{ .Values.scc.rolename }}
name: {{ include "knawd-deployer.roleName" . }}
apiGroup: rbac.authorization.k8s.io
{{- if .Values.daemonset.patchKnative }}
{{- if .Values.patchKnative }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: knawd-cluster-role
labels:
{{ include "knawd-deployer.labels" . | nindent 4 }}
annotations:
kubernetes.io/description: "ClusterRole for Knative Patch"
"helm.sh/hook": pre-install
Expand All @@ -54,6 +60,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: knawd-cluster-role-binding
labels:
{{ include "knawd-deployer.labels" . | nindent 4 }}
annotations:
kubernetes.io/description: "ClusterRoleBinding for Knative Patch"
"helm.sh/hook": pre-install
Expand Down
Loading

0 comments on commit 6baa259

Please sign in to comment.