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

Commit ce58e04

Browse files
J12934jorgestiga
andcommitted
#42 Add imagePullSecrets to ParseDefinition and ScanCompletionHooks
Co-authored-by: Jorge Estrigarribia <jorge.estigarribia@iteratec.com>
1 parent 12b9079 commit ce58e04

8 files changed

+65
-6
lines changed

operator/apis/execution/v1/parsedefinition_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -29,8 +30,9 @@ type ParseDefinitionSpec struct {
2930
// Important: Run "make" to regenerate code after modifying this file
3031

3132
// Foo is an example field of ParseDefinition. Edit ParseDefinition_types.go to remove/update
32-
HandlesResultsType string `json:"handlesResultsType,omitempty"`
33-
Image string `json:"image,omitempty"`
33+
HandlesResultsType string `json:"handlesResultsType,omitempty"`
34+
Image string `json:"image,omitempty"`
35+
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
3436
}
3537

3638
// ParseDefinitionStatus defines the observed state of ParseDefinition

operator/apis/execution/v1/scancompletionhook.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ type ScanCompletionHookSpec struct {
4040
// Important: Run "make" to regenerate code after modifying this file
4141

4242
// Image is the container image for the hooks kubernetes job
43-
Image string `json:"image,omitempty"`
44-
Env []corev1.EnvVar `json:"env,omitempty"`
45-
Type HookType `json:"type"`
43+
Image string `json:"image,omitempty"`
44+
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
45+
Env []corev1.EnvVar `json:"env,omitempty"`
46+
Type HookType `json:"type"`
4647
}
4748

4849
// ScanCompletionHookStatus defines the observed state of ScanCompletionHook

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

Lines changed: 11 additions & 1 deletion
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_parsedefinitions.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ spec:
5050
type: string
5151
image:
5252
type: string
53+
imagePullSecrets:
54+
items:
55+
description: LocalObjectReference contains enough information to let
56+
you locate the referenced object inside the same namespace.
57+
properties:
58+
name:
59+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
60+
TODO: Add other useful fields. apiVersion, kind, uid?'
61+
type: string
62+
type: object
63+
type: array
5364
type: object
5465
status:
5566
description: ParseDefinitionStatus defines the observed state of ParseDefinition

operator/config/crd/bases/execution.experimental.securecodebox.io_scancompletionhooks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ spec:
145145
image:
146146
description: Image is the container image for the hooks kubernetes job
147147
type: string
148+
imagePullSecrets:
149+
items:
150+
description: LocalObjectReference contains enough information to let
151+
you locate the referenced object inside the same namespace.
152+
properties:
153+
name:
154+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
155+
TODO: Add other useful fields. apiVersion, kind, uid?'
156+
type: string
157+
type: object
158+
type: array
148159
type:
149160
description: HookType Defines weather the hook should be able to change
150161
the findings or is run in a read only mode.

operator/controllers/execution/scan_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
416416
Spec: corev1.PodSpec{
417417
RestartPolicy: corev1.RestartPolicyNever,
418418
ServiceAccountName: "parser",
419+
ImagePullSecrets: parseDefinition.Spec.ImagePullSecrets,
419420
Containers: []corev1.Container{
420421
{
421422
Name: "parser",
@@ -1022,6 +1023,7 @@ func (r *ScanReconciler) createJobForHook(hook *executionv1.ScanCompletionHook,
10221023
Spec: corev1.PodSpec{
10231024
ServiceAccountName: serviceAccountName,
10241025
RestartPolicy: corev1.RestartPolicyNever,
1026+
ImagePullSecrets: hook.Spec.ImagePullSecrets,
10251027
Containers: []corev1.Container{
10261028
{
10271029
Name: "hook",

operator/crds/execution.experimental.securecodebox.io_parsedefinitions.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ spec:
5050
type: string
5151
image:
5252
type: string
53+
imagePullSecrets:
54+
items:
55+
description: LocalObjectReference contains enough information to let
56+
you locate the referenced object inside the same namespace.
57+
properties:
58+
name:
59+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
60+
TODO: Add other useful fields. apiVersion, kind, uid?'
61+
type: string
62+
type: object
63+
type: array
5364
type: object
5465
status:
5566
description: ParseDefinitionStatus defines the observed state of ParseDefinition

operator/crds/execution.experimental.securecodebox.io_scancompletionhooks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ spec:
145145
image:
146146
description: Image is the container image for the hooks kubernetes job
147147
type: string
148+
imagePullSecrets:
149+
items:
150+
description: LocalObjectReference contains enough information to let
151+
you locate the referenced object inside the same namespace.
152+
properties:
153+
name:
154+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
155+
TODO: Add other useful fields. apiVersion, kind, uid?'
156+
type: string
157+
type: object
158+
type: array
148159
type:
149160
description: HookType Defines weather the hook should be able to change
150161
the findings or is run in a read only mode.

0 commit comments

Comments
 (0)