Skip to content

Commit aba36f9

Browse files
committed
feat(falcon-imageanalyzer): Add image exclusions
1 parent fb4b82d commit aba36f9

File tree

11 files changed

+44
-4
lines changed

11 files changed

+44
-4
lines changed

api/falcon/v1alpha1/falconimageanalyzer_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ type Exclusions struct {
180180
// Configure a list of namespaces for Image Analyzer to ignore.
181181
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ignore Namespace List",order=2
182182
Namespaces []string `json:"namespaces,omitempty"`
183+
184+
// Configure a list of image names for Image Analyzer to ignore.
185+
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ignore Images List",order=3
186+
ImageNames []string `json:"imageNames,omitempty"`
183187
}
184188

185189
type RegistryConfig struct {

api/falcon/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ func (in *Exclusions) DeepCopyInto(out *Exclusions) {
258258
*out = make([]string, len(*in))
259259
copy(*out, *in)
260260
}
261+
if in.ImageNames != nil {
262+
in, out := &in.ImageNames, &out.ImageNames
263+
*out = make([]string, len(*in))
264+
copy(*out, *in)
265+
}
261266
}
262267

263268
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exclusions.

config/crd/bases/falcon.crowdstrike.com_falcondeployments.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,6 +3364,12 @@ spec:
33643364
exclusions:
33653365
description: Exclusions for the Falcon Image Analyzer.
33663366
properties:
3367+
imageNames:
3368+
description: Configure a list of image names for Image
3369+
Analyzer to ignore.
3370+
items:
3371+
type: string
3372+
type: array
33673373
namespaces:
33683374
description: Configure a list of namespaces for Image
33693375
Analyzer to ignore.

config/crd/bases/falcon.crowdstrike.com_falconimageanalyzers.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ spec:
125125
exclusions:
126126
description: Exclusions for the Falcon Image Analyzer.
127127
properties:
128+
imageNames:
129+
description: Configure a list of image names for Image Analyzer
130+
to ignore.
131+
items:
132+
type: string
133+
type: array
128134
namespaces:
129135
description: Configure a list of namespaces for Image Analyzer
130136
to ignore.

deploy/falcon-operator.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6766,6 +6766,12 @@ spec:
67666766
exclusions:
67676767
description: Exclusions for the Falcon Image Analyzer.
67686768
properties:
6769+
imageNames:
6770+
description: Configure a list of image names for Image
6771+
Analyzer to ignore.
6772+
items:
6773+
type: string
6774+
type: array
67696775
namespaces:
67706776
description: Configure a list of namespaces for Image
67716777
Analyzer to ignore.
@@ -8143,6 +8149,12 @@ spec:
81438149
exclusions:
81448150
description: Exclusions for the Falcon Image Analyzer.
81458151
properties:
8152+
imageNames:
8153+
description: Configure a list of image names for Image Analyzer
8154+
to ignore.
8155+
items:
8156+
type: string
8157+
type: array
81468158
namespaces:
81478159
description: Configure a list of namespaces for Image Analyzer
81488160
to ignore.

docs/deployment/openshift/resources/imageanalyzer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ spec:
5959
| imageAnalyzerConfig.priorityClass.name | (optional) Set to avoid pod evictions due to resource limits. |
6060
| imageAnalyzerConfig.exclusions.registries | (optional) Set the value as a list of registries to be excluded. All images in that registry(s) will be excluded |
6161
| imageAnalyzerConfig.exclusions.namespaces | (optional) Set the value as a list of namespaces to be excluded. All pods in that namespace(s) will be excluded |
62+
| imageAnalyzerConfig.exclusions.imageNames | (optional) Set the value as a list of fully qualified image names to be excluded. |
6263
| imageAnalyzerConfig.imagePullPolicy | (optional) Configure the image pull policy of the Falcon Image Analyzer |
6364
| imageAnalyzerConfig.imagePullSecrets | (optional) Configure the image pull secrets of the Falcon Image Analyzer |
6465
| imageAnalyzerConfig.registryConfig.credentials | (optional) Use this to provide registry secrets in the form of a list of maps. e.g.<pre>- namespace: ns1<br>&nbsp;&nbsp;secretName: mysecretname</pre>To scan OpenShift control plane components, specify the cluster's pull secret: <pre>- namespace: openshift-config<br>&nbsp;&nbsp;secretName: pull-secret</pre> |

