Skip to content

Commit

Permalink
fix(adapter): Fix panic on scanning external addresses
Browse files Browse the repository at this point in the history
Signed-off-by: Anurag Rajawat <[email protected]>
  • Loading branch information
Anurag Rajawat committed Aug 20, 2024
1 parent 750aba2 commit fa07768
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/adapter/nimbus-k8tls/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Authors of Nimbus

FROM golang:1.22 as builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
9 changes: 5 additions & 4 deletions pkg/adapter/nimbus-k8tls/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func cronJobForAssessTls(ctx context.Context, schedule string, externalAddresses
if len(externalAddresses) > 0 {
cm := buildConfigMap(externalAddresses)

cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].VolumeMounts = append(cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].VolumeMounts = append(cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].VolumeMounts, corev1.VolumeMount{
Name: cm.Name,
ReadOnly: true,
MountPath: "/var/k8tls/",
Expand All @@ -200,10 +200,11 @@ func cronJobForAssessTls(ctx context.Context, schedule string, externalAddresses
},
})

cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Command[0] = "./tlsscan"
cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Command = append(cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].Command,
cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].Command[0] = "./tlsscan"
cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].Command = append(cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].Command,
"--infile",
cj.Spec.JobTemplate.Spec.Template.Spec.Containers[0].VolumeMounts[2].MountPath+"addresses",
cj.Spec.JobTemplate.Spec.Template.Spec.InitContainers[0].VolumeMounts[2].MountPath+"addresses",
"--compact-json",
)
return cj, cm
}
Expand Down

0 comments on commit fa07768

Please sign in to comment.