Skip to content

Commit 61d47c8

Browse files
committed
Fix scc issues with VMFR
Fixes issue #53 Signed-off-by: Michal Pryc <mpryc@redhat.com>
1 parent 21b8a2b commit 61d47c8

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ rules:
9393
- patch
9494
- update
9595
- watch
96+
- apiGroups:
97+
- security.openshift.io
98+
resourceNames:
99+
- privileged
100+
resources:
101+
- securitycontextconstraints
102+
verbs:
103+
- use
96104
- apiGroups:
97105
- velero.io
98106
resources:

internal/controller/virtualmachinefilerestore_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (e ErrUnsupportedBackup) Error() string {
9595
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;watch
9696
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;patch;delete
9797
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
98+
// +kubebuilder:rbac:groups=security.openshift.io,resources=securitycontextconstraints,resourceNames=privileged,verbs=use
9899
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
99100
// +kubebuilder:rbac:groups=velero.io,resources=restores,verbs=get;list;watch;create;update;patch;delete
100101
// +kubebuilder:rbac:groups=velero.io,resources=backups,verbs=get;list;watch

test/e2e/e2e_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ var _ = Describe("Manager", Ordered, func() {
8383
Expect(err).NotTo(HaveOccurred(), "Failed to patch imagePullPolicy")
8484
})
8585

86-
// After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs,
87-
// and deleting the namespace.
86+
// After all tests have been executed, clean up by deleting controller resources
87+
// but NOT the namespace (which contains Velero needed by other test suites).
8888
AfterAll(func() {
8989
By("cleaning up the curl pod for metrics")
9090
cmd := exec.Command("kubectl", "delete", "pod", "curl-metrics", "-n", namespace)
@@ -94,8 +94,20 @@ var _ = Describe("Manager", Ordered, func() {
9494
cmd = exec.Command("kubectl", "delete", "clusterrolebinding", metricsRoleBindingName)
9595
_, _ = utils.Run(cmd)
9696

97-
By("undeploying the controller-manager")
98-
cmd = exec.Command("make", "undeploy")
97+
By("deleting the controller deployment")
98+
cmd = exec.Command("kubectl", "delete", "deployment", "oadp-vm-file-restore-controller-manager", "-n", namespace, "--ignore-not-found")
99+
_, _ = utils.Run(cmd)
100+
101+
By("deleting controller RBAC resources")
102+
cmd = exec.Command("kubectl", "delete", "clusterrole,clusterrolebinding,role,rolebinding", "-l", "app.kubernetes.io/name=oadp-vm-file-restore", "--ignore-not-found")
103+
_, _ = utils.Run(cmd)
104+
105+
By("deleting controller service account")
106+
cmd = exec.Command("kubectl", "delete", "serviceaccount", serviceAccountName, "-n", namespace, "--ignore-not-found")
107+
_, _ = utils.Run(cmd)
108+
109+
By("deleting metrics service")
110+
cmd = exec.Command("kubectl", "delete", "service", metricsServiceName, "-n", namespace, "--ignore-not-found")
99111
_, _ = utils.Run(cmd)
100112

101113
By("uninstalling CRDs")

0 commit comments

Comments
 (0)