Skip to content

Commit

Permalink
Merge pull request #441 from iamniting/console
Browse files Browse the repository at this point in the history
Bug 2297946:[release-4.16] console: use github.com/openshift/api/console/v1
  • Loading branch information
openshift-merge-bot[bot] authored Jul 23, 2024
2 parents ca9bfd3 + c361c3b commit a050863
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 539 deletions.
52 changes: 31 additions & 21 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package console
import (
"strings"

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 @@ -82,38 +82,48 @@ func GetService(port int, namespace string) *apiv1.Service {
}
}

func GetConsolePluginCR(consolePort int, serviceNamespace string) *consolev1alpha1.ConsolePlugin {
return &consolev1alpha1.ConsolePlugin{
func GetConsolePluginCR(consolePort int, serviceNamespace string) *consolev1.ConsolePlugin {
return &consolev1.ConsolePlugin{
ObjectMeta: metav1.ObjectMeta{
Name: "odf-console",
},
Spec: consolev1alpha1.ConsolePluginSpec{
Spec: consolev1.ConsolePluginSpec{
DisplayName: "ODF Plugin",
Service: consolev1alpha1.ConsolePluginService{
Name: "odf-console-service",
Namespace: serviceNamespace,
Port: int32(consolePort),
Backend: consolev1.ConsolePluginBackend{
Service: &consolev1.ConsolePluginService{
Name: "odf-console-service",
Namespace: serviceNamespace,
Port: int32(consolePort),
},
Type: consolev1.Service,
},
I18n: consolev1.ConsolePluginI18n{
LoadType: consolev1.Empty,
},
Proxy: []consolev1alpha1.ConsolePluginProxy{
Proxy: []consolev1.ConsolePluginProxy{
{
Type: consolev1alpha1.ProxyTypeService,
Alias: "provider-proxy",
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: "ux-backend-proxy",
Namespace: serviceNamespace,
Port: 8888,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: "ux-backend-proxy",
Namespace: serviceNamespace,
Port: 8888,
},
},
Authorize: true,
Authorization: consolev1.UserToken,
},
{
Type: consolev1alpha1.ProxyTypeService,
Alias: "rosa-prometheus",
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: "prometheus",
Namespace: serviceNamespace,
Port: 9339,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: "prometheus",
Namespace: serviceNamespace,
Port: 9339,
},
},
Authorize: false,
Authorization: consolev1.None,
},
},
},
Expand Down
40 changes: 23 additions & 17 deletions controllers/clusterversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"

configv1 "github.com/openshift/api/config/v1"
consolev1 "github.com/openshift/api/console/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -30,7 +31,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager"

consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
"github.com/red-hat-storage/odf-operator/console"
"github.com/red-hat-storage/odf-operator/pkg/util"
)
Expand Down Expand Up @@ -126,31 +126,37 @@ func (r *ClusterVersionReconciler) ensureConsolePlugin(clusterVersion string) er
// Create/Update ODF console ConsolePlugin
odfConsolePlugin := console.GetConsolePluginCR(r.ConsolePort, OperatorNamespace)
_, err = controllerutil.CreateOrUpdate(context.TODO(), r.Client, odfConsolePlugin, func() error {
if currentBasePath := odfConsolePlugin.Spec.Service.BasePath; currentBasePath != basePath {
logger.Info(fmt.Sprintf("Set the BasePath for odf-console plugin as '%s'", basePath))
odfConsolePlugin.Spec.Service.BasePath = basePath
if odfConsolePlugin.Spec.Backend.Service != nil {
if currentBasePath := odfConsolePlugin.Spec.Backend.Service.BasePath; currentBasePath != basePath {
logger.Info(fmt.Sprintf("Set the BasePath for odf-console plugin as '%s'", basePath))
odfConsolePlugin.Spec.Backend.Service.BasePath = basePath
}
}
if odfConsolePlugin.Spec.Proxy == nil {
odfConsolePlugin.Spec.Proxy = []consolev1alpha1.ConsolePluginProxy{
odfConsolePlugin.Spec.Proxy = []consolev1.ConsolePluginProxy{
{
Type: consolev1alpha1.ProxyTypeService,
Alias: "provider-proxy",
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: "ux-backend-proxy",
Namespace: OperatorNamespace,
Port: 8888,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: "ux-backend-proxy",
Namespace: OperatorNamespace,
Port: 8888,
},
},
Authorize: true,
Authorization: consolev1.UserToken,
},
{
Type: consolev1alpha1.ProxyTypeService,
Alias: "rosa-prometheus",
Service: consolev1alpha1.ConsolePluginProxyServiceConfig{
Name: "prometheus",
Namespace: OperatorNamespace,
Port: 9339,
Endpoint: consolev1.ConsolePluginProxyEndpoint{
Type: consolev1.ProxyTypeService,
Service: &consolev1.ConsolePluginProxyServiceConfig{
Name: "prometheus",
Namespace: OperatorNamespace,
Port: 9339,
},
},
Authorize: false,
Authorization: consolev1.None,
},
}
}
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import (
//+kubebuilder:scaffold:imports
configv1 "github.com/openshift/api/config/v1"
consolev1 "github.com/openshift/api/console/v1"
consolev1alpha1 "github.com/openshift/api/console/v1alpha1"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metrics "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)
Expand All @@ -67,7 +66,6 @@ func init() {
//+kubebuilder:scaffold:scheme

utilruntime.Must(consolev1.AddToScheme(scheme))
utilruntime.Must(consolev1alpha1.AddToScheme(scheme))
utilruntime.Must(extv1.AddToScheme(scheme))
utilruntime.Must(configv1.AddToScheme(scheme))

Expand Down
3 changes: 0 additions & 3 deletions vendor/github.com/openshift/api/console/v1alpha1/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions vendor/github.com/openshift/api/console/v1alpha1/doc.go

This file was deleted.

39 changes: 0 additions & 39 deletions vendor/github.com/openshift/api/console/v1alpha1/register.go

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a050863

Please sign in to comment.