Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for sensor update policies #556

Closed
wants to merge 3 commits into from
Closed
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: 8 additions & 0 deletions api/falcon/v1alpha1/falconadmission_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ type FalconAdmissionSpec struct {
// Falcon Admission Controller Version. The latest version will be selected when version specifier is missing. Example: 6.31, 6.31.0, 6.31.0-1409, etc.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Version",order=8
Version *string `json:"version,omitempty"`

// UpdatePolicy is the name of an existing sensor update policy. It is ignored when Image and/or Version are set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Update Policy",order=9
UpdatePolicy *string `json:"updatePolicy,omitempty"`

// AutoUpdate determines whether to install new versions of the sensor as they become available. Defaults to no and is ignored if FalconAPI is not set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Automatic Updates",order=10
AutoUpdate *bool `json:"autoUpdate,omitempty"`
}

type FalconAdmissionRQSpec struct {
Expand Down
8 changes: 8 additions & 0 deletions api/falcon/v1alpha1/falconcontainer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ type FalconContainerSpec struct {
// Falcon Container Version. The latest version will be selected when version specifier is missing; ignored when Image is set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Container Image Version",order=6
Version *string `json:"version,omitempty"`

// UpdatePolicy is the name of an existing sensor update policy. It is ignored when Image and/or Version are set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Container Update Policy",order=7
UpdatePolicy *string `json:"updatePolicy,omitempty"`

// AutoUpdate determines whether to install new versions of the sensor as they become available. Defaults to no and is ignored if FalconAPI is not set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Container Automatic Updates",order=8
AutoUpdate *bool `json:"autoUpdate,omitempty"`
}

type FalconContainerInjectorSpec struct {
Expand Down
8 changes: 8 additions & 0 deletions api/falcon/v1alpha1/falconnodesensor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ type FalconNodeSensorConfig struct {

// Version of the sensor to be installed. The latest version will be selected when this version specifier is missing.
Version *string `json:"version,omitempty"`

// UpdatePolicy is the name of an existing sensor update policy. It is ignored when Image and/or Version are set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Node Sensor Update Policy",order=13
UpdatePolicy *string `json:"updatePolicy,omitempty"`

// AutoUpdate determines whether to install new versions of the sensor as they become available. Defaults to no and is ignored if FalconAPI is not set.
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Node Sensor Automatic Updates",order=14
AutoUpdate *bool `json:"autoUpdate,omitempty"`
}

type PriorityClassConfig struct {
Expand Down
30 changes: 30 additions & 0 deletions api/falcon/v1alpha1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,16 @@ func (in *FalconAdmissionSpec) DeepCopyInto(out *FalconAdmissionSpec) {
*out = new(string)
**out = **in
}
if in.UpdatePolicy != nil {
in, out := &in.UpdatePolicy, &out.UpdatePolicy
*out = new(string)
**out = **in
}
if in.AutoUpdate != nil {
in, out := &in.AutoUpdate, &out.AutoUpdate
*out = new(bool)
**out = **in
}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FalconAdmissionSpec.
Expand Down Expand Up @@ -739,6 +749,16 @@ func (in *FalconContainerSpec) DeepCopyInto(out *FalconContainerSpec) {
*out = new(string)
**out = **in
}
if in.UpdatePolicy != nil {
in, out := &in.UpdatePolicy, &out.UpdatePolicy
*out = new(string)
**out = **in
}
if in.AutoUpdate != nil {
in, out := &in.AutoUpdate, &out.AutoUpdate
*out = new(bool)
**out = **in
}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FalconContainerSpec.
Expand Down Expand Up @@ -1032,6 +1052,16 @@ func (in *FalconNodeSensorConfig) DeepCopyInto(out *FalconNodeSensorConfig) {
*out = new(string)
**out = **in
}
if in.UpdatePolicy != nil {
in, out := &in.UpdatePolicy, &out.UpdatePolicy
*out = new(string)
**out = **in
}
if in.AutoUpdate != nil {
in, out := &in.AutoUpdate, &out.AutoUpdate
*out = new(bool)
**out = **in
}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FalconNodeSensorConfig.
Expand Down
16 changes: 12 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (

falconv1alpha1 "github.com/crowdstrike/falcon-operator/api/falcon/v1alpha1"
admissioncontroller "github.com/crowdstrike/falcon-operator/internal/controller/admission"
"github.com/crowdstrike/falcon-operator/internal/controller/common/sensorversion"
containercontroller "github.com/crowdstrike/falcon-operator/internal/controller/falcon_container"
imageanalyzercontroller "github.com/crowdstrike/falcon-operator/internal/controller/falcon_image_analyzer"
nodecontroller "github.com/crowdstrike/falcon-operator/internal/controller/falcon_node"
Expand All @@ -48,6 +49,8 @@ import (
// +kubebuilder:scaffold:imports
)

const sensorVersionTrackingPollingInterval = time.Hour * 24

var (
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
Expand Down Expand Up @@ -182,26 +185,29 @@ func main() {
setupLog.Info("cert-manager installation not found")
}

ctx := ctrl.SetupSignalHandler()
tracker := sensorversion.NewTracker(ctx, sensorVersionTrackingPollingInterval)

if err = (&containercontroller.FalconContainerReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
RestConfig: mgr.GetConfig(),
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, tracker); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "FalconContainer")
os.Exit(1)
}
if err = (&nodecontroller.FalconNodeSensorReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, tracker); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "FalconNodeSensor")
os.Exit(1)
}
if err = (&admissioncontroller.FalconAdmissionReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
OpenShift: openShift,
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, tracker); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "FalconAdmission")
os.Exit(1)
}
Expand Down Expand Up @@ -240,8 +246,10 @@ func main() {
}()
}

