# rbac.yaml
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: k8s-neuron-scheduler
rules:
- apiGroups:
  - ""
  resources:
  - nodes
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - nodes/status
  verbs:
  - update
  - patch
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - patch
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - update
  - patch
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - bindings
  - pods/binding
  verbs:
  - create
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: k8s-neuron-scheduler
  namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: k8s-neuron-scheduler
  namespace: kube-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: k8s-neuron-scheduler
subjects:
- kind: ServiceAccount
  name: k8s-neuron-scheduler
  namespace: kube-system

# deployment yaml
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: k8s-neuron-scheduler
  namespace: kube-system
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
        app: neuron-scheduler
        component: k8s-neuron-scheduler
  template:
    metadata:
      labels:
        app: neuron-scheduler
        component: k8s-neuron-scheduler
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      serviceAccount: k8s-neuron-scheduler
      schedulerName: my-scheduler
      containers:
        - name: neuron-scheduler-exp
          image: public.ecr.aws/neuron/neuron-scheduler:2.12.5.0
          env:
          - name: PORT
            value: "12345"

# service.yaml            
---
apiVersion: v1
kind: Service
metadata:
  name: k8s-neuron-scheduler
  namespace: kube-system
  labels:
    app: neuron-scheduler
    component: k8s-neuron-scheduler
spec:
  ports:
  - port: 12345
    name: http
    targetPort: 12345
  selector:
    # select app=ingress-nginx pods
    app: neuron-scheduler
    component: k8s-neuron-scheduler   
