diff --git a/infra/tailscale/deployment.yaml b/infra/tailscale/deployment.yaml new file mode 100644 index 0000000..b5b4a9a --- /dev/null +++ b/infra/tailscale/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tailscale-operator + namespace: tailscale + labels: + app.kubernetes.io/name: tailscale-operator +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: tailscale-operator + template: + metadata: + labels: + app.kubernetes.io/name: tailscale-operator + spec: + serviceAccountName: tailscale-operator + containers: + - name: operator + image: ghcr.io/tailscale/kubernetes-operator:v1.70.1 + env: + - name: TS_AUTH_KEY + valueFrom: + secretKeyRef: + name: tailscale-auth + key: TS_AUTH_KEY + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 100m + memory: 128Mi \ No newline at end of file diff --git a/infra/tailscale/namespace.yaml b/infra/tailscale/namespace.yaml new file mode 100644 index 0000000..3c17070 --- /dev/null +++ b/infra/tailscale/namespace.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: tailscale + labels: + app.kubernetes.io/name: tailscale + app.kubernetes.io/component: operator \ No newline at end of file diff --git a/infra/tailscale/rbac.yaml b/infra/tailscale/rbac.yaml new file mode 100644 index 0000000..18dd5c6 --- /dev/null +++ b/infra/tailscale/rbac.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: tailscale-operator + namespace: tailscale +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: tailscale-operator +rules: + - apiGroups: ["apps"] + resources: ["deployments", "statefulsets", "daemonsets"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: [""] + resources: ["services", "endpoints"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["policy.tailscale.com"] + resources: ["tailnets", "tailscales"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + - apiGroups: ["policy.tailscale.com"] + resources: ["tailnets/status", "tailscales/status"] + verbs: ["get", "update", "patch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: tailscale-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: tailscale-operator +subjects: + - kind: ServiceAccount + name: tailscale-operator + namespace: tailscale \ No newline at end of file diff --git a/infra/tailscale/tailnet-cr.yaml b/infra/tailscale/tailnet-cr.yaml new file mode 100644 index 0000000..8dd5795 --- /dev/null +++ b/infra/tailscale/tailnet-cr.yaml @@ -0,0 +1,9 @@ +apiVersion: policy.tailscale.com/v1alpha1 +kind: Tailnet +metadata: + name: default + namespace: tailscale +spec: + tagAuths: + - tag: k8s-tailscale-operator + approved: true \ No newline at end of file