Skip to content

Commit d33b6b3

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

File tree

8 files changed

+29
-12
lines changed

8 files changed

+29
-12
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ help: ## Display this help.
5555

5656
.PHONY: manifests
5757
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
58-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
58+
$(CONTROLLER_GEN) rbac:roleName=oadp-vmfr-controller-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
5959

6060
.PHONY: generate
6161
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -263,4 +263,4 @@ endif
263263
for file_name in $(shell ls $(shell pwd)/hack/extra-crds);do \
264264
cp $(OADP_OPERATOR_PATH)/config/crd/bases/$$file_name $(shell pwd)/hack/extra-crds/$$file_name && \
265265
sed -i "1s%^%# Code generated by make update-velero-manifests. DO NOT EDIT.\n%" $(shell pwd)/hack/extra-crds/$$file_name;done ;\
266-
}
266+
}

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,5 @@ spec:
101101
memory: 64Mi
102102
volumeMounts: []
103103
volumes: []
104-
serviceAccountName: controller-manager
104+
serviceAccountName: oadp-vmfr-controller
105105
terminationGracePeriodSeconds: 10

config/rbac/leader_election_role_binding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ roleRef:
1111
name: leader-election-role
1212
subjects:
1313
- kind: ServiceAccount
14-
name: controller-manager
14+
name: oadp-vmfr-controller
1515
namespace: system

config/rbac/metrics_auth_role_binding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ roleRef:
88
name: metrics-auth-role
99
subjects:
1010
- kind: ServiceAccount
11-
name: controller-manager
11+
name: oadp-vmfr-controller
1212
namespace: system

config/rbac/role.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
name: manager-role
5+
name: oadp-vmfr-controller-role
66
rules:
77
- apiGroups:
88
- ""
@@ -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:

config/rbac/role_binding.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
44
labels:
5-
app.kubernetes.io/name: oadp-vm-file-restore
5+
app.kubernetes.io/name: clusterrolebinding
6+
app.kubernetes.io/instance: oadp-vmfr-controller-rolebinding
7+
app.kubernetes.io/component: rbac
8+
app.kubernetes.io/created-by: oadp-operator
9+
app.kubernetes.io/part-of: oadp-operator
610
app.kubernetes.io/managed-by: kustomize
7-
name: manager-rolebinding
11+
name: oadp-vmfr-controller-rolebinding
812
roleRef:
913
apiGroup: rbac.authorization.k8s.io
1014
kind: ClusterRole
11-
name: manager-role
15+
name: oadp-vmfr-controller-role
1216
subjects:
1317
- kind: ServiceAccount
14-
name: controller-manager
18+
name: oadp-vmfr-controller
1519
namespace: system

config/rbac/service_account.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ apiVersion: v1
22
kind: ServiceAccount
33
metadata:
44
labels:
5-
app.kubernetes.io/name: oadp-vm-file-restore
5+
app.kubernetes.io/name: serviceaccount
6+
app.kubernetes.io/instance: oadp-vmfr-controller-sa
7+
app.kubernetes.io/component: rbac
8+
app.kubernetes.io/created-by: oadp-operator
9+
app.kubernetes.io/part-of: oadp-operator
610
app.kubernetes.io/managed-by: kustomize
7-
name: controller-manager
11+
name: oadp-vmfr-controller
812
namespace: system

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

0 commit comments

Comments
 (0)