Skip to content

Commit 5906257

Browse files
committed
plugins: define Tor DA plugin that just helm-installs a 1-pod chart
1 parent bf9a1b4 commit 5906257

File tree

8 files changed

+131
-0
lines changed

8 files changed

+131
-0
lines changed
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/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: torda
3+
description: A Helm chart to deploy a Tor Directory Authority
4+
version: 0.1.0
5+
appVersion: "0.1.0"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Thank you for installing TorDA.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "torda.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 "torda.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
18+
{{- end }}
19+
{{- end }}
20+
21+
{{/*
22+
Create chart name and version as used by the chart label.
23+
*/}}
24+
{{- define "torda.chart" -}}
25+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
26+
{{- end }}
27+
28+
{{/*
29+
Common labels
30+
*/}}
31+
{{- define "torda.labels" -}}
32+
helm.sh/chart: {{ include "torda.chart" . }}
33+
{{ include "torda.selectorLabels" . }}
34+
{{- if .Chart.AppVersion }}
35+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
36+
{{- end }}
37+
app.kubernetes.io/managed-by: {{ .Release.Service }}
38+
{{- end }}
39+
40+
{{/*
41+
Selector labels
42+
*/}}
43+
{{- define "torda.selectorLabels" -}}
44+
app.kubernetes.io/name: {{ include "torda.name" . }}
45+
app.kubernetes.io/instance: {{ .Release.Name }}
46+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: {{ include "torda.fullname" . }}
5+
labels:
6+
{{- include "torda.labels" . | nindent 4 }}
7+
app: {{ include "torda.fullname" . }}
8+
spec:
9+
containers:
10+
- name: {{ .Values.name }}
11+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
12+
imagePullPolicy: {{ .Values.image.pullPolicy }}
13+
ports:
14+
- name: toror
15+
containerPort: 9001
16+
protocol: TCP
17+
- name: torda
18+
containerPort: 9030
19+
protocol: TCP
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "torda.fullname" . }}
5+
labels:
6+
app: {{ include "torda.fullname" . }}
7+
spec:
8+
type: ClusterIP
9+
ports:
10+
- port: 9001
11+
targetPort: 9001
12+
protocol: TCP
13+
name: toror
14+
- port: 9030
15+
targetPort: 9030
16+
protocol: TCP
17+
name: torda
18+
selector:
19+
{{- include "torda.selectorLabels" . | nindent 4 }}
20+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: "torda"
2+
image:
3+
repository: "bitcoindevproject/tor-da"
4+
tag: "latest"
5+
pullPolicy: IfNotPresent

resources/plugins/tor/plugin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
3+
from pathlib import Path
4+
from warnet.process import run_command
5+
6+
7+
if __name__ == "__main__":
8+
command = (
9+
f"helm upgrade --install torda {Path(__file__).parent / 'charts' / 'torda'}"
10+
)
11+
run_command(command)
12+

0 commit comments

Comments
 (0)