Skip to content

Commit

Permalink
Add missing permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Israel Blancas <[email protected]>
  • Loading branch information
iblancasa committed Jun 16, 2023
1 parent 91874ae commit 6dca346
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 3 deletions.
10 changes: 9 additions & 1 deletion bundle/manifests/jaeger-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ metadata:
categories: Logging & Tracing
certified: "false"
containerImage: quay.io/jaegertracing/jaeger-operator
createdAt: "2023-05-29T15:36:04Z"
createdAt: "2023-06-16T18:59:42Z"
description: Provides tracing, monitoring and troubleshooting for microservices-based
distributed systems
operators.openshift.io/infrastructure-features: '["disconnected"]'
Expand Down Expand Up @@ -333,6 +333,14 @@ spec:
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
Expand Down
8 changes: 8 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
Expand Down
1 change: 1 addition & 0 deletions controllers/jaegertracing/jaeger_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func NewReconciler(client client.Client, clientReader client.Reader, scheme *run
// +kubebuilder:rbac:groups=extensions,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=networking.k8s.io,resources=ingressclasses,verbs=get;list;watch;
// +kubebuilder:rbac:groups=route.openshift.io,resources=routes,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=console.openshift.io,resources=consolelinks,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=batch,resources=jobs;cronjobs,verbs=get;list;watch;create;update;patch;delete
Expand Down
1 change: 0 additions & 1 deletion pkg/autodetect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ func (b *Background) detectDefaultIngressClass(ctx context.Context) {
err := b.cl.List(ctx, &ingressClasses)
if err != nil {
log.Log.Info("It was not possible to get any IngressClasses from the Kubernetes cluster")
viper.Set(v1.FlagDefaultIngressClass, "")
}

oldValue := viper.GetString(v1.FlagDefaultIngressClass)
Expand Down
31 changes: 31 additions & 0 deletions pkg/autodetect/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,37 @@ func TestDetectDefaultIngressClass(t *testing.T) {
assert.Equal(t, "nginx", viper.GetString(v1.FlagDefaultIngressClass))
}

func TestDetectNoDefaultIngressClass(t *testing.T) {
// prepare
viper.Set("platform", v1.FlagPlatformKubernetes)
defer viper.Reset()

dcl := &fakeDiscoveryClient{}
cl := customFakeClient()

cl.ListFunc = func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error {
if listPointer, ok := list.(*networkingv1.IngressClassList); ok {
listPointer.Items = []networkingv1.IngressClass{
{
ObjectMeta: metav1.ObjectMeta{
Name: "nginx",
},
},
}
}

return nil
}
b := WithClients(cl, dcl, cl)

// test
b.detectDefaultIngressClass(context.Background())

// verify
assert.Equal(t, "", viper.GetString(v1.FlagDefaultIngressClass))
}


func TestCleanDeployments(t *testing.T) {
for _, tt := range []struct {
cap string // caption for the test
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingress/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (i *QueryIngress) Get() *networkingv1.Ingress {
clusterDefaultIngressClass := viper.GetString(v1.FlagDefaultIngressClass)
if i.jaeger.Spec.Ingress.IngressClassName != nil {
spec.IngressClassName = i.jaeger.Spec.Ingress.IngressClassName
} else if clusterDefaultIngressClass != "" {
} else if clusterDefaultIngressClass != ""{
spec.IngressClassName = &clusterDefaultIngressClass
}

Expand Down

0 comments on commit 6dca346

Please sign in to comment.