Skip to content

Commit

Permalink
Revert "fix: Disable cascade deletion"
Browse files Browse the repository at this point in the history
This reverts commit a5d87b1.
  • Loading branch information
Danny-Wei committed Jun 14, 2024
1 parent a5d87b1 commit c6b7312
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/policy/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func updateWorkloadAnnotationsAndEnv(
}

func forceSetOwnerReference(ap *varmor.ArmorProfile, obj interface{}, clusterScope bool) {
controller := true
if clusterScope {
vcp := obj.(*varmor.VarmorClusterPolicy)
ap.OwnerReferences = []metav1.OwnerReference{
Expand All @@ -517,6 +518,7 @@ func forceSetOwnerReference(ap *varmor.ArmorProfile, obj interface{}, clusterSco
Kind: "VarmorClusterPolicy",
Name: vcp.Name,
UID: vcp.UID,
Controller: &controller,
},
}
} else {
Expand All @@ -527,6 +529,7 @@ func forceSetOwnerReference(ap *varmor.ArmorProfile, obj interface{}, clusterSco
Kind: "VarmorPolicy",
Name: vp.Name,
UID: vp.UID,
Controller: &controller,
},
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func GenerateProfile(policy varmor.Policy, name string, namespace string, varmor

func NewArmorProfile(obj interface{}, varmorInterface varmorinterface.CrdV1beta1Interface, clusterScope bool) (*varmor.ArmorProfile, error) {
ap := varmor.ArmorProfile{}
controller := true

if clusterScope {
vcp := obj.(*varmor.VarmorClusterPolicy)
Expand All @@ -205,6 +206,7 @@ func NewArmorProfile(obj interface{}, varmorInterface varmorinterface.CrdV1beta1
Kind: "VarmorClusterPolicy",
Name: vcp.Name,
UID: vcp.UID,
Controller: &controller,
},
}

Expand Down Expand Up @@ -237,6 +239,7 @@ func NewArmorProfile(obj interface{}, varmorInterface varmorinterface.CrdV1beta1
Kind: "VarmorPolicy",
Name: vp.Name,
UID: vp.UID,
Controller: &controller,
},
}

Expand Down

0 comments on commit c6b7312

Please sign in to comment.