feat: Configure external devfile registries urls (#845)
* Configure external devfile registries urls Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/847/head
parent
151e48193d
commit
c8a9da5bc1
|
|
@ -601,17 +601,28 @@ spec:
|
|||
type: object
|
||||
devfileRegistryUrl:
|
||||
description: Public URL of the devfile registry, that serves sample,
|
||||
ready-to-use devfiles. Set this ONLY when a use of an external
|
||||
devfile registry is needed. See the `externalDevfileRegistry`
|
||||
field. By default, this will be automatically calculated by the
|
||||
Operator.
|
||||
ready-to-use devfiles. This will be automatically calculated by
|
||||
the Operator. See the `externalDevfileRegistry` and `externalDevfileRegistries`
|
||||
fields.
|
||||
type: string
|
||||
externalDevfileRegistries:
|
||||
description: External devfile registries, that serves sample, ready-to-use
|
||||
devfiles. See the `externalDevfileRegistry` field.
|
||||
items:
|
||||
description: Settings forconfiguration of the external devfile
|
||||
registries.
|
||||
properties:
|
||||
url:
|
||||
description: Public URL of the devfile registry.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
externalDevfileRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
devfile registry server. By default, a dedicated devfile registry
|
||||
server is started. When `externalDevfileRegistry` is `true`, no
|
||||
such dedicated server will be started by the Operator and you
|
||||
will have to manually set the `devfileRegistryUrl` field
|
||||
will have to manually set the `externalDevfileRegistries` field
|
||||
type: boolean
|
||||
externalPluginRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
|
|
|
|||
|
|
@ -615,17 +615,29 @@ spec:
|
|||
type: object
|
||||
devfileRegistryUrl:
|
||||
description: Public URL of the devfile registry, that serves sample,
|
||||
ready-to-use devfiles. Set this ONLY when a use of an external
|
||||
devfile registry is needed. See the `externalDevfileRegistry`
|
||||
field. By default, this will be automatically calculated by
|
||||
the Operator.
|
||||
ready-to-use devfiles. This will be automatically calculated
|
||||
by the Operator. See the `externalDevfileRegistry` and `externalDevfileRegistries`
|
||||
fields.
|
||||
type: string
|
||||
externalDevfileRegistries:
|
||||
description: External devfile registries, that serves sample,
|
||||
ready-to-use devfiles. See the `externalDevfileRegistry` field.
|
||||
items:
|
||||
description: Settings forconfiguration of the external devfile
|
||||
registries.
|
||||
properties:
|
||||
url:
|
||||
description: Public URL of the devfile registry.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
externalDevfileRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
devfile registry server. By default, a dedicated devfile registry
|
||||
server is started. When `externalDevfileRegistry` is `true`,
|
||||
no such dedicated server will be started by the Operator and
|
||||
you will have to manually set the `devfileRegistryUrl` field
|
||||
you will have to manually set the `externalDevfileRegistries`
|
||||
field
|
||||
type: boolean
|
||||
externalPluginRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
|
|
|
|||
|
|
@ -76,13 +76,13 @@ metadata:
|
|||
categories: Developer Tools
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2021-05-19T07:53:38Z"
|
||||
createdAt: "2021-05-26T13:50:09Z"
|
||||
description: A Kube-native development solution that delivers portable and collaborative
|
||||
developer workspaces.
|
||||
operatorframework.io/suggested-namespace: eclipse-che
|
||||
repository: https://github.com/eclipse-che/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-kubernetes.v7.31.0-182.nightly
|
||||
name: eclipse-che-preview-kubernetes.v7.31.0-186.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -1133,4 +1133,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.31.0-182.nightly
|
||||
version: 7.31.0-186.nightly
|
||||
|
|
|
|||
|
|
@ -615,17 +615,29 @@ spec:
|
|||
type: object
|
||||
devfileRegistryUrl:
|
||||
description: Public URL of the devfile registry, that serves sample,
|
||||
ready-to-use devfiles. Set this ONLY when a use of an external
|
||||
devfile registry is needed. See the `externalDevfileRegistry`
|
||||
field. By default, this will be automatically calculated by
|
||||
the Operator.
|
||||
ready-to-use devfiles. This will be automatically calculated
|
||||
by the Operator. See the `externalDevfileRegistry` and `externalDevfileRegistries`
|
||||
fields.
|
||||
type: string
|
||||
externalDevfileRegistries:
|
||||
description: External devfile registries, that serves sample,
|
||||
ready-to-use devfiles. See the `externalDevfileRegistry` field.
|
||||
items:
|
||||
description: Settings forconfiguration of the external devfile
|
||||
registries.
|
||||
properties:
|
||||
url:
|
||||
description: Public URL of the devfile registry.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
externalDevfileRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
devfile registry server. By default, a dedicated devfile registry
|
||||
server is started. When `externalDevfileRegistry` is `true`,
|
||||
no such dedicated server will be started by the Operator and
|
||||
you will have to manually set the `devfileRegistryUrl` field
|
||||
you will have to manually set the `externalDevfileRegistries`
|
||||
field
|
||||
type: boolean
|
||||
externalPluginRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ metadata:
|
|||
categories: Developer Tools, OpenShift Optional
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2021-05-19T07:53:48Z"
|
||||
createdAt: "2021-05-26T13:50:19Z"
|
||||
description: A Kube-native development solution that delivers portable and collaborative
|
||||
developer workspaces in OpenShift.
|
||||
operatorframework.io/suggested-namespace: eclipse-che
|
||||
repository: https://github.com/eclipse-che/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-openshift.v7.31.0-182.nightly
|
||||
name: eclipse-che-preview-openshift.v7.31.0-186.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -1208,4 +1208,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.31.0-182.nightly
|
||||
version: 7.31.0-186.nightly
|
||||
|
|
|
|||
|
|
@ -625,17 +625,29 @@ spec:
|
|||
type: object
|
||||
devfileRegistryUrl:
|
||||
description: Public URL of the devfile registry, that serves
|
||||
sample, ready-to-use devfiles. Set this ONLY when a use of
|
||||
an external devfile registry is needed. See the `externalDevfileRegistry`
|
||||
field. By default, this will be automatically calculated by
|
||||
the Operator.
|
||||
sample, ready-to-use devfiles. This will be automatically
|
||||
calculated by the Operator. See the `externalDevfileRegistry`
|
||||
and `externalDevfileRegistries` fields.
|
||||
type: string
|
||||
externalDevfileRegistries:
|
||||
description: External devfile registries, that serves sample,
|
||||
ready-to-use devfiles. See the `externalDevfileRegistry` field.
|
||||
items:
|
||||
description: Settings forconfiguration of the external devfile
|
||||
registries.
|
||||
properties:
|
||||
url:
|
||||
description: Public URL of the devfile registry.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
externalDevfileRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
devfile registry server. By default, a dedicated devfile registry
|
||||
server is started. When `externalDevfileRegistry` is `true`,
|
||||
no such dedicated server will be started by the Operator and
|
||||
you will have to manually set the `devfileRegistryUrl` field
|
||||
you will have to manually set the `externalDevfileRegistries`
|
||||
field
|
||||
type: boolean
|
||||
externalPluginRegistry:
|
||||
description: Instructs the Operator on whether to deploy a dedicated
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ type CheClusterSpecServer struct {
|
|||
// +optional
|
||||
DashboardCpuRequest string `json:"dashboardCpuRequest,omitempty"`
|
||||
// Public URL of the devfile registry, that serves sample, ready-to-use devfiles.
|
||||
// Set this ONLY when a use of an external devfile registry is needed. See the `externalDevfileRegistry` field.
|
||||
// By default, this will be automatically calculated by the Operator.
|
||||
// This will be automatically calculated by the Operator.
|
||||
// See the `externalDevfileRegistry` and `externalDevfileRegistries` fields.
|
||||
// +optional
|
||||
DevfileRegistryUrl string `json:"devfileRegistryUrl,omitempty"`
|
||||
// Overrides the container image used in the devfile registry deployment.
|
||||
|
|
@ -197,9 +197,13 @@ type CheClusterSpecServer struct {
|
|||
DevfileRegistryRoute RouteCustomSettings `json:"devfileRegistryRoute,omitempty"`
|
||||
// Instructs the Operator on whether to deploy a dedicated devfile registry server.
|
||||
// By default, a dedicated devfile registry server is started. When `externalDevfileRegistry` is `true`, no such dedicated server
|
||||
// will be started by the Operator and you will have to manually set the `devfileRegistryUrl` field
|
||||
// will be started by the Operator and you will have to manually set the `externalDevfileRegistries` field
|
||||
// +optional
|
||||
ExternalDevfileRegistry bool `json:"externalDevfileRegistry"`
|
||||
// External devfile registries, that serves sample, ready-to-use devfiles.
|
||||
// See the `externalDevfileRegistry` field.
|
||||
// +optional
|
||||
ExternalDevfileRegistries []ExternalDevfileRegistries `json:"externalDevfileRegistries,omitempty"`
|
||||
// Public URL of the plugin registry that serves sample ready-to-use devfiles.
|
||||
// Set this ONLY when a use of an external devfile registry is needed.
|
||||
// See the `externalPluginRegistry` field. By default, this will be automatically calculated by the Operator.
|
||||
|
|
@ -586,6 +590,14 @@ type CheClusterSpecDevWorkspace struct {
|
|||
ControllerImage string `json:"controllerImage,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:openapi-gen=true
|
||||
// Settings forconfiguration of the external devfile registries.
|
||||
type ExternalDevfileRegistries struct {
|
||||
// Public URL of the devfile registry.
|
||||
// +optional
|
||||
Url string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// CheClusterStatus defines the observed state of Che installation
|
||||
type CheClusterStatus struct {
|
||||
// OpenShift OAuth secret in `openshift-config` namespace that contains user credentials for HTPasswd identity provider.
|
||||
|
|
|
|||
|
|
@ -210,6 +210,11 @@ func (in *CheClusterSpecServer) DeepCopyInto(out *CheClusterSpecServer) {
|
|||
*out = *in
|
||||
out.DevfileRegistryIngress = in.DevfileRegistryIngress
|
||||
out.DevfileRegistryRoute = in.DevfileRegistryRoute
|
||||
if in.ExternalDevfileRegistries != nil {
|
||||
in, out := &in.ExternalDevfileRegistries, &out.ExternalDevfileRegistries
|
||||
*out = make([]ExternalDevfileRegistries, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.PluginRegistryIngress = in.PluginRegistryIngress
|
||||
out.PluginRegistryRoute = in.PluginRegistryRoute
|
||||
if in.CustomCheProperties != nil {
|
||||
|
|
@ -273,6 +278,22 @@ func (in *CheClusterStatus) DeepCopy() *CheClusterStatus {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExternalDevfileRegistries) DeepCopyInto(out *ExternalDevfileRegistries) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalDevfileRegistries.
|
||||
func (in *ExternalDevfileRegistries) DeepCopy() *ExternalDevfileRegistries {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExternalDevfileRegistries)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressCustomSettings) DeepCopyInto(out *IngressCustomSettings) {
|
||||
*out = *in
|
||||
|
|
|
|||
|
|
@ -623,8 +623,8 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
}
|
||||
}
|
||||
|
||||
devfileRegistry := devfileregistry.NewDevfileRegistry(deployContext)
|
||||
if !instance.Spec.Server.ExternalDevfileRegistry {
|
||||
devfileRegistry := devfileregistry.NewDevfileRegistry(deployContext)
|
||||
done, err := devfileRegistry.SyncAll()
|
||||
if !done {
|
||||
if err != nil {
|
||||
|
|
@ -632,18 +632,6 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
}
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
} else {
|
||||
done, err := deploy.DeleteNamespacedObject(deployContext, deploy.DevfileRegistryName, &corev1.ConfigMap{})
|
||||
if !done {
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
|
||||
if instance.Spec.Server.DevfileRegistryUrl != instance.Status.DevfileRegistryURL {
|
||||
instance.Status.DevfileRegistryURL = instance.Spec.Server.DevfileRegistryUrl
|
||||
if err := deploy.UpdateCheCRStatus(deployContext, "status: Devfile Registry URL", instance.Spec.Server.DevfileRegistryUrl); err != nil {
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d := dashboard.NewDashboard(deployContext)
|
||||
|
|
|
|||
|
|
@ -508,6 +508,134 @@ func TestEnsureServerExposureStrategy(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestShouldSetUpCorrectlyDevfileRegistryURL(t *testing.T) {
|
||||
type testCase struct {
|
||||
name string
|
||||
isOpenShift bool
|
||||
isOpenShift4 bool
|
||||
initObjects []runtime.Object
|
||||
cheCluster *orgv1.CheCluster
|
||||
expectedDevfileRegistryURL string
|
||||
}
|
||||
|
||||
testCases := []testCase{
|
||||
{
|
||||
name: "Test Status.DevfileRegistryURL #1",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
Name: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
ExternalDevfileRegistry: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedDevfileRegistryURL: "http://devfile-registry-eclipse-che./",
|
||||
},
|
||||
{
|
||||
name: "Test Status.DevfileRegistryURL #2",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
Name: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
ExternalDevfileRegistry: false,
|
||||
DevfileRegistryUrl: "https://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "https://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedDevfileRegistryURL: "http://devfile-registry-eclipse-che./",
|
||||
},
|
||||
{
|
||||
name: "Test Status.DevfileRegistryURL #2",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
Name: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
ExternalDevfileRegistry: true,
|
||||
DevfileRegistryUrl: "https://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "https://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedDevfileRegistryURL: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
|
||||
scheme := scheme.Scheme
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme)
|
||||
testCase.initObjects = append(testCase.initObjects, testCase.cheCluster)
|
||||
cli := fake.NewFakeClientWithScheme(scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme, testCase.initObjects...)
|
||||
clientSet := fakeclientset.NewSimpleClientset()
|
||||
fakeDiscovery, ok := clientSet.Discovery().(*fakeDiscovery.FakeDiscovery)
|
||||
if !ok {
|
||||
t.Fatal("Error creating fake discovery client")
|
||||
}
|
||||
fakeDiscovery.Fake.Resources = []*metav1.APIResourceList{}
|
||||
|
||||
r := &ReconcileChe{
|
||||
client: cli,
|
||||
nonCachedClient: nonCachedClient,
|
||||
discoveryClient: fakeDiscovery,
|
||||
scheme: scheme,
|
||||
tests: true,
|
||||
}
|
||||
req := reconcile.Request{
|
||||
NamespacedName: types.NamespacedName{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
|
||||
_, err := r.Reconcile(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Error reconciling: %v", err)
|
||||
}
|
||||
|
||||
cr := &orgv1.CheCluster{}
|
||||
if err := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, cr); err != nil {
|
||||
t.Errorf("CR not found")
|
||||
}
|
||||
|
||||
if cr.Status.DevfileRegistryURL != testCase.expectedDevfileRegistryURL {
|
||||
t.Fatalf("Exected: %s, but found: %s", testCase.expectedDevfileRegistryURL, cr.Status.DevfileRegistryURL)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImagePullerConfiguration(t *testing.T) {
|
||||
type testCase struct {
|
||||
name string
|
||||
|
|
|
|||
|
|
@ -161,7 +161,21 @@ func (s *Server) getCheConfigMapData() (cheEnv map[string]string, err error) {
|
|||
keycloakClientId := util.GetValue(s.deployContext.CheCluster.Spec.Auth.IdentityProviderClientId, cheFlavor+"-public")
|
||||
ingressStrategy := util.GetServerExposureStrategy(s.deployContext.CheCluster)
|
||||
ingressClass := util.GetValue(s.deployContext.CheCluster.Spec.K8s.IngressClass, deploy.DefaultIngressClass)
|
||||
|
||||
// grab first the devfile registry url which is deployed by operator
|
||||
devfileRegistryURL := s.deployContext.CheCluster.Status.DevfileRegistryURL
|
||||
|
||||
// `Spec.Server.DevfileRegistryUrl` is deprecated in favor of `Server.ExternalDevfileRegistries`
|
||||
if s.deployContext.CheCluster.Spec.Server.DevfileRegistryUrl != "" {
|
||||
devfileRegistryURL += " " + s.deployContext.CheCluster.Spec.Server.DevfileRegistryUrl
|
||||
}
|
||||
for _, r := range s.deployContext.CheCluster.Spec.Server.ExternalDevfileRegistries {
|
||||
if strings.Index(devfileRegistryURL, r.Url) == -1 {
|
||||
devfileRegistryURL += " " + r.Url
|
||||
}
|
||||
}
|
||||
devfileRegistryURL = strings.TrimSpace(devfileRegistryURL)
|
||||
|
||||
pluginRegistryURL := s.deployContext.CheCluster.Status.PluginRegistryURL
|
||||
cheLogLevel := util.GetValue(s.deployContext.CheCluster.Spec.Server.CheLogLevel, deploy.DefaultCheLogLevel)
|
||||
cheDebug := util.GetValue(s.deployContext.CheCluster.Spec.Server.CheDebug, deploy.DefaultCheDebug)
|
||||
|
|
@ -181,10 +195,13 @@ func (s *Server) getCheConfigMapData() (cheEnv map[string]string, err error) {
|
|||
keycloakInternalURL = keycloakURL
|
||||
}
|
||||
|
||||
if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames && !s.deployContext.CheCluster.Spec.Server.ExternalDevfileRegistry {
|
||||
devfileRegistryInternalURL = fmt.Sprintf("http://%s.%s.svc:8080", deploy.DevfileRegistryName, s.deployContext.CheCluster.Namespace)
|
||||
} else {
|
||||
devfileRegistryInternalURL = devfileRegistryURL
|
||||
// If there is a devfile registry deployed by operator
|
||||
if !s.deployContext.CheCluster.Spec.Server.ExternalDevfileRegistry {
|
||||
if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames {
|
||||
devfileRegistryInternalURL = fmt.Sprintf("http://%s.%s.svc:8080", deploy.DevfileRegistryName, s.deployContext.CheCluster.Namespace)
|
||||
} else {
|
||||
devfileRegistryInternalURL = s.deployContext.CheCluster.Status.DevfileRegistryURL
|
||||
}
|
||||
}
|
||||
|
||||
if s.deployContext.CheCluster.Spec.Server.UseInternalClusterSVCNames && !s.deployContext.CheCluster.Spec.Server.ExternalPluginRegistry {
|
||||
|
|
|
|||
|
|
@ -12,17 +12,12 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/eclipse-che/che-operator/pkg/deploy"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
|
||||
|
||||
orgv1 "github.com/eclipse-che/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse-che/che-operator/pkg/util"
|
||||
|
|
@ -71,24 +66,9 @@ func TestNewCheConfigMap(t *testing.T) {
|
|||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, []runtime.Object{})
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -204,28 +184,33 @@ func TestConfigMap(t *testing.T) {
|
|||
"CHE_WEBSOCKET_ENDPOINT__MINOR": "ws://che-host/api/websocket-minor",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Kubernetes strategy should be set correctly",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
K8s: orgv1.CheClusterSpecK8SOnly{
|
||||
IngressStrategy: "single-host",
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_INFRA_KUBERNETES_SERVER__STRATEGY": "single-host",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, testCase.initObjects)
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -339,21 +324,7 @@ func TestUpdateBitBucketEndpoints(t *testing.T) {
|
|||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, testCase.initObjects)
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -366,7 +337,7 @@ func TestUpdateBitBucketEndpoints(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
||||
func TestShouldSetUpCorrectlyDevfileRegistryURL(t *testing.T) {
|
||||
type testCase struct {
|
||||
name string
|
||||
isOpenShift bool
|
||||
|
|
@ -378,7 +349,7 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
|
||||
testCases := []testCase{
|
||||
{
|
||||
name: "Should use 'external' devfile registry url, when internal network is enabled",
|
||||
name: "Test devfile registry urls #1",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -391,21 +362,45 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: true,
|
||||
ExternalDevfileRegistry: true,
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "http://devfile-registry.external.1"},
|
||||
},
|
||||
},
|
||||
Auth: orgv1.CheClusterSpecAuth{
|
||||
OpenShiftoAuth: util.NewBoolPointer(false),
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://external-devfile-registry",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://external-devfile-registry",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.external.1",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Should use 'external' devfile registry url, when internal network is disabled",
|
||||
name: "Test devfile registry urls #2",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: true,
|
||||
ExternalDevfileRegistry: true,
|
||||
DevfileRegistryUrl: "http://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "http://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.external.1 http://devfile-registry.external.2",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Test devfile registry urls #3",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -418,21 +413,20 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: false,
|
||||
ExternalDevfileRegistry: true,
|
||||
DevfileRegistryUrl: "http://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "http://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
Auth: orgv1.CheClusterSpecAuth{
|
||||
OpenShiftoAuth: util.NewBoolPointer(false),
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://external-devfile-registry",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://external-devfile-registry",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.external.1 http://devfile-registry.external.2",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Should use public devfile registry url, when internal network is disabled",
|
||||
name: "Test devfile registry urls #4",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -446,20 +440,18 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
UseInternalClusterSVCNames: false,
|
||||
ExternalDevfileRegistry: false,
|
||||
},
|
||||
Auth: orgv1.CheClusterSpecAuth{
|
||||
OpenShiftoAuth: util.NewBoolPointer(false),
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://devfile-registry",
|
||||
DevfileRegistryURL: "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry.internal",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Should use internal devfile registry url, when internal network is enabled",
|
||||
name: "Test devfile registry urls #5",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -473,20 +465,18 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
UseInternalClusterSVCNames: true,
|
||||
ExternalDevfileRegistry: false,
|
||||
},
|
||||
Auth: orgv1.CheClusterSpecAuth{
|
||||
OpenShiftoAuth: util.NewBoolPointer(false),
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://external-devfile-registry",
|
||||
DevfileRegistryURL: "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry.eclipse-che.svc:8080",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Kubernetes strategy should be set correctly",
|
||||
name: "Test devfile registry urls #5",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -496,37 +486,60 @@ func TestShouldSetUpCorrectlyInternalDevfileRegistryServiceURL(t *testing.T) {
|
|||
Namespace: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
K8s: orgv1.CheClusterSpecK8SOnly{
|
||||
IngressStrategy: "single-host",
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: false,
|
||||
ExternalDevfileRegistry: false,
|
||||
DevfileRegistryUrl: "http://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "http://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_INFRA_KUBERNETES_SERVER__STRATEGY": "single-host",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry.internal",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.internal http://devfile-registry.external.1 http://devfile-registry.external.2",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Test devfile registry urls #6",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
APIVersion: "org.eclipse.che/v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "eclipse-che",
|
||||
},
|
||||
Spec: orgv1.CheClusterSpec{
|
||||
Server: orgv1.CheClusterSpecServer{
|
||||
UseInternalClusterSVCNames: true,
|
||||
ExternalDevfileRegistry: false,
|
||||
DevfileRegistryUrl: "http://devfile-registry.external.1",
|
||||
ExternalDevfileRegistries: []orgv1.ExternalDevfileRegistries{
|
||||
{Url: "http://devfile-registry.external.2"},
|
||||
},
|
||||
},
|
||||
},
|
||||
Status: orgv1.CheClusterStatus{
|
||||
DevfileRegistryURL: "http://devfile-registry.internal",
|
||||
},
|
||||
},
|
||||
expectedData: map[string]string{
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL": "http://devfile-registry.eclipse-che.svc:8080",
|
||||
"CHE_WORKSPACE_DEVFILE__REGISTRY__URL": "http://devfile-registry.internal http://devfile-registry.external.1 http://devfile-registry.external.2",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, []runtime.Object{})
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -551,7 +564,7 @@ func TestShouldSetUpCorrectlyInternalPluginRegistryServiceURL(t *testing.T) {
|
|||
|
||||
testCases := []testCase{
|
||||
{
|
||||
name: "Should use 'external' public plugin registry url, when internal network is enabled",
|
||||
name: "Test CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL #1",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -578,7 +591,7 @@ func TestShouldSetUpCorrectlyInternalPluginRegistryServiceURL(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "Should use 'external' public plugin registry url, when internal network is disabled",
|
||||
name: "Test CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL #2",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -605,7 +618,7 @@ func TestShouldSetUpCorrectlyInternalPluginRegistryServiceURL(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "Should use public plugin registry url, when internal network is disabled",
|
||||
name: "Test CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL #3",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -632,7 +645,7 @@ func TestShouldSetUpCorrectlyInternalPluginRegistryServiceURL(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "Should use internal plugin registry url, when internal network is enabled",
|
||||
name: "Test CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL #4",
|
||||
cheCluster: &orgv1.CheCluster{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "CheCluster",
|
||||
|
|
@ -662,24 +675,9 @@ func TestShouldSetUpCorrectlyInternalPluginRegistryServiceURL(t *testing.T) {
|
|||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, []runtime.Object{})
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -755,24 +753,9 @@ func TestShouldSetUpCorrectlyInternalCheServerURL(t *testing.T) {
|
|||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, []runtime.Object{})
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
@ -930,24 +913,9 @@ func TestShouldSetUpCorrectlyInternalIdentityProviderServiceURL(t *testing.T) {
|
|||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
logf.SetLogger(zap.LoggerTo(os.Stdout, true))
|
||||
orgv1.SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||
testCase.initObjects = append(testCase.initObjects)
|
||||
cli := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
nonCachedClient := fake.NewFakeClientWithScheme(scheme.Scheme, testCase.initObjects...)
|
||||
|
||||
deployContext := &deploy.DeployContext{
|
||||
CheCluster: testCase.cheCluster,
|
||||
ClusterAPI: deploy.ClusterAPI{
|
||||
Client: cli,
|
||||
NonCachedClient: nonCachedClient,
|
||||
Scheme: scheme.Scheme,
|
||||
},
|
||||
Proxy: &deploy.Proxy{},
|
||||
}
|
||||
|
||||
util.IsOpenShift = testCase.isOpenShift
|
||||
util.IsOpenShift4 = testCase.isOpenShift4
|
||||
deployContext := deploy.GetTestDeployContext(testCase.cheCluster, []runtime.Object{})
|
||||
|
||||
server := NewServer(deployContext)
|
||||
actualData, err := server.getCheConfigMapData()
|
||||
|
|
|
|||
Loading…
Reference in New Issue