Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 0e33d6e

Browse files
committed
Correct Istio AutoInject Flag to a Annotation
1 parent 493f77e commit 0e33d6e

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

operator/controllers/execution/scans/hook_reconciler.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,7 @@ func (r *ScanReconciler) createJobForHook(hook *executionv1.ScanCompletionHook,
375375
ObjectMeta: metav1.ObjectMeta{
376376
Annotations: map[string]string{
377377
"auto-discovery.experimental.securecodebox.io/ignore": "true",
378-
},
379-
Labels: map[string]string{
380-
"sidecar.istio.io/inject": "false",
378+
"sidecar.istio.io/inject": "false",
381379
},
382380
},
383381
Spec: corev1.PodSpec{

operator/controllers/execution/scans/parse_reconciler.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
9393
ObjectMeta: metav1.ObjectMeta{
9494
Annotations: map[string]string{
9595
"auto-discovery.experimental.securecodebox.io/ignore": "true",
96-
},
97-
Labels: map[string]string{
98-
"sidecar.istio.io/inject": "false",
96+
"sidecar.istio.io/inject": "false",
9997
},
10098
},
10199
Spec: corev1.PodSpec{

operator/controllers/execution/scans/scan_reconciler.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
172172
podAnnotations = make(map[string]string)
173173
}
174174
podAnnotations["experimental.securecodebox.io/job-type"] = "scanner"
175+
// Ensuring that istio doesn't inject a sidecar proxy.
176+
podAnnotations["sidecar.istio.io/inject"] = "true"
175177
job.Spec.Template.Annotations = podAnnotations
176178

177179
job.Spec.Template.Spec.ServiceAccountName = "lurcher"
@@ -187,16 +189,6 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
187189
},
188190
})
189191

190-
// Ensuring that istio doesn't inject a sidecar proxy.
191-
// This currently messes with
192-
if job.Spec.Template.ObjectMeta.Labels != nil {
193-
job.Spec.Template.ObjectMeta.Labels["sidecar.istio.io/inject"] = "true"
194-
} else {
195-
job.Spec.Template.ObjectMeta.Labels = map[string]string{
196-
"sidecar.istio.io/inject": "false",
197-
}
198-
}
199-
200192
// merging volume mounts (for the primary scanner container) from ScanType (if existing) with standard results volume mount
201193
if job.Spec.Template.Spec.Containers[0].VolumeMounts == nil || len(job.Spec.Template.Spec.Containers[0].VolumeMounts) == 0 {
202194
job.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{}

0 commit comments

Comments
 (0)