Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip detectClusterRoles for Kubernetes #1262

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/autodetect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ func (b *Background) detectKafka(ctx context.Context, apiList *metav1.APIGroupLi
}

func (b *Background) detectClusterRoles(ctx context.Context) {
if viper.GetString("platform") != v1.FlagPlatformOpenShift {
return
}
tr := &authenticationapi.TokenReview{
ObjectMeta: metav1.ObjectMeta{Name: "jaeger-operator-TEST"},
Spec: authenticationapi.TokenReviewSpec{
Expand Down
21 changes: 21 additions & 0 deletions pkg/autodetect/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
)

func TestStart(t *testing.T) {
viper.Set("platform", v1.FlagPlatformOpenShift)
defer viper.Reset()

// sanity check
Expand Down Expand Up @@ -63,6 +64,7 @@ func TestStart(t *testing.T) {
}

func TestStartContinuesInBackground(t *testing.T) {
viper.Set("platform", v1.FlagPlatformOpenShift)
defer viper.Reset()

// prepare
Expand Down Expand Up @@ -364,8 +366,25 @@ func TestAutoDetectKafkaDefaultWithOperator(t *testing.T) {
assert.Equal(t, v1.FlagProvisionKafkaYes, viper.GetString("kafka-provision"))
}

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

dcl := &fakeDiscoveryClient{}
cl := customFakeClient()
b := WithClients(cl, dcl, cl)

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

// verify
assert.False(t, viper.IsSet("auth-delegator-available"))
}

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

dcl := &fakeDiscoveryClient{}
Expand All @@ -384,6 +403,7 @@ func TestNoAuthDelegatorAvailable(t *testing.T) {

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

dcl := &fakeDiscoveryClient{}
Expand All @@ -404,6 +424,7 @@ func TestAuthDelegatorBecomesAvailable(t *testing.T) {

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

dcl := &fakeDiscoveryClient{}
Expand Down