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

Commit 1b6b08b

Browse files
J12934jorgestiganigthknightrfelber
committed
Renamed PersistenceProvider to ReadOnly ScanCompletion Hook
Co-authored-by: Jorge Estigarribia <jorgestiga@hotmail.com> Co-authored-by: Yannik Fuhrmeister <12710254+fuhrmeistery@users.noreply.github.com> Co-authored-by: Robert Seedorff <Robert.Seedorff@iteratec.de>
1 parent 80b4609 commit 1b6b08b

File tree

8 files changed

+157
-122
lines changed

8 files changed

+157
-122
lines changed

operator/apis/execution/v1/persistenceprovider_types.go renamed to operator/apis/execution/v1/scancompletionhook.go

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,55 @@ import (
2424
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2525
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2626

27-
// PersistenceProviderSpec defines the desired state of PersistenceProvider
28-
type PersistenceProviderSpec struct {
27+
// HookType Defines weather the hook should be able to change the findings or is run in a read only mode.
28+
type HookType string
29+
30+
const (
31+
// ReadOnly ReadOnly Hooks are executed in parallel
32+
ReadOnly HookType = "ReadOnly"
33+
// ReadAndWrite ReadAndWrite Hooks are executed serially
34+
ReadAndWrite HookType = "ReadAndWrite"
35+
)
36+
37+
// ScanCompletionHookSpec defines the desired state of ScanCompletionHook
38+
type ScanCompletionHookSpec struct {
2939
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3040
// Important: Run "make" to regenerate code after modifying this file
3141

32-
// Foo is an example field of PersistenceProvider. Edit PersistenceProvider_types.go to remove/update
42+
// Image is the container image for the hooks kubernetes job
3343
Image string `json:"image,omitempty"`
3444
Env []corev1.EnvVar `json:"env,omitempty"`
45+
Type HookType `json:"type"`
3546
}
3647

37-
// PersistenceProviderStatus defines the observed state of PersistenceProvider
38-
type PersistenceProviderStatus struct {
48+
// ScanCompletionHookStatus defines the observed state of ScanCompletionHook
49+
type ScanCompletionHookStatus struct {
3950
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
4051
// Important: Run "make" to regenerate code after modifying this file
4152
}
4253

4354
// +kubebuilder:object:root=true
44-
// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.spec.image`,description="PersistenceProvider Image"
55+
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,description="ScanCompletionHook Type"
56+
// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.spec.image`,description="ScanCompletionHook Image"
4557

46-
// PersistenceProvider is the Schema for the persistenceproviders API
47-
type PersistenceProvider struct {
58+
// ScanCompletionHook is the Schema for the ScanCompletionHooks API
59+
type ScanCompletionHook struct {
4860
metav1.TypeMeta `json:",inline"`
4961
metav1.ObjectMeta `json:"metadata,omitempty"`
5062

51-
Spec PersistenceProviderSpec `json:"spec,omitempty"`
52-
Status PersistenceProviderStatus `json:"status,omitempty"`
63+
Spec ScanCompletionHookSpec `json:"spec,omitempty"`
64+
Status ScanCompletionHookStatus `json:"status,omitempty"`
5365
}
5466

5567
// +kubebuilder:object:root=true
5668

57-
// PersistenceProviderList contains a list of PersistenceProvider
58-
type PersistenceProviderList struct {
69+
// ScanCompletionHookList contains a list of ScanCompletionHook
70+
type ScanCompletionHookList struct {
5971
metav1.TypeMeta `json:",inline"`
6072
metav1.ListMeta `json:"metadata,omitempty"`
61-
Items []PersistenceProvider `json:"items"`
73+
Items []ScanCompletionHook `json:"items"`
6274
}
6375

6476
func init() {
65-
SchemeBuilder.Register(&PersistenceProvider{}, &PersistenceProviderList{})
77+
SchemeBuilder.Register(&ScanCompletionHook{}, &ScanCompletionHookList{})
6678
}

operator/apis/execution/v1/zz_generated.deepcopy.go

Lines changed: 46 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/config/crd/bases/execution.experimental.securecodebox.io_persistenceproviders.yaml renamed to operator/config/crd/bases/execution.experimental.securecodebox.io_scancompletionhooks.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,28 @@ metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.2.4
88
creationTimestamp: null
9-
name: persistenceproviders.execution.experimental.securecodebox.io
9+
name: scancompletionhooks.execution.experimental.securecodebox.io
1010
spec:
1111
additionalPrinterColumns:
12+
- JSONPath: .spec.type
13+
description: ScanCompletionHook Type
14+
name: Type
15+
type: string
1216
- JSONPath: .spec.image
13-
description: PersistenceProvider Image
17+
description: ScanCompletionHook Image
1418
name: Image
1519
type: string
1620
group: execution.experimental.securecodebox.io
1721
names:
18-
kind: PersistenceProvider
19-
listKind: PersistenceProviderList
20-
plural: persistenceproviders
21-
singular: persistenceprovider
22+
kind: ScanCompletionHook
23+
listKind: ScanCompletionHookList
24+
plural: scancompletionhooks
25+
singular: scancompletionhook
2226
scope: Namespaced
2327
subresources: {}
2428
validation:
2529
openAPIV3Schema:
26-
description: PersistenceProvider is the Schema for the persistenceproviders
27-
API
30+
description: ScanCompletionHook is the Schema for the ScanCompletionHooks API
2831
properties:
2932
apiVersion:
3033
description: 'APIVersion defines the versioned schema of this representation
@@ -39,7 +42,7 @@ spec:
3942
metadata:
4043
type: object
4144
spec:
42-
description: PersistenceProviderSpec defines the desired state of PersistenceProvider
45+
description: ScanCompletionHookSpec defines the desired state of ScanCompletionHook
4346
properties:
4447
env:
4548
items:
@@ -140,12 +143,17 @@ spec:
140143
type: object
141144
type: array
142145
image:
143-
description: Foo is an example field of PersistenceProvider. Edit PersistenceProvider_types.go
144-
to remove/update
146+
description: Image is the container image for the hooks kubernetes job
147+
type: string
148+
type:
149+
description: HookType Defines weather the hook should be able to change
150+
the findings or is run in a read only mode.
145151
type: string
152+
required:
153+
- type
146154
type: object
147155
status:
148-
description: PersistenceProviderStatus defines the observed state of PersistenceProvider
156+
description: ScanCompletionHookStatus defines the observed state of ScanCompletionHook
149157
type: object
150158
type: object
151159
version: v1

operator/config/crd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
resources:
55
- bases/execution.experimental.securecodebox.io_scans.yaml
66
- bases/execution.experimental.securecodebox.io_scantypes.yaml
7-
- bases/execution.experimental.securecodebox.io_persistenceproviders.yaml
7+
- bases/execution.experimental.securecodebox.io_scancompletionhooks.yaml
88
- bases/execution.experimental.securecodebox.io_parsedefinitions.yaml
99
- bases/execution.experimental.securecodebox.io_scheduledscans.yaml
1010
- bases/targets.experimental.securecodebox.io_hosts.yaml

operator/config/rbac/role.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ rules:
4444
- apiGroups:
4545
- execution.experimental.securecodebox.io
4646
resources:
47-
- persistenceproviders
47+
- scancompletionhooks
4848
verbs:
4949
- get
5050
- list

operator/config/samples/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM alpine
2+
CMD [sleep, 5s]
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
apiVersion: execution.experimental.securecodebox.io/v1
2-
kind: PersistenceProvider
2+
kind: ScanCompletionHook
33
metadata:
4-
name: "persistence-elastic"
5-
labels:
6-
type: Structured
4+
name: "sleep"
75
spec:
8-
image: "scbexperimental/persistence-elastic:latest"
9-
env:
10-
- name: ELASTICSEARCH_ADDRESS
11-
value: "http://elasticsearch-master:9200"
6+
image: "sleep"
7+
type: "ReadOnly"
8+
env: []

0 commit comments

Comments
 (0)