2021-11-04 19:01:50 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: host-mappings
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
|
|
|
app: proxy
|
|
|
|
data:
|
|
|
|
mapping.json: |
|
|
|
|
{
|
2021-11-07 05:30:13 +00:00
|
|
|
"tekton-el.auth-proxy.svc": "tekton-el.cluster.local",
|
|
|
|
"home.auth-proxy.svc": "home.cluster.local",
|
2021-11-13 10:14:48 +00:00
|
|
|
"home.cluster.fun": "home.cluster.local",
|
2021-11-18 07:20:36 +00:00
|
|
|
"prometheus.auth-proxy.svc": "prometheus.cluster.local",
|
2021-11-27 20:05:02 +00:00
|
|
|
"loki.auth-proxy.svc": "loki.cluster.local",
|
|
|
|
"loki.auth-proxy.svc:80": "loki.cluster.local"
|
2021-11-04 19:01:50 +00:00
|
|
|
}
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2021-11-08 06:29:28 +00:00
|
|
|
name: internal-proxy
|
2021-11-04 19:01:50 +00:00
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: internal-proxy
|
2021-11-07 05:36:03 +00:00
|
|
|
annotations:
|
|
|
|
configmap.reloader.stakater.com/reload: "host-mappings"
|
2021-11-04 19:01:50 +00:00
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: internal-proxy
|
2021-11-04 19:01:50 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: internal-proxy
|
2021-11-04 19:01:50 +00:00
|
|
|
spec:
|
|
|
|
dnsPolicy: None
|
|
|
|
dnsConfig:
|
|
|
|
nameservers:
|
|
|
|
- 100.100.100.100
|
|
|
|
containers:
|
|
|
|
- name: proxy
|
|
|
|
image: docker.cluster.fun/averagemarcus/proxy:latest
|
|
|
|
imagePullPolicy: Always
|
|
|
|
env:
|
|
|
|
- name: PROXY_DESTINATION
|
|
|
|
value: talos.averagemarcus.github.beta.tailscale.net
|
|
|
|
- name: PORT
|
|
|
|
value: "8080"
|
|
|
|
ports:
|
|
|
|
- containerPort: 8080
|
|
|
|
protocol: TCP
|
|
|
|
volumeMounts:
|
|
|
|
- name: host-mappings
|
|
|
|
mountPath: /config/
|
|
|
|
- name: tailscale
|
|
|
|
image: ghcr.io/tailscale/tailscale:latest
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
env:
|
|
|
|
- name: AUTH_KEY
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: tailscale-auth
|
|
|
|
key: password
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_ADMIN
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
export PATH=$PATH:/tailscale/bin
|
|
|
|
if [[ ! -d /dev/net ]]; then mkdir -p /dev/net; fi
|
|
|
|
if [[ ! -c /dev/net/tun ]]; then mknod /dev/net/tun c 10 200; fi
|
|
|
|
echo "Starting tailscaled"
|
|
|
|
tailscaled --socket=/tmp/tailscaled.sock &
|
|
|
|
PID=$!
|
|
|
|
echo "Running tailscale up"
|
|
|
|
tailscale --socket=/tmp/tailscaled.sock up \
|
|
|
|
--accept-dns=true \
|
|
|
|
--authkey=${AUTH_KEY} \
|
|
|
|
--hostname=auth-proxy
|
|
|
|
wait ${PID}
|
|
|
|
volumes:
|
|
|
|
- name: host-mappings
|
|
|
|
configMap:
|
|
|
|
name: host-mappings
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: tekton-el
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: internal-proxy
|
2021-11-04 19:01:50 +00:00
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: internal-proxy
|
2021-11-04 19:01:50 +00:00
|
|
|
type: ClusterIP
|
|
|
|
---
|
2021-11-27 13:35:19 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: loki
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
|
|
|
app: internal-proxy
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
|
|
|
app: internal-proxy
|
|
|
|
type: ClusterIP
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: prometheus
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
|
|
|
app: internal-proxy
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
|
|
|
app: internal-proxy
|
|
|
|
type: ClusterIP
|
|
|
|
---
|
2021-11-08 06:29:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: non-auth-proxy
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
|
|
|
app: non-auth-proxy
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: non-auth-proxy
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: non-auth-proxy
|
|
|
|
spec:
|
|
|
|
dnsPolicy: None
|
|
|
|
dnsConfig:
|
|
|
|
nameservers:
|
|
|
|
- 100.100.100.100
|
|
|
|
containers:
|
|
|
|
- name: oauth-proxy
|
|
|
|
image: quay.io/oauth2-proxy/oauth2-proxy:v7.2.0
|
|
|
|
args:
|
|
|
|
- --cookie-secure=false
|
|
|
|
- --provider=oidc
|
|
|
|
- --provider-display-name=Auth0
|
|
|
|
- --upstream=http://talos.averagemarcus.github.beta.tailscale.net
|
|
|
|
- --http-address=0.0.0.0:8080
|
|
|
|
- --email-domain=*
|
|
|
|
- --pass-basic-auth=false
|
|
|
|
- --pass-access-token=false
|
|
|
|
- --oidc-issuer-url=https://marcusnoble.eu.auth0.com/
|
|
|
|
- --cookie-secret=KDGD6rrK6cBmryyZ4wcJ9xAUNW9AQNFT
|
|
|
|
- --cookie-expire=336h0m0s
|
|
|
|
- --trusted-ip=0.0.0.0/0
|
|
|
|
env:
|
|
|
|
- name: HOST_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
apiVersion: v1
|
|
|
|
fieldPath: status.podIP
|
|
|
|
- name: OAUTH2_PROXY_CLIENT_ID
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: username
|
|
|
|
name: auth-proxy
|
|
|
|
- name: OAUTH2_PROXY_CLIENT_SECRET
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: password
|
|
|
|
name: auth-proxy
|
|
|
|
ports:
|
|
|
|
- containerPort: 8080
|
|
|
|
protocol: TCP
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: 50Mi
|
|
|
|
requests:
|
|
|
|
memory: 50Mi
|
|
|
|
- name: tailscale
|
|
|
|
image: ghcr.io/tailscale/tailscale:latest
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
env:
|
|
|
|
- name: AUTH_KEY
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: tailscale-auth
|
|
|
|
key: password
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_ADMIN
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
export PATH=$PATH:/tailscale/bin
|
|
|
|
if [[ ! -d /dev/net ]]; then mkdir -p /dev/net; fi
|
|
|
|
if [[ ! -c /dev/net/tun ]]; then mknod /dev/net/tun c 10 200; fi
|
|
|
|
echo "Starting tailscaled"
|
|
|
|
tailscaled --socket=/tmp/tailscaled.sock &
|
|
|
|
PID=$!
|
|
|
|
echo "Running tailscale up"
|
|
|
|
tailscale --socket=/tmp/tailscaled.sock up \
|
|
|
|
--accept-dns=true \
|
|
|
|
--authkey=${AUTH_KEY} \
|
|
|
|
--hostname=auth-proxy
|
|
|
|
echo "Re-enabling incoming traffic from the cluster"
|
|
|
|
wait ${PID}
|
|
|
|
---
|
2021-11-07 05:30:13 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
2021-11-08 06:29:28 +00:00
|
|
|
name: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
type: ClusterIP
|
|
|
|
---
|
|
|
|
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
kind: Ingress
|
|
|
|
metadata:
|
|
|
|
name: non-auth-proxy
|
|
|
|
namespace: auth-proxy
|
|
|
|
annotations:
|
|
|
|
cert-manager.io/cluster-issuer: letsencrypt
|
|
|
|
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
|
|
|
|
spec:
|
|
|
|
ingressClassName: nginx
|
|
|
|
tls:
|
|
|
|
- hosts:
|
|
|
|
- home.cluster.fun
|
|
|
|
secretName: non-auth-proxy-ingress
|
|
|
|
rules:
|
|
|
|
- host: home.cluster.fun
|
|
|
|
http:
|
|
|
|
paths:
|
|
|
|
- path: /
|
|
|
|
pathType: ImplementationSpecific
|
|
|
|
backend:
|
|
|
|
service:
|
2021-11-08 06:29:28 +00:00
|
|
|
name: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
port:
|
|
|
|
name: http
|