Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High privileged PriorityClass causes some errors on import #98

Closed
196Ikuchil opened this issue Feb 9, 2022 · 1 comment · Fixed by #108
Closed

High privileged PriorityClass causes some errors on import #98

196Ikuchil opened this issue Feb 9, 2022 · 1 comment · Fixed by #108
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@196Ikuchil
Copy link
Contributor

There are 2 problems with import function of ExportService.

1. The default existing PriorityClass conflicts.

When the scheduler is restarted, 2 PriorityClassthat issystem-cluster-critical and system-node-critical will be created automatically.
The import function of ExportService calls that restart logic, at first. This means that the 2 PriorityClass are recreated before import logic.

And exported resources file(export.yml) from the export function also includes the 2 PriorityClass.
Therefore, the names of these PriorityClass are in conflict when importing the resources file(export.yml).

E0209 22:41:50.712897   74340 export.go:57] failed to import all resources: import resources all:
    github.com/kubernetes-sigs/kube-scheduler-simulator/export.(*Service).Import
        /Users/username/kube-scheduler-simulator/export/export.go:225
  - apply resources:
    github.com/kubernetes-sigs/kube-scheduler-simulator/export.(*Service).apply
        /Users/username/kube-scheduler-simulator/export/export.go:196
  - apply PriorityClass:
    github.com/kubernetes-sigs/kube-scheduler-simulator/export.(*Service).applyPcs.func1
        /Users/username/kube-scheduler-simulator/export/export.go:369
  - apply priorityClass:
    github.com/kubernetes-sigs/kube-scheduler-simulator/priorityclass.(*Service).Apply
        /Users/username/kube-scheduler-simulator/priorityclass/priorityclass.go:47
  - Operation cannot be fulfilled on priorityclasses.scheduling.k8s.io "system-cluster-critical": the object has been modified; please apply your changes to the latest version and try again
{"time":"2022-02-09T22:41:50.713011+09:00","id":"","remote_ip":"127.0.0.1","host":"localhost:1212","method":"POST","uri":"/api/v1/import","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0","status":500,"error":"code=500, message=Internal Server Error","latency":147452615,"latency_human":"147.452615ms","bytes_in":6097,"bytes_out":36}

2. Permission to create the priorityclass

The import function tries to create a priority class that names with 'system-' prefix when an imported resources file includes PriorityClass like a system-cluster-critical or system-node-critical.
But that gets this permission's error.

E0209 22:58:57.957848   74651 priorityclass.go:36] failed to apply priorityClass: apply priorityClass:
    github.com/kubernetes-sigs/kube-scheduler-simulator/priorityclass.(*Service).Apply
        /Users/username/kube-scheduler-simulator/priorityclass/priorityclass.go:47
  - PriorityClass.scheduling.k8s.io "system-priority-class1" is invalid: metadata.name: Forbidden: priority class names with 'system-' prefix are reserved for system use only. error: system-priority-class1 is not a known system priority class

Would you give me some good ideas, please?

/kind bug
/assign

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 9, 2022
@sanposhiho
Copy link
Member

I suggest not to export system-cluster-critical and system-node-critical. They are created automatically, so exporting them doesn't make much sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
3 participants