Compare commits
4 Commits
auto-updat
...
auto-updat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63bc034cdc | ||
|
|
057c301eba | ||
| ba6180a83d | |||
| 44a2bf47d4 |
@@ -45,6 +45,7 @@ ArgoCD homelab project
|
|||||||
| **jellyfin** | [](https://ag.hexor.cy/applications/argocd/jellyfin) |
|
| **jellyfin** | [](https://ag.hexor.cy/applications/argocd/jellyfin) |
|
||||||
| **k8s-secrets** | [](https://ag.hexor.cy/applications/argocd/k8s-secrets) |
|
| **k8s-secrets** | [](https://ag.hexor.cy/applications/argocd/k8s-secrets) |
|
||||||
| **khm** | [](https://ag.hexor.cy/applications/argocd/khm) |
|
| **khm** | [](https://ag.hexor.cy/applications/argocd/khm) |
|
||||||
|
| **mtproxy** | [](https://ag.hexor.cy/applications/argocd/mtproxy) |
|
||||||
| **n8n** | [](https://ag.hexor.cy/applications/argocd/n8n) |
|
| **n8n** | [](https://ag.hexor.cy/applications/argocd/n8n) |
|
||||||
| **ollama** | [](https://ag.hexor.cy/applications/argocd/ollama) |
|
| **ollama** | [](https://ag.hexor.cy/applications/argocd/ollama) |
|
||||||
| **paperless** | [](https://ag.hexor.cy/applications/argocd/paperless) |
|
| **paperless** | [](https://ag.hexor.cy/applications/argocd/paperless) |
|
||||||
|
|||||||
@@ -23,8 +23,48 @@ spec:
|
|||||||
- matchExpressions:
|
- matchExpressions:
|
||||||
- key: mtproxy
|
- key: mtproxy
|
||||||
operator: Exists
|
operator: Exists
|
||||||
|
serviceAccountName: mtproxy
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
|
initContainers:
|
||||||
|
- name: register-proxy
|
||||||
|
image: bitnami/kubectl:latest
|
||||||
|
env:
|
||||||
|
- name: NODE_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
- name: SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: tgproxy-secret
|
||||||
|
key: SECRET
|
||||||
|
- name: PORT
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: tgproxy-secret
|
||||||
|
key: PORT
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
|
||||||
|
SERVER=$(kubectl get node "${NODE_NAME}" -o jsonpath='{.metadata.labels.mtproxy}')
|
||||||
|
if [ -z "${SERVER}" ]; then
|
||||||
|
echo "ERROR: node ${NODE_NAME} has no mtproxy label"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
LINK="tg://proxy?server=${SERVER}&port=${PORT}&secret=${SECRET}"
|
||||||
|
echo "Registering: ${SERVER} -> ${LINK}"
|
||||||
|
if kubectl get secret mtproxy-links -n "${NAMESPACE}" &>/dev/null; then
|
||||||
|
kubectl patch secret mtproxy-links -n "${NAMESPACE}" \
|
||||||
|
--type merge -p "{\"stringData\":{\"${SERVER}\":\"${LINK}\"}}"
|
||||||
|
else
|
||||||
|
kubectl create secret generic mtproxy-links -n "${NAMESPACE}" \
|
||||||
|
--from-literal="${SERVER}=${LINK}"
|
||||||
|
fi
|
||||||
|
echo "Done"
|
||||||
containers:
|
containers:
|
||||||
- name: mtproxy
|
- name: mtproxy
|
||||||
image: ultradesu/mtproxy:v0.02
|
image: ultradesu/mtproxy:v0.02
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ spec:
|
|||||||
data:
|
data:
|
||||||
SECRET: |-
|
SECRET: |-
|
||||||
{{ .secret }}
|
{{ .secret }}
|
||||||
PORT: 30443
|
PORT: "30443"
|
||||||
data:
|
data:
|
||||||
- secretKey: secret
|
- secretKey: secret
|
||||||
sourceRef:
|
sourceRef:
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ kind: Kustomization
|
|||||||
|
|
||||||
resources:
|
resources:
|
||||||
- ./app.yaml
|
- ./app.yaml
|
||||||
|
- ./rbac.yaml
|
||||||
- ./daemonset.yaml
|
- ./daemonset.yaml
|
||||||
- ./external-secrets.yaml
|
- ./external-secrets.yaml
|
||||||
|
- ./service.yaml
|
||||||
|
- ./secret-reader.yaml
|
||||||
# - ./storage.yaml
|
# - ./storage.yaml
|
||||||
# - ./service.yaml
|
|
||||||
|
|||||||
58
k8s/apps/mtproxy/rbac.yaml
Normal file
58
k8s/apps/mtproxy/rbac.yaml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: mtproxy
|
||||||
|
labels:
|
||||||
|
app: mtproxy
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: mtproxy-node-reader
|
||||||
|
labels:
|
||||||
|
app: mtproxy
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["nodes"]
|
||||||
|
verbs: ["get", "list"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: mtproxy-node-reader
|
||||||
|
labels:
|
||||||
|
app: mtproxy
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: mtproxy-node-reader
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: mtproxy
|
||||||
|
namespace: mtproxy
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: mtproxy-secret-manager
|
||||||
|
labels:
|
||||||
|
app: mtproxy
|
||||||
|
rules:
|
||||||
|
- apiGroups: [""]
|
||||||
|
resources: ["secrets"]
|
||||||
|
verbs: ["get", "create", "patch"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: mtproxy-secret-manager
|
||||||
|
labels:
|
||||||
|
app: mtproxy
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: mtproxy-secret-manager
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: mtproxy
|
||||||
63
k8s/apps/mtproxy/secret-reader.yaml
Normal file
63
k8s/apps/mtproxy/secret-reader.yaml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: secret-reader
|
||||||
|
labels:
|
||||||
|
app: secret-reader
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: secret-reader
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: secret-reader
|
||||||
|
spec:
|
||||||
|
serviceAccountName: mtproxy
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/os: linux
|
||||||
|
containers:
|
||||||
|
- name: secret-reader
|
||||||
|
image: ultradesu/k8s-secrets:0.2.1
|
||||||
|
imagePullPolicy: Always
|
||||||
|
args:
|
||||||
|
- "--secrets"
|
||||||
|
- "mtproxy-links"
|
||||||
|
- "--namespace"
|
||||||
|
- "mtproxy"
|
||||||
|
- "--port"
|
||||||
|
- "3000"
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
name: http
|
||||||
|
env:
|
||||||
|
- name: RUST_LOG
|
||||||
|
value: "info"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "64Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "150m"
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: http
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: mtproxy
|
name: secret-reader
|
||||||
|
labels:
|
||||||
|
app: secret-reader
|
||||||
spec:
|
spec:
|
||||||
type: LoadBalancer
|
type: ClusterIP
|
||||||
selector:
|
selector:
|
||||||
app: mtproxy
|
app: secret-reader
|
||||||
ports:
|
ports:
|
||||||
- name: proxy
|
- port: 80
|
||||||
port: 30443
|
targetPort: 3000
|
||||||
targetPort: 30443
|
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
nodePort: 30443
|
name: http
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user