Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:

# ---- Build Stage ----

# ---- Build Stage | Operator & Lurcher ----
# ---- Build Stage | Operator & Lurker ----

operator:
name: "Build | Operator"
Expand All @@ -130,7 +130,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
component: ["operator", "lurcher"]
component: ["operator", "lurker"]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -625,8 +625,8 @@ jobs:
helm -n securecodebox-system install securecodebox-operator ./operator/ --wait \
--set="image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/operator" \
--set="image.tag=sha-$(git rev-parse --short HEAD)" \
--set="lurcher.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/lurcher" \
--set="lurcher.image.tag=sha-$(git rev-parse --short HEAD)" \
--set="lurker.image.repository=docker.io/${{ env.DOCKER_NAMESPACE }}/lurker" \
--set="lurker.image.tag=sha-$(git rev-parse --short HEAD)" \

# ---- Operator Health Check ----

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/scb-architecture.drawio
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<mxCell id="WwHgvZpowAIh_IYd4Kne-47" value="" style="shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image=data:image/svg+xml,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjU2cHgiIGhlaWdodD0iMjU2cHgiIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiB2ZXJzaW9uPSIxLjEi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LjczNTI5NCw5Ni4yOTAxOTYxIEwxNTUuNTEzNzI1LDk2LjI5MDE5NjEgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz4mI3hhOyAgICA8L2c+JiN4YTs8L3N2Zz4=;align=left;" parent="SLsqdyoGx3VEHhg5HpJQ-5" vertex="1">
<mxGeometry x="12.5" y="18" width="49" height="49" as="geometry"/>
</mxCell>
<mxCell id="WwHgvZpowAIh_IYd4Kne-48" value="&lt;font&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;Lurcher&lt;br&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18px&quot;&gt;&lt;b&gt;Extract Results&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="SLsqdyoGx3VEHhg5HpJQ-5" vertex="1">
<mxCell id="WwHgvZpowAIh_IYd4Kne-48" value="&lt;font&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;Lurker&lt;br&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 18px&quot;&gt;&lt;b&gt;Extract Results&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="SLsqdyoGx3VEHhg5HpJQ-5" vertex="1">
<mxGeometry x="67" y="17" width="140" height="50" as="geometry"/>
</mxCell>
<mxCell id="SLsqdyoGx3VEHhg5HpJQ-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;endFill=1;strokeColor=#666666;strokeWidth=4;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="WwHgvZpowAIh_IYd4Kne-27" target="WwHgvZpowAIh_IYd4Kne-32" edge="1">
Expand Down Expand Up @@ -268,4 +268,4 @@
</root>
</mxGraphModel>
</diagram>
</mxfile>
</mxfile>
2 changes: 1 addition & 1 deletion docs/resources/scb-architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/uml/compononents_overview.uxf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Operator</panel_attributes>
<h>60</h>
</coordinates>
<panel_attributes>&lt;&lt;Sidecar&gt;&gt;
Lurcher</panel_attributes>
Lurker</panel_attributes>
<additional_attributes/>
</element>
<element>
Expand Down
10 changes: 5 additions & 5 deletions docs/uml/sequence_overview.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ actor kubectl
box "secureCodeBox"
participant Operator <<Controller>>
participant Scanner <<Container>>
participant Lurcher <<Sidecar>>
participant Lurker <<Sidecar>>
participant Minio <<Deployment>>
participant Parser <<Job>>
collections ReadOnlyHooks <<Job>>
Expand All @@ -30,14 +30,14 @@ kubectl -\ Operator : start scan
activate Operator
Operator -> Scanner : run job
activate Scanner
activate Lurcher
activate Lurker
Scanner -> Target : scan
Lurcher -\ Scanner : read data
Lurcher -\ Minio : store raw results
Lurker -\ Scanner : read data
Lurker -\ Minio : store raw results
Scanner <-- Target
Operator <-- Scanner
deactivate Scanner
deactivate Lurcher
deactivate Lurker

