Skip to content

Commit

Permalink
Merge branch 'main' into task/2190
Browse files Browse the repository at this point in the history
  • Loading branch information
iblancasa authored May 31, 2023
2 parents bf94b57 + 76b16a3 commit 548ce1d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/v1/jaeger_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ type JaegerAllInOneSpec struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Strategy"
Strategy *appsv1.DeploymentStrategy `json:"strategy,omitempty"`

// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
}

// AutoScaleSpec defines the common elements used for create HPAs
Expand Down
2 changes: 2 additions & 0 deletions bundle/manifests/jaegertracing.io_jaegers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,8 @@ spec:
options:
type: object
x-kubernetes-preserve-unknown-fields: true
priorityClassName:
type: string
resources:
nullable: true
properties:
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/jaegertracing.io_jaegers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,8 @@ spec:
options:
type: object
x-kubernetes-preserve-unknown-fields: true
priorityClassName:
type: string
resources:
nullable: true
properties:
Expand Down
7 changes: 7 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7312,6 +7312,13 @@ Resource Types:
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>priorityClassName</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b><a href="#jaegerspecallinoneresources">resources</a></b></td>
<td>object</td>
Expand Down
17 changes: 17 additions & 0 deletions examples/all-in-one-with-priority-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority # priorityClassName here
value: 1000000
globalDefault: false
description: "This priority class should be used for XYZ service pods only."
---
apiVersion: jaegertracing.io/v1
kind: "Jaeger"
metadata:
name: "my-jaeger"
spec:
strategy: allInOne
allInOne:
image: jaegertracing/all-in-one:1.30.0
priorityClassName: high-priority # priorityClassName here
6 changes: 6 additions & 0 deletions pkg/deployment/all_in_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func (a *AllInOne) Get() *appsv1.Deployment {
strategy = *a.jaeger.Spec.AllInOne.Strategy
}

priorityClassName := ""
if a.jaeger.Spec.AllInOne.PriorityClassName != "" {
priorityClassName = a.jaeger.Spec.AllInOne.PriorityClassName
}

livenessProbe := &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Expand Down Expand Up @@ -246,6 +251,7 @@ func (a *AllInOne) Get() *appsv1.Deployment {
ImagePullPolicy: commonSpec.ImagePullPolicy,
SecurityContext: commonSpec.ContainerSecurityContext,
}},
PriorityClassName: priorityClassName,
Volumes: commonSpec.Volumes,
ServiceAccountName: account.JaegerServiceAccountFor(a.jaeger, account.AllInOneComponent),
Affinity: commonSpec.Affinity,
Expand Down
9 changes: 9 additions & 0 deletions pkg/deployment/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ func TestAllInOneContainerSecurityContextOverride(t *testing.T) {
assert.Equal(t, overrideSecurityContextVar, *dep.Spec.Template.Spec.Containers[0].SecurityContext)
}

func TestAllInOnePriorityClassName(t *testing.T) {
priorityClassName := "test-class"
jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"})
jaeger.Spec.AllInOne.PriorityClassName = priorityClassName
a := NewAllInOne(jaeger)
dep := a.Get()
assert.Equal(t, priorityClassName, dep.Spec.Template.Spec.PriorityClassName)
}

func getEnvVarByName(vars []corev1.EnvVar, name string) corev1.EnvVar {
envVar := corev1.EnvVar{}
for _, v := range vars {
Expand Down

0 comments on commit 548ce1d

Please sign in to comment.