Skip to content

Commit 3707556

Browse files
committed
Update netsoc/webspaced charts (6fde085c)
1 parent f37947c commit 3707556

15 files changed

+580
-0
lines changed

charts/webspaced/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/values-test*.yaml

charts/webspaced/.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/webspaced/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: webspaced
3+
description: Microservice for managing containerised webspaces
4+
type: application
5+
version: 0.2.3
6+
appVersion: 0.4.1

charts/webspaced/templates/NOTES.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "webspaced.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "webspaced.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "webspaced.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "webspaced.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
echo "Visit http://127.0.0.1:8080 to use your application"
20+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
21+
{{- end }}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "webspaced.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 "webspaced.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 "webspaced.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "webspaced.labels" -}}
37+
helm.sh/chart: {{ include "webspaced.chart" . }}
38+
{{ include "webspaced.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 "webspaced.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "webspaced.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 "webspaced.serviceAccountName" -}}
57+
{{- include "webspaced.fullname" . }}
58+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- if not .Values.global.kubelan.externalConfigMap }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "webspaced.fullname" . }}-kubelan
6+
labels:
7+
{{- include "webspaced.labels" . | nindent 4 }}
8+
data:
9+
kubelan.yaml: |
10+
log_level: {{ .Values.global.kubelan.log_level }}
11+
services:
12+
- {{ include "webspaced.fullname" . }}
13+
{{- range $s := .Values.global.kubelan.extraServices }}
14+
- {{ $s }}
15+
{{- end }}
16+
{{- with .Values.global.kubelan.vxlan }}
17+
vxlan:
18+
{{- toYaml . | nindent 6 }}
19+
{{- end }}
20+
{{- with .Values.global.kubelan.hooks }}
21+
hooks:
22+
{{- toYaml . | nindent 6 }}
23+
{{- end }}
24+
{{- end }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "webspaced.fullname" . }}
5+
labels:
6+
{{- include "webspaced.labels" . | nindent 4 }}
7+
data:
8+
{{- with .Values.config }}
9+
webspaced.yaml: |
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "webspaced.fullname" . }}
5+
labels:
6+
{{- include "webspaced.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
{{- include "webspaced.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "webspaced.selectorLabels" . | nindent 8 }}
20+
spec:
21+
{{- with .Values.imagePullSecrets }}
22+
imagePullSecrets:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
serviceAccountName: {{ include "webspaced.serviceAccountName" . }}
26+
containers:
27+
- name: {{ .Chart.Name }}
28+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
29+
imagePullPolicy: {{ .Values.image.pullPolicy }}
30+
env:
31+
- name: WSD_HTTP_LISTEN_ADDRESS
32+
value: ':80'
33+
- name: WSD_TRAEFIK_PROVIDER
34+
value: kubernetes
35+
- name: WSD_TRAEFIK_KUBERNETES_NAMESPACE
36+
valueFrom:
37+
fieldRef:
38+
fieldPath: metadata.namespace
39+
- name: WSD_TRAEFIK_WEBSPACED_URL
40+
value: http://{{ include "webspaced.fullname" . }}.{{ .Release.Namespace }}
41+
{{- if .Values.fwdService.enabled }}
42+
- name: WSD_WEBSPACES_PORTS_KUBERNETES_SERVICE
43+
value: {{ include "webspaced.fullname" . }}-forwarding
44+
{{- end }}
45+
46+
- name: WSD_IAM_TOKEN_FILE
47+
value: /run/secrets/webspaced/iam_token.txt
48+
- name: WSD_LXD_TLS_CLIENT_KEY_FILE
49+
value: /run/secrets/webspaced/lxd_client.key
50+
- name: WSD_LXD_TLS_TRUST_PASSWORD_FILE
51+
value: /run/secrets/webspaced/lxd_trust.txt
52+
- name: WSD_TRAEFIK_IAM_TOKEN_FILE
53+
value: /run/secrets/webspaced/traefik_iam_token.txt
54+
ports:
55+
- name: http
56+
containerPort: 80
57+
protocol: TCP
58+
startupProbe:
59+
httpGet:
60+
path: /health
61+
port: http
62+
{{- toYaml .Values.startupProbe | nindent 12 }}
63+
livenessProbe:
64+
httpGet:
65+
path: /health
66+
port: http
67+
{{- toYaml .Values.livenessProbe | nindent 12 }}
68+
resources:
69+
{{- toYaml .Values.resources | nindent 12 }}
70+
volumeMounts:
71+
- name: config
72+
mountPath: /run/config
73+
- name: secrets
74+
mountPath: /run/secrets/webspaced
75+
- name: kubelan
76+
image: '{{ .Values.global.kubelan.image.repository }}:{{ .Values.global.kubelan.image.tag }}'
77+
imagePullPolicy: {{ .Values.global.kubelan.image.pullPolicy }}
78+
env:
79+
- name: KL_IP
80+
valueFrom:
81+
fieldRef:
82+
fieldPath: status.podIP
83+
- name: KL_NAMESPACE
84+
valueFrom:
85+
fieldRef:
86+
fieldPath: metadata.namespace
87+
88+
- name: IFACE_IP
89+
value: {{ .Values.staticIP | squote }}
90+
- name: KL_HOOKS_UP
91+
value: 'sh,-c,ip addr add $IFACE_IP dev $IFACE'
92+
ports:
93+
- name: http
94+
containerPort: 8181
95+
protocol: TCP
96+
livenessProbe:
97+
httpGet:
98+
path: /health
99+
port: http
100+
periodSeconds: 5
101+
securityContext:
102+
capabilities:
103+
add: [NET_ADMIN]
104+
volumeMounts:
105+
- name: kubelan-config
106+
mountPath: /run/config
107+
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
108+
volumes:
109+
- name: config
110+
configMap:
111+
name: {{ include "webspaced.fullname" . }}
112+
- name: secrets
113+
secret:
114+
secretName: {{ include "webspaced.fullname" . }}
115+
- name: kubelan-config
116+
configMap:
117+
{{- if .Values.global.kubelan.externalConfigMap }}
118+
name: {{ .Values.global.kubelan.externalConfigMap }}
119+
{{- else }}
120+
name: {{ include "webspaced.fullname" . }}-kubelan
121+
{{- end }}
122+
{{- with .Values.nodeSelector }}
123+
nodeSelector:
124+
{{- toYaml . | nindent 8 }}
125+
{{- end }}
126+
{{- with .Values.affinity }}
127+
affinity:
128+
{{- toYaml . | nindent 8 }}
129+
{{- end }}
130+
{{- with .Values.tolerations }}
131+
tolerations:
132+
{{- toYaml . | nindent 8 }}
133+
{{- end }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "webspaced.fullname" . -}}
3+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
4+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
5+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
6+
{{- end }}
7+
{{- end }}
8+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
9+
apiVersion: networking.k8s.io/v1
10+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
11+
apiVersion: networking.k8s.io/v1beta1
12+
{{- else -}}
13+
apiVersion: extensions/v1beta1
14+
{{- end }}
15+
kind: Ingress
16+
metadata:
17+
name: {{ $fullName }}
18+
labels:
19+
{{- include "webspaced.labels" . | nindent 4 }}
20+
{{- with .Values.ingress.annotations }}
21+
annotations:
22+
{{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
spec:
25+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
26+
ingressClassName: {{ .Values.ingress.className }}
27+
{{- end }}
28+
{{- if .Values.ingress.tls }}
29+
tls:
30+
{{- range .Values.ingress.tls }}
31+
- hosts:
32+
{{- range .hosts }}
33+
- {{ . | quote }}
34+
{{- end }}
35+
secretName: {{ .secretName }}
36+
{{- end }}
37+
{{- end }}
38+
rules:
39+
{{- range .Values.ingress.hosts }}
40+
- host: {{ .host | quote }}
41+
http:
42+
paths:
43+
{{- range .paths }}
44+
- path: {{ .path }}
45+
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
46+
pathType: {{ .pathType }}
47+
{{- end }}
48+
backend:
49+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
50+
service:
51+
name: {{ $fullName }}
52+
port:
53+
name: http
54+
{{- else }}
55+
serviceName: {{ $fullName }}
56+
servicePort: http
57+
{{- end }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}

charts/webspaced/templates/role.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: Role
4+
metadata:
5+
name: {{ include "webspaced.fullname" . }}
6+
labels:
7+
{{- include "webspaced.labels" . | nindent 4 }}
8+
rules:
9+
- apiGroups: ['', 'traefik.containo.us', 'cert-manager.io']
10+
resources:
11+
- endpoints
12+
- services
13+
- middlewares
14+
- middlewaretcps
15+
- ingressroutes
16+
- ingressroutetcps
17+
- certificates
18+
verbs: ['get', 'create', 'update', 'delete']
19+
---
20+
apiVersion: rbac.authorization.k8s.io/v1
21+
kind: ClusterRole
22+
metadata:
23+
name: {{ include "webspaced.fullname" . }}
24+
labels:
25+
{{- include "webspaced.labels" . | nindent 4 }}
26+
rules:
27+
- apiGroups: ['discovery.k8s.io']
28+
resources: ['endpointslices']
29+
verbs: ['watch', 'list']

0 commit comments

Comments
 (0)