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

[api] support pod priority classes #119

Merged
merged 1 commit into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ ClusterSpec defines the desired state for a M3 cluster to be converge to.
| securityContext | SecurityContext allows the user to specify a container-level security context. | *corev1.SecurityContext | false |
| labels | Labels sets the base labels that will be applied to resources created by the cluster. // TODO(schallert): design doc on labeling scheme. | map[string]string | false |
| tolerations | Tolerations sets the tolerations that will be applied to all M3DB pods. | []corev1.Toleration | false |
| priorityClassName | PriorityClassName sets the priority class for all M3DB pods. | string | false |

[Back to TOC](#table-of-contents)

Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/m3dboperator/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ type ClusterSpec struct {
// Tolerations sets the tolerations that will be applied to all M3DB pods.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// PriorityClassName sets the priority class for all M3DB pods.
// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
}

// IsolationGroup defines the name of zone as well attributes for the zone configuration
Expand Down
1 change: 1 addition & 0 deletions pkg/k8sops/fixtures/testM3DBCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spec:
fsGroup: 10
securityContext:
runAsUser: 20
priorityClassName: m3db-priority
etcdEndpoints:
- ep0
- ep1
Expand Down
1 change: 1 addition & 0 deletions pkg/k8sops/generators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func TestGenerateStatefulSet(t *testing.T) {
Labels: labels,
},
Spec: v1.PodSpec{
PriorityClassName: "m3db-priority",
SecurityContext: &v1.PodSecurityContext{
FSGroup: pointer.Int64Ptr(10),
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/k8sops/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ func NewBaseStatefulSet(ssName, isolationGroup string, cluster *myspec.M3DBClust
Labels: objLabels,
},
Spec: v1.PodSpec{
SecurityContext: cluster.Spec.PodSecurityContext,
PriorityClassName: cluster.Spec.PriorityClassName,
SecurityContext: cluster.Spec.PodSecurityContext,
Containers: []v1.Container{
{
Name: ssName,
Expand Down