Skip to content

Commit 1a47d64

Browse files
perdasilvaPer Goncalves da Silva
and
Per Goncalves da Silva
authored
🐛 Fix bundle to plain manifest conversion (#1899)
* update deployment resource and fix AllNamespaces cluster permissions Signed-off-by: Per Goncalves da Silva <[email protected]> * update generated bundle manifests Signed-off-by: Per Goncalves da Silva <[email protected]> --------- Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]>
1 parent cedf1e7 commit 1a47d64

6 files changed

+21
-4
lines changed

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

+7-1
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

Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
44
creationTimestamp: null
5-
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
5+
name: argocd-operator.v0.-3gkm3u8zfarktdile5wekso69zs9bgzb988mhjm0y6p
66
rules:
77
- apiGroups:
88
- ""
@@ -35,3 +35,11 @@ rules:
3535
verbs:
3636
- create
3737
- patch
38+
- apiGroups:
39+
- ""
40+
resources:
41+
- namespaces
42+
verbs:
43+
- get
44+
- list
45+
- watch
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
44
creationTimestamp: null
5-
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
5+
name: argocd-operator.v0.-3gkm3u8zfarktdile5wekso69zs9bgzb988mhjm0y6p
66
roleRef:
77
apiGroup: rbac.authorization.k8s.io
88
kind: ClusterRole
9-
name: argocd-operator.v0-22gmilmgp91wu25is5i2ec598hni8owq3l71bbkl7iz3
9+
name: argocd-operator.v0.-3gkm3u8zfarktdile5wekso69zs9bgzb988mhjm0y6p
1010
subjects:
1111
- kind: ServiceAccount
1212
name: argocd-operator-controller-manager

test/convert/expected-manifests/argocd-operator.v0.6.0/all-namespaces/11_deployment_argocd-operator-controller-manager.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
namespace: argocd-system
77
spec:
88
replicas: 1
9+
revisionHistoryLimit: 1
910
selector:
1011
matchLabels:
1112
control-plane: controller-manager

test/convert/expected-manifests/argocd-operator.v0.6.0/own-namespace/09_deployment_argocd-operator-controller-manager.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
namespace: argocd-system
77
spec:
88
replicas: 1
9+
revisionHistoryLimit: 1
910
selector:
1011
matchLabels:
1112
control-plane: controller-manager

test/convert/expected-manifests/argocd-operator.v0.6.0/single-namespace/09_deployment_argocd-operator-controller-manager.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
namespace: argocd-system
77
spec:
88
replicas: 1
9+
revisionHistoryLimit: 1
910
selector:
1011
matchLabels:
1112
control-plane: controller-manager

0 commit comments

Comments
 (0)