Skip to content

Commit

Permalink
rebase with main
Browse files Browse the repository at this point in the history
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
  • Loading branch information
varshaprasad96 committed Jun 6, 2024
1 parent ffdf78d commit 61c33db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -257,10 +258,10 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
setStatusUnpackFailed(ext, err.Error())
return ctrl.Result{}, err
}
setStatusUnpacked(ext, unpackResult.Message)
setStatusUnpacked(ext, fmt.Sprintf("unpack successful: %v", unpackResult.Message))
default:
setStatusUnpackFailed(ext, err.Error())
return ctrl.Result{}, err
setStatusUnpackFailed(ext, fmt.Sprintf("unpack successful: %v", unpackResult.Message))
return ctrl.Result{}, fmt.Errorf("unexpected unpack status: %v", err)
}

bundleFS, err := r.Storage.Load(ctx, ext)
Expand Down Expand Up @@ -331,11 +332,18 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
}

for _, obj := range relObjects {
uMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
if err != nil {
setInstalledStatusConditionFailed(ext, fmt.Sprintf("%s:%v", rukpakv1alpha2.ReasonCreateDynamicWatchFailed, err))
return ctrl.Result{}, err
}

unstructuredObj := &unstructured.Unstructured{Object: uMap}
if err := func() error {
r.dynamicWatchMutex.Lock()
defer r.dynamicWatchMutex.Unlock()

_, isWatched := r.dynamicWatchGVKs[obj.GetObjectKind().GroupVersionKind()]
_, isWatched := r.dynamicWatchGVKs[unstructuredObj.GroupVersionKind()]
if !isWatched {
if err := r.controller.Watch(
source.Kind(
Expand All @@ -354,7 +362,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
return nil
}(); err != nil {
ext.Status.InstalledBundle = nil
setInstalledStatusConditionFailed(ext, fmt.Sprintf("%s:%v", ocv1alpha1.ReasonCreateDynamicWatchFailed, err))
setInstalledStatusConditionFailed(ext, fmt.Sprintf("%s:%v", rukpakv1alpha2.ReasonCreateDynamicWatchFailed, err))
return ctrl.Result{}, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/bundles/registry-v1/build-push-e2e-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo "${namespace}" "${tag}"
kubectl create configmap -n "${namespace}" --from-file="${bundle_dir}/Dockerfile" operator-controller-e2e-${bundle_name}.root

tgz="${bundle_dir}/manifests.tgz"
tar czf "${tgz}" -C "${bundle_dir}/" manifests metadata
gtar czf "${tgz}" -C "${bundle_dir}/" manifests metadata
kubectl create configmap -n "${namespace}" --from-file="${tgz}" operator-controller-${bundle_name}.manifests
rm "${tgz}"

Expand Down

0 comments on commit 61c33db

Please sign in to comment.