go tracker.KeepTrackingChanges()

setupLog.Info("starting manager", "version", version.Get(), "go version", version.GoVersion)
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/falcon.crowdstrike.com_falconadmissions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ spec:
type: object
type: object
type: object
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is ignored
if FalconAPI is not set.
type: boolean
falcon:
description: CrowdStrike Falcon sensor configuration
properties:
Expand Down Expand Up @@ -451,6 +456,10 @@ spec:
can be created in the namespace.
type: string
type: object
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
version:
description: 'Falcon Admission Controller Version. The latest version
will be selected when version specifier is missing. Example: 6.31,
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/falcon.crowdstrike.com_falconcontainers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ spec:
spec:
description: FalconContainerSpec defines the desired state of FalconContainer
properties:
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is ignored
if FalconAPI is not set.
type: boolean
falcon:
description: CrowdStrike Falcon Sensor configuration settings.
properties:
Expand Down Expand Up @@ -1924,6 +1929,10 @@ spec:
required:
- type
type: object
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
version:
description: Falcon Container Version. The latest version will be
selected when version specifier is missing; ignored when Image is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ spec:
node:
description: Various configuration for DaemonSet Deployment
properties:
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is
ignored if FalconAPI is not set.
type: boolean
backend:
default: kernel
description: Sets the backend to be used by the DaemonSet Sensor.
Expand Down Expand Up @@ -516,6 +521,10 @@ spec:
type: string
type: object
type: array
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
updateStrategy:
description: Type of DaemonSet update. Can be "RollingUpdate"
or "OnDelete". Default is RollingUpdate.
Expand Down
27 changes: 27 additions & 0 deletions deploy/falcon-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ spec:
type: object
type: object
type: object
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is ignored
if FalconAPI is not set.
type: boolean
falcon:
description: CrowdStrike Falcon sensor configuration
properties:
Expand Down Expand Up @@ -465,6 +470,10 @@ spec:
can be created in the namespace.
type: string
type: object
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
version:
description: 'Falcon Admission Controller Version. The latest version
will be selected when version specifier is missing. Example: 6.31,
Expand Down Expand Up @@ -599,6 +608,11 @@ spec:
spec:
description: FalconContainerSpec defines the desired state of FalconContainer
properties:
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is ignored
if FalconAPI is not set.
type: boolean
falcon:
description: CrowdStrike Falcon Sensor configuration settings.
properties:
Expand Down Expand Up @@ -2480,6 +2494,10 @@ spec:
required:
- type
type: object
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
version:
description: Falcon Container Version. The latest version will be
selected when version specifier is missing; ignored when Image is
Expand Down Expand Up @@ -3126,6 +3144,11 @@ spec:
node:
description: Various configuration for DaemonSet Deployment
properties:
autoUpdate:
description: AutoUpdate determines whether to install new versions
of the sensor as they become available. Defaults to no and is
ignored if FalconAPI is not set.
type: boolean
backend:
default: kernel
description: Sets the backend to be used by the DaemonSet Sensor.
Expand Down Expand Up @@ -3504,6 +3527,10 @@ spec:
type: string
type: object
type: array
updatePolicy:
description: UpdatePolicy is the name of an existing sensor update
policy. It is ignored when Image and/or Version are set.
type: string
updateStrategy:
description: Type of DaemonSet update. Can be "RollingUpdate"
or "OnDelete". Default is RollingUpdate.
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/onsi/gomega v1.27.7
github.com/openshift/api v0.0.0-20220630121623-32f1d77b9f50
github.com/operator-framework/operator-lib v0.11.0
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
Expand Down Expand Up @@ -123,6 +124,7 @@ require (
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/proglottis/gpgme v0.1.3 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/sylabs/sif/v2 v2.15.1 h1:75BcunPOY11fVhe02/WHuNLTfDd3OHH0ex0MuuNMYX0=
github.com/sylabs/sif/v2 v2.15.1/go.mod h1:YiwCUdZOhiohnPbyxuxvCZa+03HwAaiC+vfAKZPR8nQ=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI=
Expand Down
Loading
Loading