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

Calico apiserver improvements #3481

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions api/v1/apiserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ type APIServerDeploymentPodSpec struct {
// WARNING: Please note that this field will override the default API server Deployment tolerations.
// +optional
Tolerations []v1.Toleration `json:"tolerations,omitempty"`

// PriorityClassName allows to specify a PriorityClass resource to be used.
// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
}

// APIServerDeploymentPodTemplateSpec is the API server Deployment's PodTemplateSpec
Expand Down Expand Up @@ -304,5 +308,11 @@ func (c *APIServerDeployment) GetDeploymentStrategy() *appsv1.DeploymentStrategy
}

func (c *APIServerDeployment) GetPriorityClassName() string {
if c.Spec.Template != nil {
if c.Spec.Template.Spec != nil {
return c.Spec.Template.Spec.PriorityClassName
}
}

return ""
}
4 changes: 4 additions & 0 deletions pkg/crds/operator/operator.tigera.io_apiservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,10 @@ spec:
If omitted, the API server Deployment will use its default value for nodeSelector.
WARNING: Please note that this field will modify the default API server Deployment nodeSelector.
type: object
priorityClassName:
description: PriorityClassName allows to specify a
PriorityClass resource to be used.
type: string
tolerations:
description: |-
Tolerations is the API server pod's tolerations.
Expand Down
3 changes: 2 additions & 1 deletion pkg/render/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ func (c *apiServerComponent) apiServerDeployment() *appsv1.Deployment {
Spec: appsv1.DeploymentSpec{
Replicas: c.cfg.Installation.ControlPlaneReplicas,
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RecreateDeploymentStrategyType,
Type: appsv1.RollingUpdateDeploymentStrategyType,
},
Selector: c.deploymentSelector(),
Template: corev1.PodTemplateSpec{
Expand All @@ -1050,6 +1050,7 @@ func (c *apiServerComponent) apiServerDeployment() *appsv1.Deployment {
InitContainers: initContainers,
Containers: containers,
Volumes: c.apiServerVolumes(),
PriorityClassName: c.priorityClassName(),
},
},
},
Expand Down
8 changes: 6 additions & 2 deletions pkg/render/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ var _ = Describe("API server rendering tests (Calico)", func() {
Value: "bar",
}

priorityclassname := "priority"

cfg.APIServer.APIServerDeployment = &operatorv1.APIServerDeployment{
Metadata: &operatorv1.Metadata{
Labels: map[string]string{"top-level": "label1"},
Expand Down Expand Up @@ -1986,8 +1988,9 @@ var _ = Describe("API server rendering tests (Calico)", func() {
NodeSelector: map[string]string{
"custom-node-selector": "value",
},
Affinity: affinity,
Tolerations: []corev1.Toleration{toleration},
Affinity: affinity,
Tolerations: []corev1.Toleration{toleration},
PriorityClassName: priorityclassname,
},
},
},
Expand Down Expand Up @@ -2047,6 +2050,7 @@ var _ = Describe("API server rendering tests (Calico)", func() {

Expect(d.Spec.Template.Spec.Tolerations).To(HaveLen(1))
Expect(d.Spec.Template.Spec.Tolerations[0]).To(Equal(toleration))
Expect(d.Spec.Template.Spec.PriorityClassName).To(Equal(priorityclassname))
})

It("should override a ControlPlaneNodeSelector when specified", func() {
Expand Down
Loading