From a1c972c384e92a9360b57f1bbdbd12464aa7523a Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 30 Nov 2021 09:46:06 +0200 Subject: [PATCH 1/2] fix: don't require 'app.kubernetes.io/instance:che' label Signed-off-by: Anatolii Bazko --- controllers/che/cheobj_verifier.go | 11 ----------- controllers/checlusterrestore/backup_data_restorer.go | 3 +-- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/controllers/che/cheobj_verifier.go b/controllers/che/cheobj_verifier.go index 2b6970dca7..d3877385da 100644 --- a/controllers/che/cheobj_verifier.go +++ b/controllers/che/cheobj_verifier.go @@ -57,12 +57,6 @@ func IsTrustedBundleConfigMap(cl client.Client, watchNamespace string, obj clien // ignore not matched labels return false, ctrl.Request{} } - - // Check for instance label - if value, exists := obj.GetLabels()[deploy.KubernetesInstanceLabelKey]; !exists || value != deploy.DefaultCheFlavor(checluster) { - // Ignore config map with missing instance label - return false, ctrl.Request{} - } } return true, ctrl.Request{ @@ -100,11 +94,6 @@ func IsEclipseCheRelatedObj(cl client.Client, watchNamespace string, obj client. return false, ctrl.Request{} } - // Check for instance label - if value, exists := obj.GetLabels()[deploy.KubernetesInstanceLabelKey]; !exists || value != deploy.DefaultCheFlavor(checluster) { - return false, ctrl.Request{} - } - return true, ctrl.Request{ NamespacedName: types.NamespacedName{ Namespace: checluster.Namespace, diff --git a/controllers/checlusterrestore/backup_data_restorer.go b/controllers/checlusterrestore/backup_data_restorer.go index a93c3b4f4c..f4512969de 100644 --- a/controllers/checlusterrestore/backup_data_restorer.go +++ b/controllers/checlusterrestore/backup_data_restorer.go @@ -149,10 +149,9 @@ func cleanPreviousInstallation(rctx *RestoreContext, dataDir string) (bool, erro cheFlavor := deploy.DefaultCheFlavor(rctx.cheCR) cheNameRequirement, _ := labels.NewRequirement(deploy.KubernetesNameLabelKey, selection.Equals, []string{cheFlavor}) - cheInstanceRequirement, _ := labels.NewRequirement(deploy.KubernetesInstanceLabelKey, selection.Equals, []string{cheFlavor}) skipBackupObjectsRequirement, _ := labels.NewRequirement(deploy.KubernetesPartOfLabelKey, selection.NotEquals, []string{checlusterbackup.BackupCheEclipseOrg}) - cheResourcesLabelSelector := labels.NewSelector().Add(*cheInstanceRequirement).Add(*cheNameRequirement).Add(*skipBackupObjectsRequirement) + cheResourcesLabelSelector := labels.NewSelector().Add(*cheNameRequirement).Add(*skipBackupObjectsRequirement) cheResourcesListOptions := &client.ListOptions{ LabelSelector: cheResourcesLabelSelector, Namespace: rctx.namespace, From 621f04dbb2c54e4da8c163bcc27cb730a7c6f69b Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 30 Nov 2021 13:24:18 +0200 Subject: [PATCH 2/2] Revert some changes Signed-off-by: Anatolii Bazko --- controllers/checlusterrestore/backup_data_restorer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/checlusterrestore/backup_data_restorer.go b/controllers/checlusterrestore/backup_data_restorer.go index f4512969de..a93c3b4f4c 100644 --- a/controllers/checlusterrestore/backup_data_restorer.go +++ b/controllers/checlusterrestore/backup_data_restorer.go @@ -149,9 +149,10 @@ func cleanPreviousInstallation(rctx *RestoreContext, dataDir string) (bool, erro cheFlavor := deploy.DefaultCheFlavor(rctx.cheCR) cheNameRequirement, _ := labels.NewRequirement(deploy.KubernetesNameLabelKey, selection.Equals, []string{cheFlavor}) + cheInstanceRequirement, _ := labels.NewRequirement(deploy.KubernetesInstanceLabelKey, selection.Equals, []string{cheFlavor}) skipBackupObjectsRequirement, _ := labels.NewRequirement(deploy.KubernetesPartOfLabelKey, selection.NotEquals, []string{checlusterbackup.BackupCheEclipseOrg}) - cheResourcesLabelSelector := labels.NewSelector().Add(*cheNameRequirement).Add(*skipBackupObjectsRequirement) + cheResourcesLabelSelector := labels.NewSelector().Add(*cheInstanceRequirement).Add(*cheNameRequirement).Add(*skipBackupObjectsRequirement) cheResourcesListOptions := &client.ListOptions{ LabelSelector: cheResourcesLabelSelector, Namespace: rctx.namespace,