# 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:
  - 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:
      hostNetwork: true
      tolerations:
      - effect: NoSchedule
        operator: Exists
        key: node-role.kubernetes.io/master
      - effect: NoSchedule
        operator: Exists
        key: node.cloudprovider.kubernetes.io/uninitialized
      nodeSelector:
         node-role.kubernetes.io/master: ""
      serviceAccount: k8s-neuron-scheduler
      containers:
        - name: neuron-scheduler
          # Find all neuron-scheduler images at https://gallery.ecr.aws/neuron/neuron-scheduler
          image: public.ecr.aws/neuron/neuron-scheduler:2.19.16.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:
  type: NodePort
  ports:
  - port: 12345
    name: http
    targetPort: 12345
    nodePort: 32700
  selector:
    # select app=ingress-nginx pods
    app: neuron-scheduler
    component: k8s-neuron-scheduler   
