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

Commit

Permalink
Merge pull request #117 from secureCodeBox/disable-istio-injection
Browse files Browse the repository at this point in the history
Disable Istio Injection for Scan/Parser/Hook Pods
  • Loading branch information
J12934 authored Sep 29, 2020
2 parents d59daec + d379001 commit 3dfcc92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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

0 comments on commit 3dfcc92

Please sign in to comment.