docs/resources/imageanalyzer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ spec:
5959
| imageAnalyzerConfig.priorityClass.name | (optional) Set to avoid pod evictions due to resource limits. |
6060
| imageAnalyzerConfig.exclusions.registries | (optional) Set the value as a list of registries to be excluded. All images in that registry(s) will be excluded |
6161
| imageAnalyzerConfig.exclusions.namespaces | (optional) Set the value as a list of namespaces to be excluded. All pods in that namespace(s) will be excluded |
62+
| imageAnalyzerConfig.exclusions.imageNames | (optional) Set the value as a list of fully qualified image names to be excluded. |
6263
| imageAnalyzerConfig.imagePullPolicy | (optional) Configure the image pull policy of the Falcon Image Analyzer |
6364
| imageAnalyzerConfig.imagePullSecrets | (optional) Configure the image pull secrets of the Falcon Image Analyzer |
6465
| imageAnalyzerConfig.registryConfig.credentials | (optional) Use this to provide registry secrets in the form of a list of maps. e.g.<pre>- namespace: ns1<br>&nbsp;&nbsp;secretName: mysecretname</pre>To scan OpenShift control plane components, specify the cluster's pull secret: <pre>- namespace: openshift-config<br>&nbsp;&nbsp;secretName: pull-secret</pre> |

docs/src/resources/imageanalyzer.md.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ spec:
5959
| imageAnalyzerConfig.priorityClass.name | (optional) Set to avoid pod evictions due to resource limits. |
6060
| imageAnalyzerConfig.exclusions.registries | (optional) Set the value as a list of registries to be excluded. All images in that registry(s) will be excluded |
6161
| imageAnalyzerConfig.exclusions.namespaces | (optional) Set the value as a list of namespaces to be excluded. All pods in that namespace(s) will be excluded |
62+
| imageAnalyzerConfig.exclusions.imageNames | (optional) Set the value as a list of fully qualified image names to be excluded. |
6263
| imageAnalyzerConfig.imagePullPolicy | (optional) Configure the image pull policy of the Falcon Image Analyzer |
6364
| imageAnalyzerConfig.imagePullSecrets | (optional) Configure the image pull secrets of the Falcon Image Analyzer |
6465
| imageAnalyzerConfig.registryConfig.credentials | (optional) Use this to provide registry secrets in the form of a list of maps. e.g.<pre>- namespace: ns1<br>&nbsp;&nbsp;secretName: mysecretname</pre>To scan OpenShift control plane components, specify the cluster's pull secret: <pre>- namespace: openshift-config<br>&nbsp;&nbsp;secretName: pull-secret</pre> |

internal/controller/falcon_image_analyzer/configmap.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ func (r *FalconImageAnalyzerReconciler) newConfigMap(ctx context.Context, name s
106106
data["AGENT_REGISTRY_EXCLUSIONS"] = strings.Join(falconImageAnalyzer.Spec.ImageAnalyzerConfig.Exclusions.Registries, ",")
107107
}
108108

109+
if len(falconImageAnalyzer.Spec.ImageAnalyzerConfig.Exclusions.ImageNames) > 0 {
110+
data["AGENT_IMAGE_EXCLUSIONS"] = strings.Join(falconImageAnalyzer.Spec.ImageAnalyzerConfig.Exclusions.ImageNames, ",")
111+
}
112+
109113
data["AGENT_DEBUG"] = strconv.FormatBool(falconImageAnalyzer.Spec.ImageAnalyzerConfig.EnableDebug)
110114

111115
// Registry auto-discovery configuration

internal/controller/falcon_image_analyzer/image_push.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (r *FalconImageAnalyzerReconciler) PushImage(ctx context.Context, log logr.
4949
image := image.NewImageRefresher(ctx, log, falconApiConfig, pushAuth, falconImageAnalyzer.Spec.Registry.TLS.InsecureSkipVerify)
5050
version := falconImageAnalyzer.Spec.Version
5151

52-
tag, err := image.Refresh(registryUri, falcon.ImageSensor, version)
52+
tag, err := image.Refresh(registryUri, falcon.RegionedImageSensor, version)
5353
if err != nil {
5454
return fmt.Errorf("Cannot push Falcon Image Analyzer Image: %v", err)
5555
}
@@ -139,7 +139,7 @@ func (r *FalconImageAnalyzerReconciler) registryUri(ctx context.Context, falconI
139139
return "", err
140140
}
141141

142-
return falcon.FalconContainerSensorImageURI(cloud, falcon.ImageSensor), nil
142+
return falcon.FalconContainerSensorImageURI(cloud, falcon.RegionedImageSensor), nil
143143
default:
144144
return "", fmt.Errorf("Unrecognized registry type: %s", falconImageAnalyzer.Spec.Registry.Type)
145145
}
@@ -209,7 +209,7 @@ func (r *FalconImageAnalyzerReconciler) setImageTag(ctx context.Context, falconI
209209
return "", err
210210
}
211211

212-
tag, err := registry.LastContainerTag(ctx, falcon.ImageSensor, falconImageAnalyzer.Spec.Version)
212+
tag, err := registry.LastContainerTag(ctx, falcon.RegionedImageSensor, falconImageAnalyzer.Spec.Version)
213213
if err == nil {
214214
falconImageAnalyzer.Status.Sensor = common.ImageVersion(tag)
215215
}

0 commit comments

Comments
 (0)