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

Bug 2302463: console: use github.com/openshift/api/console/v1 #230

Merged
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
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
Loading