Skip to content

Commit

Permalink
Assign correct resources to oauth proxy, empty as default
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Feb 11, 2025
1 parent 1adba61 commit f5ef119
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
5 changes: 5 additions & 0 deletions api/tempo/v1alpha1/tempomonolithic_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"time"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
Expand Down Expand Up @@ -84,6 +85,10 @@ func (r *TempoMonolithic) Default(ctrlConfig configv1alpha1.ProjectConfig) {
defaultSAR := fmt.Sprintf("{\"namespace\": \"%s\", \"resource\": \"pods\", \"verb\": \"get\"}", r.Namespace)
r.Spec.JaegerUI.Authentication.SAR = defaultSAR
}

if r.Spec.JaegerUI.Authentication.Resources == nil {
r.Spec.JaegerUI.Authentication.Resources = &corev1.ResourceRequirements{}
}
}

if r.Spec.JaegerUI.ServicesQueryDuration == nil {
Expand Down
29 changes: 18 additions & 11 deletions api/tempo/v1alpha1/tempomonolithic_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -193,8 +194,9 @@ func TestMonolithicDefault(t *testing.T) {
Termination: TLSRouteTerminationTypeEdge,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: true,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Enabled: true,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Resources: &corev1.ResourceRequirements{},
},
ServicesQueryDuration: &defaultServicesDuration,
FindTracesConcurrentRequests: 2,
Expand Down Expand Up @@ -267,8 +269,9 @@ func TestMonolithicDefault(t *testing.T) {
Termination: TLSRouteTerminationTypeEdge,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Resources: &corev1.ResourceRequirements{},
},
ServicesQueryDuration: &defaultServicesDuration,
FindTracesConcurrentRequests: 2,
Expand Down Expand Up @@ -333,8 +336,9 @@ func TestMonolithicDefault(t *testing.T) {
Termination: TLSRouteTerminationTypeEdge,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: true,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Enabled: true,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Resources: &corev1.ResourceRequirements{},
},
ServicesQueryDuration: &defaultServicesDuration,
FindTracesConcurrentRequests: 2,
Expand Down Expand Up @@ -364,7 +368,8 @@ func TestMonolithicDefault(t *testing.T) {
Enabled: true,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: false,
Enabled: false,
Resources: &corev1.ResourceRequirements{},
},
},
},
Expand Down Expand Up @@ -398,8 +403,9 @@ func TestMonolithicDefault(t *testing.T) {
Termination: TLSRouteTerminationTypeEdge,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Resources: &corev1.ResourceRequirements{},
},
ServicesQueryDuration: &defaultServicesDuration,
FindTracesConcurrentRequests: 2,
Expand Down Expand Up @@ -463,8 +469,9 @@ func TestMonolithicDefault(t *testing.T) {
Termination: TLSRouteTerminationTypeEdge,
},
Authentication: &JaegerQueryAuthenticationSpec{
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Enabled: false,
SAR: "{\"namespace\": \"testns\", \"resource\": \"pods\", \"verb\": \"get\"}",
Resources: &corev1.ResourceRequirements{},
},
ServicesQueryDuration: &v1.Duration{Duration: time.Duration(100 * 100)},
FindTracesConcurrentRequests: 40,
Expand Down
3 changes: 2 additions & 1 deletion internal/manifests/monolithic/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ func BuildAll(opts Options) ([]client.Object, error) {
}
manifests = append(manifests, route)
if tempo.Spec.JaegerUI.Authentication.Enabled && !tempo.Spec.Multitenancy.IsGatewayEnabled() {

oauthproxy.PatchStatefulSetForOauthProxy(
tempo.ObjectMeta,
tempo.Spec.JaegerUI.Authentication,
tempo.Spec.Timeout.Duration,
opts.CtrlConfig,
statefulSet,
tempo.Spec.Resources,
tempo.Spec.JaegerUI.Authentication.Resources,
)
oauthproxy.PatchQueryFrontEndService(getJaegerUIService(services, tempo), tempo.Name)
if serviceAccount != nil {
Expand Down

0 comments on commit f5ef119

Please sign in to comment.