@@ -17,7 +17,6 @@ import (
17
17
//"sigs.k8s.io/controller-runtime/pkg/client"
18
18
19
19
"github.com/go-logr/logr"
20
- security "github.com/openshift/api/security/v1"
21
20
oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1"
22
21
"github.com/openshift/oadp-operator/pkg/common"
23
22
"github.com/vmware-tanzu/velero/pkg/install"
@@ -203,54 +202,6 @@ func (r *DPAReconciler) ReconcileVeleroClusterRoleBinding(log logr.Logger) (bool
203
202
return true , nil
204
203
}
205
204
206
- func (r * DPAReconciler ) ReconcileVeleroSecurityContextConstraint (log logr.Logger ) (bool , error ) {
207
- dpa := oadpv1alpha1.DataProtectionApplication {}
208
- if err := r .Get (r .Context , r .NamespacedName , & dpa ); err != nil {
209
- return false , err
210
- }
211
- sa := corev1.ServiceAccount {}
212
- nsName := types.NamespacedName {
213
- Namespace : dpa .Namespace ,
214
- Name : common .Velero ,
215
- }
216
- if err := r .Get (r .Context , nsName , & sa ); err != nil {
217
- return false , err
218
- }
219
-
220
- veleroSCC := & security.SecurityContextConstraints {
221
- ObjectMeta : metav1.ObjectMeta {
222
- Name : "velero-privileged" ,
223
- },
224
- }
225
- op , err := controllerutil .CreateOrPatch (r .Context , r .Client , veleroSCC , func () error {
226
- // Setting controller owner reference on the velero SCC
227
- // TODO: HOW DO I DO THIS?? ALAY HALP PLZ
228
- /*err := controllerutil.SetControllerReference(&velero, veleroSCC, r.Scheme)
229
- if err != nil {
230
- return err
231
- }*/
232
-
233
- // update the SCC template
234
- return r .privilegedSecurityContextConstraints (veleroSCC , & dpa , & sa )
235
- })
236
-
237
- if err != nil {
238
- return false , err
239
- }
240
-
241
- //TODO: Review velero SCC status and report errors and conditions
242
-
243
- if op == controllerutil .OperationResultCreated || op == controllerutil .OperationResultUpdated {
244
- // Trigger event to indicate velero SCC was created or updated
245
- r .EventRecorder .Event (veleroSCC ,
246
- corev1 .EventTypeNormal ,
247
- "VeleroSecurityContextConstraintsReconciled" ,
248
- fmt .Sprintf ("performed %s on velero scc %s" , op , veleroSCC .Name ),
249
- )
250
- }
251
- return true , nil
252
- }
253
-
254
205
func (r * DPAReconciler ) ReconcileVeleroDeployment (log logr.Logger ) (bool , error ) {
255
206
dpa := oadpv1alpha1.DataProtectionApplication {}
256
207
if err := r .Get (r .Context , r .NamespacedName , & dpa ); err != nil {
@@ -326,52 +277,6 @@ func (r *DPAReconciler) veleroClusterRoleBinding(dpa *oadpv1alpha1.DataProtectio
326
277
return crb , nil
327
278
}
328
279
329
- func (r * DPAReconciler ) privilegedSecurityContextConstraints (scc * security.SecurityContextConstraints , dpa * oadpv1alpha1.DataProtectionApplication , sa * corev1.ServiceAccount ) error {
330
- // ObjectMeta set from prior step.
331
-
332
- scc .AllowHostDirVolumePlugin = true
333
- scc .AllowHostIPC = true
334
- scc .AllowHostNetwork = true
335
- scc .AllowHostPID = true
336
- scc .AllowHostPorts = true
337
- scc .AllowPrivilegeEscalation = pointer .BoolPtr (true )
338
- scc .AllowPrivilegedContainer = true
339
- scc .AllowedCapabilities = []corev1.Capability {
340
- security .AllowAllCapabilities ,
341
- }
342
- scc .AllowedUnsafeSysctls = []string {
343
- "*" ,
344
- }
345
- scc .DefaultAddCapabilities = nil
346
- scc .FSGroup = security.FSGroupStrategyOptions {
347
- Type : security .FSGroupStrategyRunAsAny ,
348
- }
349
- scc .Priority = nil
350
- scc .ReadOnlyRootFilesystem = false
351
- scc .RequiredDropCapabilities = nil
352
- scc .RunAsUser = security.RunAsUserStrategyOptions {
353
- Type : security .RunAsUserStrategyRunAsAny ,
354
- }
355
- scc .SELinuxContext = security.SELinuxContextStrategyOptions {
356
- Type : security .SELinuxStrategyRunAsAny ,
357
- }
358
- scc .SeccompProfiles = []string {
359
- "*" ,
360
- }
361
- scc .SupplementalGroups = security.SupplementalGroupsStrategyOptions {
362
- Type : security .SupplementalGroupsStrategyRunAsAny ,
363
- }
364
- scc .Users = []string {
365
- "system:admin" ,
366
- fmt .Sprintf ("system:serviceaccount:%s:%s" , sa .Namespace , sa .Name ),
367
- }
368
- scc .Volumes = []security.FSType {
369
- security .FSTypeAll ,
370
- }
371
-
372
- return nil
373
- }
374
-
375
280
// Build VELERO Deployment
376
281
func (r * DPAReconciler ) buildVeleroDeployment (veleroDeployment * appsv1.Deployment , dpa * oadpv1alpha1.DataProtectionApplication ) error {
377
282
0 commit comments