-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ceph: added priority classes to components
Adds priority class support to Ceph components to influence scheduler's pod preemption Signed-off-by: d-luu <[email protected]>
- Loading branch information
Showing
53 changed files
with
377 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,4 @@ spec: | |
# requests: | ||
# cpu: "500m" | ||
# memory: "1024Mi" | ||
# priorityClassName: my-priority-class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,4 @@ spec: | |
# requests: | ||
# cpu: "500m" | ||
# memory: "1024Mi" | ||
# priorityClassName: my-priority-class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,4 @@ spec: | |
# requests: | ||
# cpu: "500m" | ||
# memory: "1024Mi" | ||
# priorityClassName: my-priority-class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,4 @@ spec: | |
# requests: | ||
# cpu: "500m" | ||
# memory: "1024Mi" | ||
# priorityClassName: my-priority-class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,4 @@ spec: | |
# requests: | ||
# cpu: "500m" | ||
# memory: "1024Mi" | ||
# priorityClassName: my-priority-class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Copyright 2019 The Rook Authors. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
rook "github.com/rook/rook/pkg/apis/rook.io/v1alpha2" | ||
) | ||
|
||
// GetMgrPriorityClassName returns the priority class name for the MGR service | ||
func GetMgrPriorityClassName(p rook.PriorityClassNamesSpec) string { | ||
if _, ok := p[KeyMgr]; !ok { | ||
return p.All() | ||
} | ||
return p[KeyMgr] | ||
} | ||
|
||
// GetMonPriorityClassName returns the priority class name for the monitors | ||
func GetMonPriorityClassName(p rook.PriorityClassNamesSpec) string { | ||
if _, ok := p[KeyMon]; !ok { | ||
return p.All() | ||
} | ||
return p[KeyMon] | ||
} | ||
|
||
// GetOSDPriorityClassName returns the priority class name for the OSDs | ||
func GetOSDPriorityClassName(p rook.PriorityClassNamesSpec) string { | ||
if _, ok := p[KeyOSD]; !ok { | ||
return p.All() | ||
} | ||
return p[KeyOSD] | ||
} | ||
|
||
// GetRBDMirrorPriorityClassName returns the priority class name for the RBD Mirrors | ||
func GetRBDMirrorPriorityClassName(p rook.PriorityClassNamesSpec) string { | ||
if _, ok := p[KeyRBDMirror]; !ok { | ||
return p.All() | ||
} | ||
return p[KeyRBDMirror] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Copyright 2019 The Rook Authors. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
// All returns the priority class name defined for 'all' daemons in the Ceph cluster CRD. | ||
func (p PriorityClassNamesSpec) All() string { | ||
if val, ok := p[KeyAll]; ok { | ||
return val | ||
} | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2019 The Rook Authors. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha2 | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/ghodss/yaml" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestPriorityClassNamesSpec(t *testing.T) { | ||
specYaml := []byte(` | ||
all: all-class | ||
mgr: mgr-class | ||
mon: mon-class | ||
osd: osd-class | ||
`) | ||
|
||
// convert the raw spec yaml into JSON | ||
rawJSON, err := yaml.YAMLToJSON(specYaml) | ||
assert.Nil(t, err) | ||
|
||
// unmarshal the JSON into a strongly typed annotations spec object | ||
var priorityClassNames PriorityClassNamesSpec | ||
err = json.Unmarshal(rawJSON, &priorityClassNames) | ||
assert.Nil(t, err) | ||
|
||
// the unmarshalled priority class names spec should equal the expected spec below | ||
expected := PriorityClassNamesSpec{ | ||
"all": "all-class", | ||
"mgr": "mgr-class", | ||
"mon": "mon-class", | ||
"osd": "osd-class", | ||
} | ||
assert.Equal(t, expected, priorityClassNames) | ||
} | ||
|
||
func TestPriorityClassNamesDefaultToAll(t *testing.T) { | ||
priorityClassNames := PriorityClassNamesSpec{ | ||
"all": "all-class", | ||
"mon": "mon-class", | ||
} | ||
|
||
assert.Equal(t, "all-class", priorityClassNames.All()) | ||
} |
Oops, something went wrong.