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

downmerge main to maint-1.0 for release 1.3.0 #590

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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 1.2.0
VERSION ?= 1.3.0

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down
73 changes: 70 additions & 3 deletions api/falcon/v1alpha1/falconadmission_types.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package v1alpha1

import (
"time"

arv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
DeployWatcherDefault = true
SnapshotsEnabledDefault = true
SnapshotsIntervalDefault = 22
WatcherEnabledDefault = true
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

Expand Down Expand Up @@ -99,7 +108,29 @@ type FalconAdmissionConfigSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ignore Namespace List",order=12
DisabledNamespaces FalconAdmissionNamespace `json:"disabledNamespaces,omitempty"`

// Currently ignored and internally set to 1.
// Determines if with falcon-watcher container is included in the Pod
// +kubebuilder:default:=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Deploy Watcher Container",order=13
DeployWatcher *bool `json:"deployWatcher,omitempty"`

// Determines if snapshots of Kubernetes resources are periodically taken for cluster visibility.
// +kubebuilder:default:=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable Resource Snapshots",order=15
SnapshotsEnabled *bool `json:"snapshotsEnabled,omitempty"`

// Time interval between two snapshots of Kubernetes resources in the cluster.
// +kubebuilder:default:="22h"
// +kubebuilder:validation:Type:=string
// +kubebuilder:validation:Format:=duration
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Time Interval Between Two Snapshots",order=16
SnapshotsInterval *metav1.Duration `json:"snapshotsInterval,omitempty"`

// Determines if Kubernetes resources are watched for cluster visibility.
// +kubebuilder:default:=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable Resource Watcher",order=17
WatcherEnabled *bool `json:"watcherEnabled,omitempty"`

// Currently ignored and internally set to 1
// +kubebuilder:default:=2
// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Minimum:=0
Expand All @@ -117,11 +148,15 @@ type FalconAdmissionConfigSpec struct {
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Client Resources",order=9,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
//+kubebuilder:default:={"limits":{"cpu":"750m","memory":"256Mi"},"requests":{"cpu":"500m","memory":"256Mi"}}
// +kubebuilder:default:={"limits":{"cpu":"750m","memory":"384Mi"},"requests":{"cpu":"500m","memory":"384Mi"}}
ResourcesClient *corev1.ResourceRequirements `json:"resourcesClient,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Watcher Resources",order=14,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
// +kubebuilder:default:={"limits":{"cpu":"750m","memory":"384Mi"},"requests":{"cpu":"500m","memory":"384Mi"}}
ResourcesWatcher *corev1.ResourceRequirements `json:"resourcesWatcher,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Admission Controller Resources",order=10,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
//+kubebuilder:default:={"limits":{"cpu":"300m","memory":"512Mi"},"requests":{"cpu":"300m","memory":"512Mi"}}
//+kubebuilder:default:={"limits":{"cpu":"300m","memory":"256Mi"},"requests":{"cpu":"300m","memory":"256Mi"}}
ResourcesAC *corev1.ResourceRequirements `json:"resources,omitempty"`

// Type of Deployment update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate.
Expand Down Expand Up @@ -201,3 +236,35 @@ type FalconAdmissionList struct {
func init() {
SchemeBuilder.Register(&FalconAdmission{}, &FalconAdmissionList{})
}

func (watcher FalconAdmissionConfigSpec) DeployWatcherContainer() bool {
if watcher.DeployWatcher == nil {
return DeployWatcherDefault
}

return *watcher.DeployWatcher
}

func (watcher FalconAdmissionConfigSpec) GetSnapshotsEnabled() bool {
if watcher.SnapshotsEnabled == nil {
return SnapshotsEnabledDefault
}

return *watcher.SnapshotsEnabled
}

func (watcher FalconAdmissionConfigSpec) GetSnapshotsInterval() time.Duration {
if watcher.SnapshotsInterval == nil {
return SnapshotsIntervalDefault * time.Hour
}

return watcher.SnapshotsInterval.Duration
}

func (watcher FalconAdmissionConfigSpec) GetWatcherEnabled() bool {
if watcher.WatcherEnabled == nil {
return WatcherEnabledDefault
}

return *watcher.WatcherEnabled
}
25 changes: 25 additions & 0 deletions api/falcon/v1alpha1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,26 @@ func (in *FalconAdmissionConfigSpec) DeepCopyInto(out *FalconAdmissionConfigSpec
}
in.TLS.DeepCopyInto(&out.TLS)
in.DisabledNamespaces.DeepCopyInto(&out.DisabledNamespaces)
if in.DeployWatcher != nil {
in, out := &in.DeployWatcher, &out.DeployWatcher
*out = new(bool)
**out = **in
}
if in.SnapshotsEnabled != nil {
in, out := &in.SnapshotsEnabled, &out.SnapshotsEnabled
*out = new(bool)
**out = **in
}
if in.SnapshotsInterval != nil {
in, out := &in.SnapshotsInterval, &out.SnapshotsInterval
*out = new(v1.Duration)
**out = **in
}
if in.WatcherEnabled != nil {
in, out := &in.WatcherEnabled, &out.WatcherEnabled
*out = new(bool)
**out = **in
}
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
Expand All @@ -338,6 +358,11 @@ func (in *FalconAdmissionConfigSpec) DeepCopyInto(out *FalconAdmissionConfigSpec
*out = new(corev1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.ResourcesWatcher != nil {
in, out := &in.ResourcesWatcher, &out.ResourcesWatcher
*out = new(corev1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.ResourcesAC != nil {
in, out := &in.ResourcesAC, &out.ResourcesAC
*out = new(corev1.ResourceRequirements)
Expand Down
15 changes: 15 additions & 0 deletions bundle/manifests/falcon-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@ spec:
- description: Ignore admission control for a specific set of namespaces.
displayName: Ignore Namespace List
path: admissionConfig.disabledNamespaces
- displayName: Falcon Admission Controller Watcher Resources
path: admissionConfig.resourcesWatcher
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Determines if snapshots of Kubernetes resources are periodically
taken for cluster visibility.
displayName: Enable Resource Snapshots
path: admissionConfig.snapshotsEnabled
- description: Time interval between two snapshots of Kubernetes resources in
the cluster.
displayName: Time Interval Between Two Snapshots
path: admissionConfig.snapshotsInterval
- description: Determines if Kubernetes resources are watched for cluster visibility.
displayName: Enable Resource Watcher
path: admissionConfig.watcherEnabled
version: v1alpha1
- description: FalconContainer is the Schema for the falconcontainers API
displayName: Falcon Container
Expand Down
73 changes: 73 additions & 0 deletions bundle/manifests/falcon.crowdstrike.com_falconadmissions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,63 @@ spec:
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
resourcesWatcher:
default:
limits:
cpu: 750m
memory: 256Mi
requests:
cpu: 500m
memory: 256Mi
description: ResourceRequirements describes the compute resource
requirements.
properties:
claims:
description: "Claims lists the names of resources, defined
in spec.resourceClaims, that are used by this container.
\n This is an alpha field and requires enabling the DynamicResourceAllocation
feature gate. \n This field is immutable. It can only be
set for containers."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in
pod.spec.resourceClaims of the Pod where this field
is used. It makes that resource available inside a
container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
serviceAccount:
description: Define annotations that will be passed down to admision
controller service account. This is useful for passing along
Expand All @@ -241,6 +298,17 @@ spec:
minimum: 0
type: integer
x-kubernetes-int-or-string: true
snapshotsEnabled:
default: true
description: Determines if snapshots of Kubernetes resources are
periodically taken for cluster visibility.
type: boolean
snapshotsInterval:
default: 22h
description: Time interval between two snapshots of Kubernetes
resources in the cluster.
format: duration
type: string
tls:
description: Configure TLS setings for the Falcon Admission Controller
properties:
Expand Down Expand Up @@ -300,6 +368,11 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
watcherEnabled:
default: true
description: Determines if Kubernetes resources are watched for
cluster visibility.
type: boolean
type: object
falcon:
description: CrowdStrike Falcon sensor configuration
Expand Down
Loading
Loading