Skip to content

Commit

Permalink
Merge pull request #274 from danmanners/feature/tailscale
Browse files Browse the repository at this point in the history
Adding tailscale operator
  • Loading branch information
danmanners authored Nov 6, 2023
2 parents 927cd47 + 645fb0d commit 6ca16e7
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/workloads/applicationset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ spec:
- appName: webssh
namespace: webssh
targetRev: main
- appName: tailscale
namespace: networking
targetRev: main
template:
metadata:
name: '{{appName}}'
Expand Down
62 changes: 62 additions & 0 deletions manifests/workloads/tailscale/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# https://github.com/tailscale/tailscale/blob/ed1b935238a7c6cce3aa4865aa13181eb679361a/cmd/k8s-operator/deploy/chart/templates/deployment.yaml
# Copyright (c) Tailscale Inc & AUTHORS
# SPDX-License-Identifier: BSD-3-Clause

apiVersion: apps/v1
kind: Deployment
metadata:
name: operator
namespace: networking
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: operator
template:
metadata:
labels:
app: operator
spec:
serviceAccountName: operator
securityContext: {}
volumes:
- name: oauth
secret:
secretName: operator-oauth
containers:
- name: operator
securityContext: {}
resources: {}
image: k8s-operator:replaceme
imagePullPolicy: IfNotPresent
env:
- name: OPERATOR_HOSTNAME
value: tailscale-operator
- name: OPERATOR_SECRET
value: operator
- name: OPERATOR_LOGGING
value: info # warning, info, debug
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CLIENT_ID_FILE
value: /oauth/client_id
- name: CLIENT_SECRET_FILE
value: /oauth/client_secret
- name: PROXY_IMAGE
value: tailscale-image:replaceme
- name: PROXY_TAGS
value: tag:k8s
- name: APISERVER_PROXY
value: "true"
- name: PROXY_FIREWALL_MODE
value: auto # Leave this for now
volumeMounts:
- name: oauth
mountPath: /oauth
readOnly: true
nodeSelector:
kubernetes.io/os: linux
18 changes: 18 additions & 0 deletions manifests/workloads/tailscale/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: networking

resources:
- deployment.yaml
- rbac-apiserverproxy.yaml
- rbac-operator.yaml
- rbac-proxy.yaml
- secret.yaml

images:
- name: k8s-operator:replaceme
newName: core.harbor.homelab.danmanners.com/docker.io/tailscale/k8s-operator
newTag: unstable-v1.53
- name: k8s-operator:replaceme
newName: core.harbor.homelab.danmanners.com/docker.io/tailscale/k8s-operator
newTag: unstable-v1.53
22 changes: 22 additions & 0 deletions manifests/workloads/tailscale/rbac-apiserverproxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://github.com/tailscale/tailscale/blob/ed1b935238a7c6cce3aa4865aa13181eb679361a/cmd/k8s-operator/deploy/chart/templates/apiserverproxy-rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tailscale-auth-proxy
rules:
- apiGroups: [""]
resources: ["users", "groups"]
verbs: ["impersonate"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tailscale-auth-proxy
subjects:
- kind: ServiceAccount
name: operator
namespace: networking
roleRef:
kind: ClusterRole
name: tailscale-auth-proxy
apiGroup: rbac.authorization.k8s.io
58 changes: 58 additions & 0 deletions manifests/workloads/tailscale/rbac-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://github.com/tailscale/tailscale/blob/ed1b935238a7c6cce3aa4865aa13181eb679361a/cmd/k8s-operator/deploy/chart/templates/operator-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: operator
namespace: networking
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tailscale-operator
rules:
- apiGroups: [""]
resources: ["events", "services", "services/status"]
verbs: ["*"]
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses", "ingresses/status"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tailscale-operator
subjects:
- kind: ServiceAccount
name: operator
namespace: networking
roleRef:
kind: ClusterRole
name: tailscale-operator
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: operator
namespace: networking
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["*"]
- apiGroups: ["apps"]
resources: ["statefulsets"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: operator
namespace: networking
subjects:
- kind: ServiceAccount
name: operator
namespace: networking
roleRef:
kind: Role
name: operator
apiGroup: rbac.authorization.k8s.io
30 changes: 30 additions & 0 deletions manifests/workloads/tailscale/rbac-proxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://github.com/tailscale/tailscale/blob/ed1b935238a7c6cce3aa4865aa13181eb679361a/cmd/k8s-operator/deploy/chart/templates/proxy-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: proxies
namespace: networking
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: proxies
namespace: networking
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: proxies
namespace: networking
subjects:
- kind: ServiceAccount
name: proxies
namespace: networking
roleRef:
kind: Role
name: proxies
apiGroup: rbac.authorization.k8s.io
5 changes: 5 additions & 0 deletions manifests/workloads/tailscale/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Quick Notes

Maybe this works, maybe it doesn't? We'll figure it out. We're all adults here.

## _I think..._
17 changes: 17 additions & 0 deletions manifests/workloads/tailscale/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
creationTimestamp: null
name: operator-oauth
namespace: networking
spec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JhbXWluEEh5Oalq8dFJESSOKZ+IO1r64qPqqoyjdPNTybc5qxKw4JvI0yHa80PWUdhXkeCEuIhSL4bS+F+Tm6szxMvyJIoq17xuiOR1gVHmXBA/7LFluVmHry/SzC/MxjJaKl7YKwicht3S/L8LPC8CAdfpahtZaZen292dltPMYcgEYh9TgjQaQE/oELzZaOqPNgrBAlkBK+xJWBFtUs8Da4BPxX8zHCYcraLRRrwivmpBUh9qV8RzkCHTHosliUf42XMcOmioe1ezzvNZNkolS68MenfwWZ8afk1d5S3xJ8/NPflEqYtZKZXb+TF9jiSkaPdoiQrP4kR9eGA/d/JVcBmUv0lAgW3jwtN0XcmxINrLDjEUsCu/SpWtWS5o6aLzOlbpVXouFryiR7Ifd0O1X9syn7PMT7WinSLATXPfKc0TJ9ZbG8qdYEXjWIz
template:
metadata:
creationTimestamp: null
name: operator-oauth
namespace: networking
type: Opaque

0 comments on commit 6ca16e7

Please sign in to comment.