Operator -> Parser : run job
activate Parser
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions lurcher/Dockerfile → lurker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ RUN go mod download
COPY main.go main.go

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o lurcher main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o lurker main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/lurcher .
COPY --from=builder /workspace/lurker .

ENTRYPOINT ["/lurcher"]
ENTRYPOINT ["/lurker"]
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ You can find resources to help you get started on our [documentation website](ht
- tagged releases, e.g. `2.9.0`, `2.8.0`, `2.7.0`

## How to use this image
This `lurcher` image is intended to work in combination with the OWASP secureCodeBox. For more informations details please take a look at the documentation page: https://docs.securecodebox.io/docs/getting-started/installation.
This `lurker` image is intended to work in combination with the OWASP secureCodeBox. For more informations details please take a look at the documentation page: https://docs.securecodebox.io/docs/getting-started/installation.

```bash
docker pull securecodebox/lurcher
docker pull securecodebox/lurker
```

## What is secureCodeBox Operator?
Expand Down
4 changes: 3 additions & 1 deletion lurcher/go.mod → lurker/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
//
// SPDX-License-Identifier: Apache-2.0

module github.com/secureCodeBox/secureCodeBox/lurcher
module github.com/secureCodeBox/secureCodeBox/lurker

go 1.15

require (
github.com/pkg/errors v0.9.1
k8s.io/api v0.0.0-20191114100352-16d7abae0d2a
k8s.io/apimachinery v0.0.0-20191028221656-72ed19daf4bb
k8s.io/client-go v0.0.0-20191114101535-6c5935290e33
)
9 changes: 5 additions & 4 deletions lurcher/go.sum → lurker/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsldE=
github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -66,8 +64,10 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand All @@ -92,6 +92,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand All @@ -114,8 +115,6 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc h1:gkKoSkUmnU6bpS/VhkuO27bzQeSA51uaEfbOW5dNb68=
golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -150,12 +149,14 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.0 h1:3zYtXIO92bvsdS3ggAdA8Gb4Azj0YU+TVY1uGYNFA8o=
Expand Down
File renamed without changes.
48 changes: 27 additions & 21 deletions lurcher/main.go → lurker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"flag"
"fmt"
"io/ioutil"
corev1 "k8s.io/api/core/v1"
"log"
"net/http"
"net/http/httputil"
Expand Down Expand Up @@ -46,7 +47,7 @@ func main() {
log.Fatal("Flag 'uploadURL' is no proper URL")
}

log.Println("Starting lurcher")
log.Println("Starting lurker")
log.Printf("Waiting for main container '%s' to complete", mainContainer)
log.Printf("After scan is completed file '%s' will be uploaded to '%s'", filePath, url.Hostname())

Expand Down Expand Up @@ -99,7 +100,7 @@ func uploadFile(path, url string) error {
log.Println("Failed Request:")
log.Println(string(bytes))

return fmt.Errorf("Lurcher failed to upload scan result file. File upload returned non 2xx status code (%d)", res.StatusCode)
return fmt.Errorf("Lurker failed to upload scan result file. File upload returned non 2xx status code (%d)", res.StatusCode)
}

func waitForMainContainerToEnd(container, pod, namespace string) {
Expand All @@ -114,25 +115,30 @@ func waitForMainContainerToEnd(container, pod, namespace string) {

log.Printf("Waiting for maincontainer to exit.")

for {
pod, err := clientset.CoreV1().Pods(namespace).Get(pod, metav1.GetOptions{})
if kerrors.IsNotFound(err) {
log.Printf("Pod %s not found in namespace %s", pod, namespace)
} else if statusError, isStatus := err.(*kerrors.StatusError); isStatus {
log.Printf("Error getting pod %v", statusError.ErrStatus.Message)
} else if err != nil {
panic(err.Error())
} else {
containerStatuses := pod.Status.ContainerStatuses

for _, status := range containerStatuses {
if status.Name == container && status.State.Terminated != nil {
log.Printf("Main Container Exited. Lurcher will end as well.")
return
}
}
}

for keepWaitingForMainContainerToExit(container, pod, namespace, clientset) {
time.Sleep(500 * time.Millisecond)
}
}

func keepWaitingForMainContainerToExit(container string, podName string, namespace string, clientset *kubernetes.Clientset) bool {
pod, err := clientset.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
if kerrors.IsNotFound(err) {
log.Printf("Pod %s not found in namespace %s", pod, namespace)
} else if statusError, isStatus := err.(*kerrors.StatusError); isStatus {
log.Printf("Error getting pod %v", statusError.ErrStatus.Message)
} else if err != nil {
panic(err.Error())
}

return !mainContainerExited(container, pod.Status.ContainerStatuses)
}

func mainContainerExited(container string, containerStatuses []corev1.ContainerStatus) bool {
for _, status := range containerStatuses {
if status.Name == container && status.State.Terminated != nil {
log.Printf("Main Container exited. Lurker will end as well.")
return true
}
}
return false
}
4 changes: 2 additions & 2 deletions operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ annotations:
# artifacthub.io/images: |
# - name: securecodebox-operator
# image: docker.io/securecodebox/operator:v2.7.0-alpha1
# - name: securecodebox-lurcher
# image: docker.io/securecodebox/lurcher:v2.7.0-alpha1
# - name: securecodebox-lurker
# image: docker.io/securecodebox/lurker:v2.7.0-alpha1
artifacthub.io/crds: |
- kind: Scan
version: v1
Expand Down
8 changes: 4 additions & 4 deletions operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ helm install securecodebox-operator secureCodeBox/operator

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| customCACertificate | object | `{"certificate":"public.crt","existingCertificate":null}` | Setup for Custom CA certificates. These are automatically mounted into every secureCodeBox component (lurcher, parser & hooks). Requires that every namespace has a configmap with the CA certificate(s) |
| customCACertificate | object | `{"certificate":"public.crt","existingCertificate":null}` | Setup for Custom CA certificates. These are automatically mounted into every secureCodeBox component (lurker, parser & hooks). Requires that every namespace has a configmap with the CA certificate(s) |
| customCACertificate.certificate | string | `"public.crt"` | key in the configmap holding the certificate(s) |
| customCACertificate.existingCertificate | string | `nil` | name of the configMap holding the ca certificate(s), needs to be the same across all namespaces |
| image.pullPolicy | string | `"Always"` | Image pull policy |
| image.repository | string | `"docker.io/securecodebox/operator"` | The operator image repository |
| image.tag | string | defaults to the charts version | Parser image tag |
| lurcher.image.pullPolicy | string | `"Always"` | Image pull policy |
| lurcher.image.repository | string | `"docker.io/securecodebox/lurcher"` | The operator image repository |
| lurcher.image.tag | string | defaults to the charts version | Parser image tag |
| lurker.image.pullPolicy | string | `"Always"` | Image pull policy |
| lurker.image.repository | string | `"docker.io/securecodebox/lurker"` | The operator image repository |
| lurker.image.tag | string | defaults to the charts version | Parser image tag |
| minio.defaultBucket.enabled | bool | `true` | |
| minio.defaultBucket.name | string | `"securecodebox"` | |
| minio.enabled | bool | `true` | Enable this to use minio as storage backend instead of a cloud bucket provider like AWS S3, Google Cloud Storage, DigitalOcean Spaces etc. |
Expand Down
2 changes: 1 addition & 1 deletion operator/controllers/execution/scans/scan_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const defaultPresignDuration = 12 * time.Hour
// +kubebuilder:rbac:groups=execution.securecodebox.io,resources=parsedefinitions,verbs=get;list;watch
// +kubebuilder:rbac:groups=execution.securecodebox.io,resources=scancompletionhooks,verbs=get;list;watch
// +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete
// Permissions needed to create service accounts for lurcher, parser and scanCompletionHooks
// Permissions needed to create service accounts for lurker, parser and scanCompletionHooks

// Pod permission are required to grant these permission to service accounts
// +kubebuilder:rbac:groups=core,resources=pods,verbs=get
Expand Down
Loading