Files
addons/virt/whereabouts/whereabouts_rbac.tf
2024-09-19 08:37:03 +02:00

92 lines
1.8 KiB
HCL

resource "kubectl_manifest" "ServiceAccount_whereabouts" {
yaml_body = <<-EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: whereabouts
namespace: ${var.namespace}
ownerReferences: ${jsonencode(var.install_owner)}
labels: ${jsonencode(local.common-labels)}
EOF
}
resource "kubectl_manifest" "ClusterRoleBinding_whereabouts" {
yaml_body = <<-EOF
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: whereabouts
labels: ${jsonencode(local.common-labels)}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: whereabouts-cni
subjects:
- kind: ServiceAccount
name: whereabouts
namespace: ${var.namespace}
EOF
}
resource "kubectl_manifest" "ClusterRole_whereabouts-cni" {
yaml_body = <<-EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: whereabouts-cni
labels: ${jsonencode(local.common-labels)}
rules:
- apiGroups:
- whereabouts.cni.cncf.io
resources:
- ippools
- overlappingrangeipreservations
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- '*'
- apiGroups:
- ''
resources:
- pods
verbs:
- list
- watch
- apiGroups:
- ''
resources:
- nodes
verbs:
- get
- apiGroups:
- k8s.cni.cncf.io
resources:
- network-attachment-definitions
verbs:
- get
- list
- watch
- apiGroups:
- ''
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- update
- get
EOF
}