Skip to content

Commit

Permalink
[api] support pod priority classes
Browse files Browse the repository at this point in the history
  • Loading branch information
schallert committed Apr 8, 2019
1 parent 72037d8 commit 5f95784
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
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

0 comments on commit 5f95784

Please sign in to comment.