Skip to content

Commit

Permalink
Update OLM files
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <[email protected]>
  • Loading branch information
mmorhun committed Jul 7, 2021
1 parent b6c2c3c commit 4ffa99e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ metadata:
categories: Developer Tools
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-02T08:14:01Z"
createdAt: "2021-07-07T09:30:36Z"
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.33.0-248.nightly
name: eclipse-che-preview-kubernetes.v7.33.0-250.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1241,4 +1241,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-248.nightly
version: 7.33.0-250.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ metadata:
categories: Developer Tools, OpenShift Optional
certified: "false"
containerImage: quay.io/eclipse/che-operator:next
createdAt: "2021-07-02T08:14:06Z"
createdAt: "2021-07-07T09:30:48Z"
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.33.0-248.nightly
name: eclipse-che-preview-openshift.v7.33.0-250.nightly
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1318,4 +1318,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.33.0-248.nightly
version: 7.33.0-250.nightly
42 changes: 9 additions & 33 deletions pkg/controller/checlusterbackup/internal_backup_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)

const (
Expand Down Expand Up @@ -77,10 +76,7 @@ func ensureInternalBackupServerDeploymentExist(bctx *BackupContext) (bool, error
}

// Get default configuration of the backup server deployment
backupServerDeployment, err = getBackupServerDeploymentSpec(bctx)
if err != nil {
return false, err
}
backupServerDeployment = getBackupServerDeploymentSpec(bctx)
// Create backup server deployment
err = bctx.r.client.Create(context.TODO(), backupServerDeployment)
if err != nil {
Expand All @@ -90,7 +86,7 @@ func ensureInternalBackupServerDeploymentExist(bctx *BackupContext) (bool, error
return false, nil
}

func getBackupServerDeploymentSpec(bctx *BackupContext) (*appsv1.Deployment, error) {
func getBackupServerDeploymentSpec(bctx *BackupContext) *appsv1.Deployment {
labels, labelSelector := deploy.GetLabelsAndSelector(bctx.cheCR, InternalBackupServerComponent)
// TODO should we use component label to select backup related resources instead of part-of label ?
labels[deploy.KubernetesPartOfLabelKey] = BackupCheEclipseOrg
Expand Down Expand Up @@ -142,12 +138,7 @@ func getBackupServerDeploymentSpec(bctx *BackupContext) (*appsv1.Deployment, err
},
}

// Set CheClusterBackup instance as the owner and controller
if err := controllerutil.SetControllerReference(bctx.backupCR, deployment, bctx.r.scheme); err != nil {
return nil, err
}

return deployment, nil
return deployment
}

func ensureInternalBackupServerPodReady(bctx *BackupContext) (bool, error) {
Expand Down Expand Up @@ -183,10 +174,7 @@ func ensureInternalBackupServerServiceExists(bctx *BackupContext) (bool, error)
}

// Backup server service doesn't exists, create it
backupServerService, err = getBackupServerServiceSpec(bctx)
if err != nil {
return false, err
}
backupServerService = getBackupServerServiceSpec(bctx)
// Create backup server service
err = bctx.r.client.Create(context.TODO(), backupServerService)
if err != nil {
Expand All @@ -196,7 +184,7 @@ func ensureInternalBackupServerServiceExists(bctx *BackupContext) (bool, error)
return false, nil
}

func getBackupServerServiceSpec(bctx *BackupContext) (*corev1.Service, error) {
func getBackupServerServiceSpec(bctx *BackupContext) *corev1.Service {
labels := deploy.GetLabels(bctx.cheCR, InternalBackupServerComponent)
labels[deploy.KubernetesPartOfLabelKey] = BackupCheEclipseOrg

Expand Down Expand Up @@ -224,12 +212,7 @@ func getBackupServerServiceSpec(bctx *BackupContext) (*corev1.Service, error) {
},
}

// Set CheClusterBackup instance as the owner and controller
if err := controllerutil.SetControllerReference(bctx.backupCR, service, bctx.r.scheme); err != nil {
return nil, err
}

return service, nil
return service
}

// ensureInternalBackupServerConfigurationExistAndCorrect makes sure that there is CR with correct internal backup server configuration
Expand Down Expand Up @@ -327,10 +310,7 @@ func ensureInternalBackupServerSecretExists(bctx *BackupContext) (bool, error) {
}

repoPassword := util.GeneratePasswd(12)
repoPasswordSecret, err = getRepoPasswordSecretSpec(bctx, repoPassword)
if err != nil {
return false, err
}
repoPasswordSecret = getRepoPasswordSecretSpec(bctx, repoPassword)
err = bctx.r.client.Create(context.TODO(), repoPasswordSecret)
if err != nil {
return false, err
Expand All @@ -339,7 +319,7 @@ func ensureInternalBackupServerSecretExists(bctx *BackupContext) (bool, error) {
return false, nil
}

func getRepoPasswordSecretSpec(bctx *BackupContext, password string) (*corev1.Secret, error) {
func getRepoPasswordSecretSpec(bctx *BackupContext, password string) *corev1.Secret {
labels := deploy.GetLabels(bctx.cheCR, InternalBackupServerComponent)
labels[deploy.KubernetesPartOfLabelKey] = BackupCheEclipseOrg

Expand All @@ -358,9 +338,5 @@ func getRepoPasswordSecretSpec(bctx *BackupContext, password string) (*corev1.Se
Data: data,
}

if err := controllerutil.SetControllerReference(bctx.backupCR, secret, bctx.r.scheme); err != nil {
return nil, err
}

return secret, nil
return secret
}

0 comments on commit 4ffa99e

Please sign in to comment.