apiVersion: v1
kind: ServiceAccount
metadata:
  name: network-aware-scheduler
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: network-aware-scheduler-handler
rules:
  - apiGroups: [ "scheduling.sigs.x-k8s.io" ]
    resources: [ "podgroups", "elasticquotas", "podgroups/status", "elasticquotas/status" ]
    verbs: [ "get", "list", "watch", "create", "delete", "update", "patch" ]
  - apiGroups: ["appgroup.diktyo.x-k8s.io"]
    resources: ["appgroups"]
    verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
  - apiGroups: ["networktopology.diktyo.x-k8s.io"]
    resources: ["networktopologies"]
    verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: network-aware-scheduler-as-kube-scheduler
subjects:
  - kind: ServiceAccount
    name: network-aware-scheduler
    namespace: kube-system
roleRef:
  kind: ClusterRole
  name: network-aware-scheduler-handler
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: my-scheduler-as-volume-scheduler
subjects:
- kind: ServiceAccount
  name: my-scheduler
  namespace: kube-system
roleRef:
  kind: ClusterRole
  name: system:volume-scheduler
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: network-aware-scheduler-as-kube-scheduler
  namespace: kube-system
subjects:
  - kind: ServiceAccount
    name: network-aware-scheduler
    namespace: kube-system
roleRef:
  kind: Role
  name: extension-apiserver-authentication-reader
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: networkawarescheduler
  namespace: kube-system
subjects:
- kind: User
  name: system:kube-scheduler
  namespace: kube-system
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: ClusterRole
  name: network-aware-scheduler-handler
  apiGroup: rbac.authorization.k8s.io
