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

Commit

Permalink
Correct Istio AutoInject Flag to a Annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
J12934 committed Sep 29, 2020
1 parent 493f77e commit 0e33d6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 1 addition & 3 deletions operator/controllers/execution/scans/hook_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,7 @@ func (r *ScanReconciler) createJobForHook(hook *executionv1.ScanCompletionHook,
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"auto-discovery.experimental.securecodebox.io/ignore": "true",
},
Labels: map[string]string{
"sidecar.istio.io/inject": "false",
"sidecar.istio.io/inject": "false",
},
},
Spec: corev1.PodSpec{
Expand Down
4 changes: 1 addition & 3 deletions operator/controllers/execution/scans/parse_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"auto-discovery.experimental.securecodebox.io/ignore": "true",
},
Labels: map[string]string{
"sidecar.istio.io/inject": "false",
"sidecar.istio.io/inject": "false",
},
},
Spec: corev1.PodSpec{
Expand Down
12 changes: 2 additions & 10 deletions operator/controllers/execution/scans/scan_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
podAnnotations = make(map[string]string)
}
podAnnotations["experimental.securecodebox.io/job-type"] = "scanner"
// Ensuring that istio doesn't inject a sidecar proxy.
podAnnotations["sidecar.istio.io/inject"] = "true"
job.Spec.Template.Annotations = podAnnotations

job.Spec.Template.Spec.ServiceAccountName = "lurcher"
Expand All @@ -187,16 +189,6 @@ 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 0e33d6e

Please sign in to comment.