# services/bstein-dev-home/rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: bstein-dev-home
  namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: bstein-dev-home-ai-reader
rules:
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list", "watch"]
    resourceNames: []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: bstein-dev-home-ai-reader
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: bstein-dev-home-ai-reader
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: bstein-dev-home-vaultwarden-admin-secret-reader
rules:
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get"]
    resourceNames: ["vaultwarden-admin"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: bstein-dev-home-vaultwarden-admin-secret-reader
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: bstein-dev-home-vaultwarden-admin-secret-reader
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: bstein-dev-home-vaultwarden-admin-token-reader
  namespace: vaultwarden
rules:
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get"]
    resourceNames: ["vaultwarden-admin"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: bstein-dev-home-vaultwarden-admin-token-reader
  namespace: vaultwarden
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: bstein-dev-home-vaultwarden-admin-token-reader
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: bstein-dev-home-nextcloud-mail-sync
  namespace: nextcloud
rules:
  - apiGroups: ["batch"]
    resources: ["cronjobs"]
    verbs: ["get"]
    resourceNames: ["nextcloud-mail-sync"]
  - apiGroups: ["batch"]
    resources: ["jobs"]
    verbs: ["create", "get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: bstein-dev-home-nextcloud-mail-sync
  namespace: nextcloud
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: bstein-dev-home-nextcloud-mail-sync
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: bstein-dev-home-wger-user-sync
  namespace: health
rules:
  - apiGroups: ["batch"]
    resources: ["cronjobs"]
    verbs: ["get"]
    resourceNames: ["wger-user-sync"]
  - apiGroups: ["batch"]
    resources: ["jobs"]
    verbs: ["create", "get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: bstein-dev-home-wger-user-sync
  namespace: health
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: bstein-dev-home-wger-user-sync
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: bstein-dev-home-firefly-user-sync
  namespace: finance
rules:
  - apiGroups: ["batch"]
    resources: ["cronjobs"]
    verbs: ["get"]
    resourceNames: ["firefly-user-sync"]
  - apiGroups: ["batch"]
    resources: ["jobs"]
    verbs: ["create", "get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: bstein-dev-home-firefly-user-sync
  namespace: finance
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: bstein-dev-home-firefly-user-sync
subjects:
  - kind: ServiceAccount
    name: bstein-dev-home
    namespace: bstein-dev-home
