Skip to content

Commit bfb0838

Browse files
authored
Merge pull request #7 from linode/APL-823
feat: add spin operator prereqs and spin-app Helm charts
2 parents 5a8e034 + 4c7d5a9 commit bfb0838

File tree

16 files changed

+2977
-3
lines changed

16 files changed

+2977
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ This repository contains example code used for App Platform for LKE [Cloud Guide
44

55
## Contents
66

7-
## kserve-ai-inferencing
7+
## inferencing-service
88

9-
An example Helm chart to create a Kserve `inferenceService`.
9+
A Helm chart to create a Kserve `inferenceService`.
1010

1111
## open-webui
1212

13-
An example Kverno `Policy` to disable Istio sidecar injection to be used in combination with the `open-webui` Helm chart.
13+
A Kverno `Policy` to disable Istio sidecar injection to be used in combination with the `open-webui` Helm chart.
1414

1515
## rabbitmq-python
1616

1717
Source code for an example chat app, sending messages to all clients that are currently connected.
1818

19+
## spinkube
20+
21+
Helm charts for installing `spin-operator` prerequisites, a spin shim executor and a spin application.
22+
1923
## vote-app
2024

2125
Source code to build the `vote`, `worker` and `results` images based on the [Example Voting App](https://github.com/dockersamples/example-voting-app).

notes.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
image:
2+
repository: ghcr.io/spinkube/containerd-shim-spin/examples/spin-rust-hello
3+
tag: v0.13.0
4+
5+
6+
values: | kubecon-api.yaml
7+
fullnameOverride: ""
8+
image:
9+
repository: thansdemo.azurecr.io/kubecon-api
10+
tag: 0.20.0
11+
replicaCount: 0
12+
env: []
13+
commonLabels: {}
14+
enableAutoscaling: false
15+
runtimeConfig:
16+
loadFromSecret: api-rtc
17+
resources: {}
18+
volumeMounts: []
19+
volumes: []
20+
livenessProbe: null
21+
readinessProbe: {}

spinkube/spin-app/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: spin-application
3+
description: App Platform quick start Helm chart for creating a Spin Application
4+
version: 1.1.0
5+
appVersion: "1.16.0"
6+
icon: https://linode.github.io/apl-charts/icons/spinkube.png

spinkube/spin-app/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SpinApp
2+
3+
A SpinApp is a Custom Resource to deploy WebAssembly microservices and web applications based on Spin. Spin is a framework for building and running event-driven microservice applications with WebAssembly (Wasm) components. Spin uses Wasm because it is sand boxed, portable, and fast. Millisecond cold start times mean no need to keep applications “warm”. Many languages have Wasm implementations, so developers don’t have to learn new languages or libraries.
4+
5+
Spin is open source and built on standards, meaning you can take your Spin applications anywhere. There are Spin implementations for local development, for self-hosted servers, for Kubernetes, and for cloud-hosted services.
6+
7+
## Prerequisites
8+
9+
- `kwasm-operator` installed.
10+
- `spin-operator-crds` installed.
11+
- `spin-operator` installed.
12+
- `spin-shim-executor` CR added to the Team namespace.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/*
2+
Create a default fully qualified app name.
3+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
4+
If release name contains chart name it will be used as a full name.
5+
*/}}
6+
{{- define "spinapp.fullname" -}}
7+
{{- if .Values.fullnameOverride }}
8+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
9+
{{- else }}
10+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
11+
{{- end }}
12+
{{- end }}
13+
14+
{{/*
15+
Create chart name and version as used by the chart label.
16+
*/}}
17+
{{- define "spinapp.chart" -}}
18+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
19+
{{- end }}
20+
21+
{{/*
22+
Common labels
23+
*/}}
24+
{{- define "spinapp.labels" -}}
25+
helm.sh/chart: {{ include "spinapp.chart" . }}
26+
app.kubernetes.io/instance: {{ .Release.Name }}
27+
app.kubernetes.io/managed-by: {{ .Release.Service }}
28+
app.kubernetes.io/name: {{ include "spinapp.fullname" . }}
29+
app.kubernetes.io/owner: {{ .Release.Namespace }}
30+
otomi.io/app: {{ include "spinapp.fullname" . }}
31+
sidecar.istio.io/inject: "false"
32+
{{- end }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: core.spinkube.dev/v1alpha1
2+
kind: SpinApp
3+
metadata:
4+
name: {{ include "spinapp.fullname" . }}
5+
labels: {{- include "spinapp.labels" . | nindent 4 }}
6+
{{- with .Values.commonLabels }}
7+
{{- toYaml . | nindent 4 }}
8+
{{- end }}
9+
spec:
10+
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
11+
executor: containerd-shim-spin
12+
replicas: {{ .Values.replicaCount }}
13+
{{- with .Values.runtimeConfig }}
14+
runtimeConfig: {{- . | toYaml | nindent 4 }}
15+
{{- end }}
16+
enableAutoscaling: {{ .Values.enableAutoscaling }}
17+
podLabels: {{- include "spinapp.labels" . | nindent 4 }}
18+
{{- with .Values.resources }}
19+
resources: {{- . | toYaml | nindent 4 }}
20+
{{- end }}
21+
{{- with .Values.env }}
22+
variables: {{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
{{- with .Values.volumeMounts }}
25+
volumeMounts:
26+
{{- toYaml . | nindent 4 }}
27+
{{- end }}
28+
{{- with .Values.volumeMounts }}
29+
volumes:
30+
{{- toYaml . | nindent 4 }}
31+
{{- end }}
32+
checks:
33+
{{- with .Values.livenessProbe }}
34+
liveness:
35+
{{- . | toYaml | nindent 6 }}
36+
{{- end }}
37+
{{- with .Values.readinessProbe }}
38+
readiness:
39+
{{- . | toYaml | nindent 6 }}
40+
{{- end }}

spinkube/spin-app/values.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
## @param fullnameOverride String to fully override deployment.fullname template
3+
## Used by APL to set the name for all resources based on the workload name
4+
##
5+
fullnameOverride: ""
6+
## @param image.repository your image repository
7+
## @param image.tag image tag (immutable tags are recommended)
8+
## @param image.pullPolicy image pull policy
9+
##
10+
image:
11+
repository: ""
12+
tag: ""
13+
14+
## @param replicaCount Number of replicas to deploy
15+
##
16+
replicaCount: 2
17+
18+
## RuntimeConfig defines configuration to be applied at runtime for this app.
19+
runtimeConfig: {}
20+
21+
## @param env Environment variables for the container
22+
##
23+
env: []
24+
# - name: TARGET
25+
# value: VALUE
26+
# - name: DB_PASSWORD
27+
# valueFrom:
28+
# secretKeyRef:
29+
# name: user
30+
# key: password
31+
32+
## @param labels Additional labels for all resources
33+
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
34+
##
35+
commonLabels: {}
36+
37+
## EnableAutoscaling indicates whether the app is allowed to autoscale. If true then the operator leaves
38+
## the replica count of the underlying deployment to be managed by an external autoscaler (HPA/KEDA).
39+
## Replicas cannot be defined if this is enabled. By default EnableAutoscaling is false.
40+
enableAutoscaling: false
41+
42+
## Containers' resource requests and limits
43+
## ref: https://kubernetes.io/docs/user-guide/compute-resources/
44+
## You can change default resource request in the workload values. This increases the chance the charts will run on environments with little
45+
## resources, such as Minikube.
46+
## @param resources.limits The resources limits for the container
47+
## @param resources.requests The requested resources for the container
48+
##
49+
resources: {}
50+
# limits:
51+
# cpu: 300m
52+
# memory: 128Mi
53+
# requests:
54+
# cpu: 100m
55+
# memory: 32Mi
56+
57+
volumeMounts: []
58+
# - name: my-secret
59+
# mountPath: /secrets
60+
# readOnly: true
61+
# - mountPath: /tmp
62+
# name: tmp
63+
# - name: config-volume
64+
# mountPath: /etc/config
65+
66+
## @param Volumes A list of volumes to be added to the pod
67+
##
68+
volumes: []
69+
# - name: my-secret
70+
# secret:
71+
# secretName: my-secret
72+
# - name: tmp
73+
# emptyDir: {}
74+
# - name: config-volume
75+
# configMap:
76+
# name: special-config
77+
78+
## Container liveness probe.
79+
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
80+
##
81+
livenessProbe:
82+
# httpGet:
83+
# path: /
84+
# port: http
85+
86+
## Container readiness probe.
87+
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
88+
##
89+
readinessProbe: {}
90+
# httpGet:
91+
# path: /
92+
# port: http
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: spin-operator-prerequisites
3+
description: A Helm chart for Kubernetes
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
# NOTE: this version is kept static in version control but is bumped when packaging and releasing
17+
version: 0.5.0
18+
# This is the version number of the application being deployed. This version number should be
19+
# incremented each time you make changes to the application. Versions are not expected to
20+
# follow Semantic Versioning. They should reflect the version the application is using.
21+
# It is recommended to use it with quotes.
22+
# NOTE: this version is kept static in version control but is bumped when packaging and releasing
23+
appVersion: "v0.5.0"
24+
icon: https://linode.github.io/apl-charts/icons/spinkube.png
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Prerequisites
2+
3+
- `kwasm-operator` installed.

0 commit comments

Comments
 (0)