Skip to content

Commit

Permalink
feat: Use registry.devfile.io by default in Eclipse Che (#1811)
Browse files Browse the repository at this point in the history
* feat: Use  registry.devfile.io by default in Eclipse Che

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Feb 20, 2024
1 parent 1ae0142 commit 76b21ea
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/minikube-test-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.23.2
minikube-version: v1.29.0
- name: Install yq
run: sudo pip install yq
- name: Install chectl
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/minikube-test-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.23.2
minikube-version: v1.29.0
- name: Install yq
run: sudo pip install yq
- name: Install chectl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.23.2
minikube-version: v1.29.0
- name: Install yq
run: sudo pip install yq
- name: Install chectl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.23.2
minikube-version: v1.29.0
- name: Install yq
run: sudo pip install yq
- name: Install chectl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ metadata:
"enable": true
},
"server": {
"externalDevfileRegistries": [
{
"url": "https://registry.devfile.io"
}
],
"externalDevfileRegistry": true,
"workspaceNamespaceDefault": "<username>-che"
},
"storage": {
Expand All @@ -55,7 +61,16 @@ metadata:
"namespace": "eclipse-che"
},
"spec": {
"components": {},
"components": {
"devfileRegistry": {
"disableInternalRegistry": true,
"externalDevfileRegistries": [
{
"url": "https://registry.devfile.io"
}
]
}
},
"containerRegistry": {},
"devEnvironments": {},
"gitServices": {},
Expand All @@ -77,7 +92,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che.v7.82.0-835.next
name: eclipse-che.v7.82.0-842.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1248,7 +1263,7 @@ spec:
minKubeVersion: 1.19.0
provider:
name: Eclipse Foundation
version: 7.82.0-835.next
version: 7.82.0-842.next
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
5 changes: 4 additions & 1 deletion config/samples/org_v1_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ metadata:
namespace: eclipse-che
spec:
server:
workspaceNamespaceDefault: "<username>-che"
workspaceNamespaceDefault: '<username>-che'
externalDevfileRegistry: true
externalDevfileRegistries:
- url: 'https://registry.devfile.io'
database:
externalDb: false
storage:
Expand Down
6 changes: 5 additions & 1 deletion config/samples/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
components: {}
components:
devfileRegistry:
disableInternalRegistry: true
externalDevfileRegistries:
- url: 'https://registry.devfile.io'
devEnvironments: {}
networking: {}
containerRegistry: {}
Expand Down
6 changes: 5 additions & 1 deletion deploy/deployment/kubernetes/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
components: {}
components:
devfileRegistry:
disableInternalRegistry: true
externalDevfileRegistries:
- url: 'https://registry.devfile.io'
devEnvironments: {}
networking: {}
containerRegistry: {}
Expand Down
6 changes: 5 additions & 1 deletion deploy/deployment/openshift/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
components: {}
components:
devfileRegistry:
disableInternalRegistry: true
externalDevfileRegistries:
- url: 'https://registry.devfile.io'
devEnvironments: {}
networking: {}
containerRegistry: {}
Expand Down
6 changes: 5 additions & 1 deletion helmcharts/next/templates/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
components: {}
components:
devfileRegistry:
disableInternalRegistry: true
externalDevfileRegistries:
- url: 'https://registry.devfile.io'
devEnvironments: {}
networking:
tlsSecretName: che-tls
Expand Down
20 changes: 16 additions & 4 deletions pkg/deploy/devfileregistry/devfileregistry.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2019-2023 Red Hat, Inc.
// Copyright (c) 2019-2024 Red Hat, Inc.
// This program and the accompanying materials are made
// available under the terms of the Eclipse Public License 2.0
// which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -15,6 +15,9 @@ package devfileregistry
import (
"fmt"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"

"github.com/eclipse-che/che-operator/pkg/common/chetypes"
"github.com/eclipse-che/che-operator/pkg/common/constants"
"github.com/eclipse-che/che-operator/pkg/deploy"
Expand All @@ -33,9 +36,18 @@ func NewDevfileRegistryReconciler() *DevfileRegistryReconciler {

func (d *DevfileRegistryReconciler) Reconcile(ctx *chetypes.DeployContext) (reconcile.Result, bool, error) {
if ctx.CheCluster.Spec.Components.DevfileRegistry.DisableInternalRegistry {
ctx.CheCluster.Status.DevfileRegistryURL = ""
err := deploy.UpdateCheCRStatus(ctx, "DevfileRegistryURL", "")
return reconcile.Result{}, err == nil, err
_, _ = deploy.DeleteNamespacedObject(ctx, constants.DevfileRegistryName, &corev1.Service{})
_, _ = deploy.DeleteNamespacedObject(ctx, constants.DevfileRegistryName, &corev1.ConfigMap{})
_, _ = deploy.DeleteNamespacedObject(ctx, gateway.GatewayConfigMapNamePrefix+constants.DevfileRegistryName, &corev1.ConfigMap{})
_, _ = deploy.DeleteNamespacedObject(ctx, constants.DevfileRegistryName, &appsv1.Deployment{})

if ctx.CheCluster.Status.DevfileRegistryURL != "" {
ctx.CheCluster.Status.DevfileRegistryURL = ""
err := deploy.UpdateCheCRStatus(ctx, "DevfileRegistryURL", "")
return reconcile.Result{}, err == nil, err
}

return reconcile.Result{}, true, nil
}

done, err := d.syncService(ctx)
Expand Down

0 comments on commit 76b21ea

Please sign in to comment.