Skip to content

Commit 32a48da

Browse files
mprahlopenshift-merge-bot[bot]
authored andcommitted
Fix unrelated gosec errors
Signed-off-by: mprahl <[email protected]>
1 parent d0e2f61 commit 32a48da

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

controllers/templatesync/template_sync.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
10161016
}
10171017
// Iterate over the ConstraintTemplates to gather the Constraints on the cluster
10181018
for _, gkCT := range gkConstraintTemplateListv1.Items {
1019+
gkCT := gkCT
1020+
10191021
tmplGVRs = append(tmplGVRs, gvrScoped{
10201022
gvr: schema.GroupVersionResource{
10211023
Group: utils.GConstraint,
@@ -1046,6 +1048,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
10461048
}
10471049
// Iterate over the ConstraintTemplates to gather the Constraints on the cluster
10481050
for _, gkCT := range gkConstraintTemplateListv1beta1.Items {
1051+
gkCT := gkCT
1052+
10491053
tmplGVRs = append(tmplGVRs, gvrScoped{
10501054
gvr: schema.GroupVersionResource{
10511055
Group: utils.GConstraint,
@@ -1078,6 +1082,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
10781082
err := r.List(ctx, &crdsv1, &crdQuery)
10791083
if err == nil {
10801084
for _, crd := range crdsv1.Items {
1085+
crd := crd
1086+
10811087
if len(crd.Spec.Versions) > 0 {
10821088
tmplGVRs = append(tmplGVRs, gvrScoped{
10831089
gvr: schema.GroupVersionResource{
@@ -1096,6 +1102,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
10961102
return fmt.Errorf("error listing v1beta1 CRDs with query %+v: %w", crdQuery, err)
10971103
}
10981104
for _, crd := range crdsv1beta1.Items {
1105+
crd := crd
1106+
10991107
if len(crd.Spec.Versions) > 0 {
11001108
tmplGVRs = append(tmplGVRs, gvrScoped{
11011109
gvr: schema.GroupVersionResource{
@@ -1112,6 +1120,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
11121120
}
11131121

11141122
for _, gvrScoped := range tmplGVRs {
1123+
gvrScoped := gvrScoped
1124+
11151125
// Instantiate a dynamic client for the GVR
11161126
resourceNs := ""
11171127
if gvrScoped.namespaced {
@@ -1133,6 +1143,8 @@ func (r *PolicyReconciler) cleanUpExcessTemplates(
11331143
}
11341144

11351145
for _, tmpl := range children.Items {
1146+
tmpl := tmpl
1147+
11361148
// delete all templates with policy label that aren't still in the policy
11371149
found := false
11381150

0 commit comments

Comments
 (0)