Skip to content

Commit 2e0be68

Browse files
Merge pull request #1875 from lmiccini/rmq_make_bundle
Fixup make bundle #1857 and add back safeguard from #1867
2 parents ca4105c + 4c1ddcf commit 2e0be68

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

config/manifests/bases/openstack-operator.clusterserviceversion.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ spec:
376376
Resource
377377
displayName: Template
378378
path: openstackclient.template
379+
- description: List of environment variables to set in the container.
380+
displayName: Env
381+
path: openstackclient.template.env
379382
- description: Ovn - Overrides to use when creating the OVN Services
380383
displayName: Ovn
381384
path: ovn

internal/openstack/version.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
1111
corev1beta1 "github.com/openstack-k8s-operators/openstack-operator/api/core/v1beta1"
12+
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
1213
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1314
"k8s.io/apimachinery/pkg/types"
1415
"k8s.io/utils/ptr"
@@ -254,10 +255,19 @@ func ReconcileVersion(ctx context.Context, instance *corev1beta1.OpenStackContro
254255
Name: instance.Name,
255256
Namespace: instance.Namespace,
256257
},
257-
version); err == nil {
258-
Log.Info(fmt.Sprintf("OpenStackVersion found. Name: %s", version.Name))
259-
} else {
258+
version); err != nil {
259+
if !k8s_errors.IsNotFound(err) {
260+
return ctrl.Result{}, nil, fmt.Errorf("failed to get OpenStackVersion %s: %w", instance.Name, err)
261+
}
260262
Log.Info(fmt.Sprintf("OpenStackVersion does not exist. Creating: %s", version.Name))
263+
} else {
264+
Log.Info(fmt.Sprintf("OpenStackVersion found. Name: %s", version.Name))
265+
}
266+
267+
// If the controlplane is being deleted, skip CreateOrPatch to avoid
268+
// re-creating the OpenStackVersion CR during cleanup.
269+
if !instance.DeletionTimestamp.IsZero() {
270+
return ctrl.Result{}, version, nil
261271
}
262272

263273
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), version, func() error {

0 commit comments

Comments
 (0)