diff options
| author | Robert Günzler <r@gnzler.io> | 2026-02-23 14:28:01 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-02-23 14:28:01 +0100 |
| commit | 2d69761436a384a69889120258616dd644c86e7b (patch) | |
| tree | d4f5440cc60e621f81a5d4ab209da85ca91626b5 | |
| parent | fe77c8fb1e8edfd802485dba0c1ffdc8e2005ea5 (diff) | |
golink: generate snapshot from metadata
Signed-off-by: Robert Günzler <r@gnzler.io>
| -rw-r--r-- | bundles/golink/files/kube.yaml | 9 | ||||
| -rw-r--r-- | bundles/golink/files/snapshot.json | 5 | ||||
| -rw-r--r-- | bundles/golink/items.py | 9 | ||||
| -rw-r--r-- | bundles/golink/metadata.py | 8 |
4 files changed, 26 insertions, 5 deletions
diff --git a/bundles/golink/files/kube.yaml b/bundles/golink/files/kube.yaml index 8ab2789..64b1614 100644 --- a/bundles/golink/files/kube.yaml +++ b/bundles/golink/files/kube.yaml @@ -5,6 +5,7 @@ metadata: labels: traefik.enable: false spec: + imagePullPolicy: Always restartPolicy: Never dnsPolicy: Default securityContext: @@ -13,6 +14,11 @@ spec: containers: - name: golink image: ghcr.io/tailscale/golink:main + args: + - --sqlitedb=/home/nonroot/golink.db + - --snapshot=/home/nonroot/snapshot.json + - --https=true + - --readonly=true volumeMounts: - name: golink-data mountPath: /home/nonroot @@ -20,9 +26,6 @@ spec: limits: cpu: 20m memory: 100Mi - requests: - cpu: 10m - memory: 50Mi volumes: - name: golink-data hostPath: diff --git a/bundles/golink/files/snapshot.json b/bundles/golink/files/snapshot.json new file mode 100644 index 0000000..b6757c6 --- /dev/null +++ b/bundles/golink/files/snapshot.json @@ -0,0 +1,5 @@ +## vim: ft=python +<%! from time import strftime as time %> +% for short, long in links.items(): +{"Short":"${short}","Long":"${long}","Owner":"robertgzr@github","Created":"${"%Y-%m-%dT%H:%M:%SZ" | time}","LastEdit":"${"%Y-%m-%dT%H:%M:%SZ" | time}"} +% endfor diff --git a/bundles/golink/items.py b/bundles/golink/items.py index 8f79a22..6a87f1f 100644 --- a/bundles/golink/items.py +++ b/bundles/golink/items.py @@ -1,7 +1,12 @@ files = { "/etc/deployments/golink/kube.yaml": { - "content_type": "text", - "source": "kube.yaml", + "triggers": {"svc_s6rc:golink:restart"}, + }, + "/var/lib/golink/snapshot.json": { + "content_type": "mako", + "context": { + "links": node.metadata.get("go", {}), + }, "triggers": {"svc_s6rc:golink:restart"}, }, } diff --git a/bundles/golink/metadata.py b/bundles/golink/metadata.py index 1fc3cef..1481a73 100644 --- a/bundles/golink/metadata.py +++ b/bundles/golink/metadata.py @@ -2,4 +2,12 @@ defaults = { "containers": { "golink": {}, }, + "backup": { + "include": { + "/var/lib/golink/snapshot.json": {}, + }, + }, + "go": { + "search": "https://start.duckduckgo.com", + }, } |