Skip to content

Commit

Permalink
Add security context to query-frontend container (#863)
Browse files Browse the repository at this point in the history
* Add security context to query-frontend container

Signed-off-by: Ruben Vargas <[email protected]>

* Update tests

Signed-off-by: Ruben Vargas <[email protected]>

* Add changelog entry

Signed-off-by: Ruben Vargas <[email protected]>

* mount tmp for tempo-query container as an emptydir to make writable

Signed-off-by: Ruben Vargas <[email protected]>

---------

Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 authored Apr 3, 2024
1 parent a738ab5 commit 8e8425c
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 13 deletions.
16 changes: 16 additions & 0 deletions .chloggen/set_security_context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add security context to tempo-query container

# One or more tracking issues related to the change
issues: [864]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 1 addition & 1 deletion internal/manifests/compactor/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func deployment(params manifestutils.Params) (*v1.Deployment, error) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Resources: resources(tempo),
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/compactor/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestBuildCompactor(t *testing.T) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Ports: []corev1.ContainerPort{
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func deployment(params manifestutils.Params) *v1.Deployment {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Resources: resources(tempo),
Expand Down
6 changes: 3 additions & 3 deletions internal/manifests/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestBuildDistributor(t *testing.T) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
},
Expand Down Expand Up @@ -325,7 +325,7 @@ func TestBuildDistributor(t *testing.T) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
{
Name: "ca-custom",
Expand Down Expand Up @@ -409,7 +409,7 @@ func TestBuildDistributor(t *testing.T) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
},
Expand Down
6 changes: 4 additions & 2 deletions internal/manifests/manifestutils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ const (
// TmpStorageVolumeName declares the name of the volume containing temporary storage for tempo.
TmpStorageVolumeName = "tempo-tmp-storage"

// TmpStoragePath declares the path of temporary storage for tempo.
TmpStoragePath = "/var/tempo"
// TmpTempoStoragePath declares the path of temporary storage for tempo.
TmpTempoStoragePath = "/var/tempo"
// TmpStoragePath declares generic default /tmp storage path.
TmpStoragePath = "/tmp"

// HttpPortName declares the name of the tempo http port.
HttpPortName = "http"
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func deployment(params manifestutils.Params) (*v1.Deployment, error) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Resources: resources(tempo),
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/querier/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestBuildQuerier(t *testing.T) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Ports: []corev1.ContainerPort{
Expand Down
5 changes: 3 additions & 2 deletions internal/manifests/queryfrontend/query_frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func deployment(params manifestutils.Params) (*appsv1.Deployment, error) {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Resources: resources(tempo),
Expand Down Expand Up @@ -239,7 +239,8 @@ func deployment(params manifestutils.Params) (*appsv1.Deployment, error) {
MountPath: manifestutils.TmpStoragePath,
},
},
Resources: tempoQueryResources(tempo),
Resources: tempoQueryResources(tempo),
SecurityContext: manifestutils.TempoContainerSecurityContext(),
}
jaegerQueryVolume := corev1.Volume{
Name: manifestutils.TmpStorageVolumeName + "-query",
Expand Down
3 changes: 2 additions & 1 deletion internal/manifests/queryfrontend/query_frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func getExpectedDeployment(withJaeger bool) *v1.Deployment {
},
{
Name: manifestutils.TmpStorageVolumeName,
MountPath: manifestutils.TmpStoragePath,
MountPath: manifestutils.TmpTempoStoragePath,
},
},
Resources: corev1.ResourceRequirements{
Expand Down Expand Up @@ -262,6 +262,7 @@ func getExpectedDeployment(withJaeger bool) *v1.Deployment {
corev1.ResourceMemory: *resource.NewQuantity(32212256, resource.BinarySI),
},
},
SecurityContext: manifestutils.TempoContainerSecurityContext(),
}
jaegerQueryVolume := corev1.Volume{
Name: manifestutils.TmpStorageVolumeName + "-query",
Expand Down

0 comments on commit 8e8425c

Please sign in to comment.