Skip to content

Commit

Permalink
Merge pull request #230 from GowthamShanmugam/bz_2302463
Browse files Browse the repository at this point in the history
Bug 2302463: console: use github.com/openshift/api/console/v1
  • Loading branch information
openshift-merge-bot[bot] authored Sep 26, 2024
2 parents 8368413 + 761e98a commit 8793c83
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 38 deletions.
39 changes: 22 additions & 17 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"context"
"fmt"

consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
consolev1 "github.com/openshift/api/console/v1"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -70,28 +70,33 @@ func getService(serviceName string, port int, deploymentNamespace string) apiv1.
}
}

func getConsolePluginCR(consolePort int, serviceName string, deploymentNamespace string) consolev1alpha1.ConsolePlugin {
return consolev1alpha1.ConsolePlugin{
func getConsolePluginCR(consolePort int, serviceName string, deploymentNamespace string) consolev1.ConsolePlugin {
return consolev1.ConsolePlugin{
ObjectMeta: metav1.ObjectMeta{
Name: odfMulticlusterPluginName,
},
Spec: consolev1alpha1.ConsolePluginSpec{
Spec: consolev1.ConsolePluginSpec{
DisplayName: pluginDisplayName,
Service: consolev1alpha1.ConsolePluginService{
Name: serviceName,
Namespace: deploymentNamespace,
Port: int32(consolePort),
BasePath: pluginBasePath,
Backend: consolev1.ConsolePluginBackend{
Service: &consolev1.ConsolePluginService{
Name: serviceName,
Namespace: deploymentNamespace,
Port: int32(consolePort),
BasePath: pluginBasePath,
},
Type: consolev1.Service,
},
Proxy: []consolev1alpha1.ConsolePluginProxy{
Proxy: []consolev1.ConsolePluginProxy{
{
Type: consolev1alpha1.ProxyTypeService,
Alias: proxyAlias,
Authorize: true,
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: proxyServiceName,
Namespace: proxyServiceNamespace,
Port: int32(proxyServicePort),
Alias: proxyAlias,
Authorization: consolev1.UserToken,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: proxyServiceName,
Namespace: proxyServiceNamespace,
Port: int32(proxyServicePort),
},
},
},
},
Expand Down
43 changes: 24 additions & 19 deletions console/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
consolev1 "github.com/openshift/api/console/v1"
multiclusterv1alpha1 "github.com/red-hat-storage/odf-multicluster-orchestrator/api/v1alpha1"
"github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1"
Expand All @@ -29,24 +29,29 @@ type testCase struct {
errExpected bool
}

func getExpectedConsolePluginSpec() consolev1alpha1.ConsolePluginSpec {
return consolev1alpha1.ConsolePluginSpec{
func getExpectedConsolePluginSpec() consolev1.ConsolePluginSpec {
return consolev1.ConsolePluginSpec{
DisplayName: pluginDisplayName,
Service: consolev1alpha1.ConsolePluginService{
Name: odfMulticlusterPluginName,
Namespace: testMulticlusterNamespace,
Port: int32(testPort),
BasePath: pluginBasePath,
Backend: consolev1.ConsolePluginBackend{
Service: &consolev1.ConsolePluginService{
Name: odfMulticlusterPluginName,
Namespace: testMulticlusterNamespace,
Port: int32(testPort),
BasePath: pluginBasePath,
},
Type: consolev1.Service,
},
Proxy: []consolev1alpha1.ConsolePluginProxy{
Proxy: []consolev1.ConsolePluginProxy{
{
Type: consolev1alpha1.ProxyTypeService,
Alias: proxyAlias,
Authorize: true,
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: proxyServiceName,
Namespace: proxyServiceNamespace,
Port: int32(proxyServicePort),
Alias: proxyAlias,
Authorization: consolev1.UserToken,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: proxyServiceName,
Namespace: proxyServiceNamespace,
Port: int32(proxyServicePort),
},
},
},
},
Expand Down Expand Up @@ -78,9 +83,9 @@ func createFakeScheme(t *testing.T) *runtime.Scheme {
if err != nil {
assert.Fail(t, "failed to add appsv1 scheme")
}
err = consolev1alpha1.AddToScheme(scheme)
err = consolev1.AddToScheme(scheme)
if err != nil {
assert.Fail(t, "failed to add consolev1alpha1 scheme")
assert.Fail(t, "failed to add consolev1 scheme")
}
err = apiv1.AddToScheme(scheme)
if err != nil {
Expand Down Expand Up @@ -120,7 +125,7 @@ func TestInitConsole(t *testing.T) {
assert.Error(t, err)
} else {
assert.NoError(t, err)
consolePlugin := consolev1alpha1.ConsolePlugin{}
consolePlugin := consolev1.ConsolePlugin{}
err := client.Get(context.TODO(), types.NamespacedName{
Name: odfMulticlusterPluginName,
}, &consolePlugin)
Expand Down
4 changes: 2 additions & 2 deletions controllers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"flag"
"os"

consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
consolev1 "github.com/openshift/api/console/v1"
"github.com/openshift/library-go/pkg/operator/events"
ramenv1alpha1 "github.com/ramendr/ramen/api/v1alpha1"
"github.com/red-hat-storage/odf-multicluster-orchestrator/addons/setup"
Expand Down Expand Up @@ -39,7 +39,7 @@ func init() {

utilruntime.Must(multiclusterv1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(addonapiv1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(consolev1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(consolev1.AddToScheme(mgrScheme))

utilruntime.Must(ramenv1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(workv1.AddToScheme(mgrScheme))
Expand Down

0 comments on commit 8793c83

Please sign in to comment.