@@ -19,6 +19,7 @@ import (
1919	"k8s.io/apimachinery/pkg/runtime" 
2020	"k8s.io/apimachinery/pkg/util/sets" 
2121	"k8s.io/cli-runtime/pkg/resource" 
22+ 	"k8s.io/utils/ptr" 
2223	"sigs.k8s.io/controller-runtime/pkg/client" 
2324	"sigs.k8s.io/yaml" 
2425
@@ -277,6 +278,11 @@ func (c Converter) Convert(rv1 RegistryV1, installNamespace string, targetNamesp
277278		annotations  :=  util .MergeMaps (rv1 .CSV .Annotations , depSpec .Spec .Template .Annotations )
278279		annotations ["olm.targetNamespaces" ] =  strings .Join (targetNamespaces , "," )
279280		depSpec .Spec .Template .Annotations  =  annotations 
281+ 
282+ 		// Hardcode the deployment with RevisionHistoryLimit=1 to replicate OLMv0 behavior 
283+ 		// https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/install/deployment.go#L181 
284+ 		depSpec .Spec .RevisionHistoryLimit  =  ptr .To (int32 (1 ))
285+ 
280286		deployments  =  append (deployments , appsv1.Deployment {
281287			TypeMeta : metav1.TypeMeta {
282288				Kind :       "Deployment" ,
@@ -328,8 +334,8 @@ func (c Converter) Convert(rv1 RegistryV1, installNamespace string, targetNamesp
328334				APIGroups : []string {corev1 .GroupName },
329335				Resources : []string {"namespaces" },
330336			})
337+ 			clusterPermissions  =  append (clusterPermissions , p )
331338		}
332- 		clusterPermissions  =  append (clusterPermissions , permissions ... )
333339		permissions  =  nil 
334340	}
335341
0 commit comments