Skip to content

Commit fbd7b5e

Browse files
Per Goncalves da Silvaperdasilva
authored andcommitted
update deployment resource and fix AllNamespaces cluster permissions
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
1 parent 7bf7e5a commit fbd7b5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/operator-controller/rukpak/convert/registryv1.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)