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

Disable Istio Injection for Scan/Parser/Hook Pods #117

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions operator/controllers/execution/scans/hook_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ func (r *ScanReconciler) createJobForHook(hook *executionv1.ScanCompletionHook,
Annotations: map[string]string{
"auto-discovery.experimental.securecodebox.io/ignore": "true",
},
Labels: map[string]string{
"sidecar.istio.io/inject": "false",
},
},
Spec: corev1.PodSpec{
ServiceAccountName: serviceAccountName,
Expand Down
3 changes: 3 additions & 0 deletions operator/controllers/execution/scans/parse_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
Annotations: map[string]string{
"auto-discovery.experimental.securecodebox.io/ignore": "true",
},
Labels: map[string]string{
"sidecar.istio.io/inject": "false",
},
},
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyNever,
Expand Down
10 changes: 10 additions & 0 deletions operator/controllers/execution/scans/scan_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
},
})

// Ensuring that istio doesn't inject a sidecar proxy.
// This currently messes with
if job.Spec.Template.ObjectMeta.Labels != nil {
job.Spec.Template.ObjectMeta.Labels["sidecar.istio.io/inject"] = "true"
} else {
job.Spec.Template.ObjectMeta.Labels = map[string]string{
"sidecar.istio.io/inject": "false",
}
}

// merging volume mounts (for the primary scanner container) from ScanType (if existing) with standard results volume mount
if job.Spec.Template.Spec.Containers[0].VolumeMounts == nil || len(job.Spec.Template.Spec.Containers[0].VolumeMounts) == 0 {
job.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{}
Expand Down