Skip to content

Commit

Permalink
fix plugin use listers listing resource failed
Browse files Browse the repository at this point in the history
Signed-off-by: xilinxing <xilinxing@huawei.com>
  • Loading branch information
xilinxing committed Sep 23, 2022
1 parent f99b1e3 commit 89d17bc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
9 changes: 6 additions & 3 deletions installer/helm/chart/volcano/templates/scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ rules:
resources: ["persistentvolumes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["list", "watch"]
resources: ["namespaces", "services", "replicationcontrollers"]
verbs: ["list", "watch", "get"]
- apiGroups: [""]
resources: ["resourcequotas"]
verbs: ["list", "watch"]
Expand Down Expand Up @@ -72,6 +72,9 @@ rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "create", "delete", "update"]
- apiGroups: ["apps"]
resources: ["daemonsets", "replicasets", "statefulsets"]
verbs: ["list", "watch", "get"]

---
kind: ClusterRoleBinding
Expand Down Expand Up @@ -138,7 +141,7 @@ metadata:
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
name: {{ .Release.Name }}-scheduler-service
namespace: {{ .Release.Namespace }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 8080
Expand Down
10 changes: 7 additions & 3 deletions installer/volcano-development-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ spec:
priorityClassName: system-cluster-critical
containers:
- args:
- --enabled-admission=/jobs/mutate,/jobs/validate,/podgroups/mutate,/pods/validate,/pods/mutate,/queues/mutate,/queues/validate
- --tls-cert-file=/admission.local.config/certificates/tls.crt
- --tls-private-key-file=/admission.local.config/certificates/tls.key
- --ca-cert-file=/admission.local.config/certificates/ca.crt
Expand Down Expand Up @@ -8565,8 +8566,8 @@ rules:
resources: ["persistentvolumes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["list", "watch"]
resources: ["namespaces", "services", "replicationcontrollers"]
verbs: ["list", "watch", "get"]
- apiGroups: [""]
resources: ["resourcequotas"]
verbs: ["list", "watch"]
Expand Down Expand Up @@ -8594,6 +8595,9 @@ rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "create", "delete", "update"]
- apiGroups: ["apps"]
resources: ["daemonsets", "replicasets", "statefulsets"]
verbs: ["list", "watch", "get"]
---
# Source: volcano/templates/scheduler.yaml
kind: ClusterRoleBinding
Expand All @@ -8618,7 +8622,7 @@ metadata:
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
name: volcano-scheduler-service
namespace: volcano-system
namespace: volcano-system
spec:
ports:
- port: 8080
Expand Down
9 changes: 6 additions & 3 deletions installer/volcano-development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8566,8 +8566,8 @@ rules:
resources: ["persistentvolumes"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["list", "watch"]
resources: ["namespaces", "services", "replicationcontrollers"]
verbs: ["list", "watch", "get"]
- apiGroups: [""]
resources: ["resourcequotas"]
verbs: ["list", "watch"]
Expand Down Expand Up @@ -8595,6 +8595,9 @@ rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "create", "delete", "update"]
- apiGroups: ["apps"]
resources: ["daemonsets", "replicasets", "statefulsets"]
verbs: ["list", "watch", "get"]
---
# Source: volcano/templates/scheduler.yaml
kind: ClusterRoleBinding
Expand All @@ -8619,7 +8622,7 @@ metadata:
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
name: volcano-scheduler-service
namespace: volcano-system
namespace: volcano-system
spec:
ports:
- port: 8080
Expand Down
7 changes: 7 additions & 0 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,13 @@ func newSchedulerCache(config *rest.Config, schedulerNames []string, defaultQueu
UpdateFunc: sc.UpdateNumaInfoV1alpha1,
DeleteFunc: sc.DeleteNumaInfoV1alpha1,
})
// explictly register informers to the factory, otherwise resources listers cannot get anything
// even with no erorr returned.
informerFactory.Core().V1().Namespaces().Informer()
informerFactory.Core().V1().Services().Informer()
informerFactory.Core().V1().ReplicationControllers().Informer()
informerFactory.Apps().V1().ReplicaSets().Informer()
informerFactory.Apps().V1().StatefulSets().Informer()
return sc
}

Expand Down

0 comments on commit 89d17bc

Please sign in to comment.