diff --git a/pkg/eventing/deployment.go b/pkg/eventing/deployment.go index dd4ff52b6..23c3d878a 100644 --- a/pkg/eventing/deployment.go +++ b/pkg/eventing/deployment.go @@ -39,6 +39,8 @@ const ( PublisherSecretEMSURLKey = "ems-publish-url" PublisherSecretBEBNamespaceKey = "beb-namespace" + + priorityClassName = "eventing-manager-priority-class" ) var ( @@ -57,6 +59,7 @@ func newNATSPublisherDeployment( WithNATSEnvVars(natsConfig, publisherConfig, eventing), WithLogEnvVars(publisherConfig, eventing), WithAffinity(GetPublisherDeploymentName(*eventing)), + WithPriorityClassName(priorityClassName), ) } @@ -70,6 +73,7 @@ func newEventMeshPublisherDeployment( WithContainers(publisherConfig, eventing), WithBEBEnvVars(GetPublisherDeploymentName(*eventing), publisherConfig, eventing), WithLogEnvVars(publisherConfig, eventing), + WithPriorityClassName(priorityClassName), ) } @@ -136,6 +140,12 @@ func WithLabels(publisherName string, backendType v1alpha1.BackendType) DeployOp } } +func WithPriorityClassName(name string) DeployOpt { + return func(deployment *appsv1.Deployment) { + deployment.Spec.Template.Spec.PriorityClassName = name + } +} + func WithAffinity(publisherName string) DeployOpt { return func(d *appsv1.Deployment) { d.Spec.Template.Spec.Affinity = &v1.Affinity{ diff --git a/pkg/eventing/deployment_test.go b/pkg/eventing/deployment_test.go index caf2dce7a..d136c7205 100644 --- a/pkg/eventing/deployment_test.go +++ b/pkg/eventing/deployment_test.go @@ -102,7 +102,8 @@ func Test_NewDeploymentSecurityContext(t *testing.T) { testutils.WithEventingCRNamespace("test-namespace"), ) deployment := newDeployment(givenEventing, config.PublisherConfig, - WithContainers(config.PublisherConfig, givenEventing)) + WithContainers(config.PublisherConfig, givenEventing), + ) // when podSecurityContext := deployment.Spec.Template.Spec.SecurityContext