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 wiz manifests #8679

Open
wants to merge 47 commits into
base: dev
Choose a base branch
from
Open

feat: add wiz manifests #8679

wants to merge 47 commits into from

Conversation

vinaythupili
Copy link
Collaborator

@vinaythupili vinaythupili commented Dec 19, 2024

This PR will add the manifests for WIZ Connector and WIZ Sensor components for active monitoring of Kubernetes clusters.
The following Resources will be added as part of the PR .
WIZ Connector

  • Deployment (WIZ broker)
  • Jobs (WIZ connector)
  • Service Accounts
  • Role
  • Role binding
  • Cluster Role Binding
  • Secrets

WIZ Sensor

  • Daemon set (Sensor)
  • Secret
  • Service Accounts
  • Cluster Role
  • Cluster Role Binding

@vinaythupili
Copy link
Collaborator Author

👍

cluster/manifests/wiz/sensor/clusterrole.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/sensor/clusterrole.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/sensor/clusterrole.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/sensor/dameonset.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/sensor/dameonset.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/sensor/dameonset.yaml Outdated Show resolved Hide resolved
@zaklawrencea zaklawrencea added major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. do-not-merge labels Dec 19, 2024
@linki
Copy link
Member

linki commented Dec 19, 2024

We should also populate the deletions.yaml. Otherwise, the ConfigItem cannot be used to turn it off again.

@vinaythupili
Copy link
Collaborator Author

We should also populate the deletions.yaml. Otherwise, the ConfigItem cannot be used to turn it off again.

updated 👍

Signed-off-by: Katyanna Moura <[email protected]>
Trigger deletions when daemonset is disabled.

Co-authored-by: Zak Lawrence A <[email protected]>
cluster/config-defaults.yaml Outdated Show resolved Hide resolved
cluster/config-defaults.yaml Outdated Show resolved Hide resolved
cluster/manifests/wiz/005-connector-job.yaml Show resolved Hide resolved
cluster/manifests/wiz/005-connector-job.yaml Show resolved Hide resolved
cluster/manifests/wiz/sensor-daemonset.yaml Show resolved Hide resolved
@@ -1202,3 +1202,12 @@ role_sync_controller_enabled: "true"
{{ else }}
role_sync_controller_enabled: "false"
{{ end }}

#Wiz Configs
wiz_enable_runtime_sensor: "false"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please describe with 1-2 lines in a comment what these configs do. See how we do it in the rest of this file.

memory/cpu config-items don't need much description, those are obvious, but the others e.g. like wiz_node_feature_rollout does need a bit of description how to use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 🙌

selector:
matchLabels:
application: "wiz"
component: "sensor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use daemonset: wiz-sensor as the only label selector here. This is how we do it for all other daemonsets/deployments in this repo and it allows easier change of application/component labels if ever needed in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 🙌

selector:
matchLabels:
application: "wiz"
component: "connector"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use deployment: wiz-connector-agent as the only label selector here. This is how we do it for all other daemonsets/deployments in this repo and it allows easier change of application/component labels if ever needed in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 🙌

cluster-autoscaler.kubernetes.io/enable-ds-eviction: "true"
node-ready.cluster.zalando.org/exclude: "true"
spec:
serviceAccountName: wiz-sensor
Copy link
Contributor

@mikkeloscar mikkeloscar Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service account should be added to the privileged list here:

# service accounts that need privileged PSP should be defined here as `<namespace>_<sa-name>`
pod.pod-security-policy.privileged-service-accounts.kube-system_kube-proxy: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_skipper-ingress: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_node-monitor: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_nvidia: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_audittrail-adapter: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_kube-aws-iam-controller: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_kube2iam: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_ebs-csi-node-sa: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_flannel: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_etcd-backup: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_coredns: ""
pod.pod-security-policy.privileged-service-accounts.kube-system_efs-provisioner: ""
{{- if eq .Cluster.ConfigItems.s3_csi_driver "true" }}
pod.pod-security-policy.privileged-service-accounts.kube-system_s3-csi-driver: ""
{{- end }}
{{- if eq .Cluster.ConfigItems.aws_efa_device_plugin_enabled "true" }}
pod.pod-security-policy.privileged-service-accounts.kube-system_aws-efa-k8s-device-plugin: ""
{{- end }}

it should ofc. only be added if eq .Cluster.ConfigItems.wiz_enable_runtime_sensor "true"

This was currently set per cluster via: teapot_admission_controller_pod_security_policy_privileged_service_accounts but it makes more sense to make it a condition of the wiz_enable_runtime_sensor: true|false config-item.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 🙌

- IPC_LOCK # eBPF
- FOWNER # file hashing
- SYS_PTRACE # eBPF
- SYSLOG # kernel symbol resolve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These capabilities should be enabled conditionally here:

pod.pod-security-policy.allowed-restricted-capabilities.AUDIT_WRITE: ""
pod.pod-security-policy.allowed-restricted-capabilities.CHOWN: ""
pod.pod-security-policy.allowed-restricted-capabilities.DAC_OVERRIDE: ""
pod.pod-security-policy.allowed-restricted-capabilities.FOWNER: ""
pod.pod-security-policy.allowed-restricted-capabilities.FSETID: ""
pod.pod-security-policy.allowed-restricted-capabilities.KILL: ""
pod.pod-security-policy.allowed-restricted-capabilities.MKNOD: ""
pod.pod-security-policy.allowed-restricted-capabilities.NET_BIND_SERVICE: ""
pod.pod-security-policy.allowed-restricted-capabilities.NET_RAW: ""
pod.pod-security-policy.allowed-restricted-capabilities.SETFCAP: ""
pod.pod-security-policy.allowed-restricted-capabilities.SETGID: ""
pod.pod-security-policy.allowed-restricted-capabilities.SETPCAP: ""
pod.pod-security-policy.allowed-restricted-capabilities.SETUID: ""
pod.pod-security-policy.allowed-restricted-capabilities.SYS_CHROOT: ""
pod.pod-security-policy.allowed-restricted-capabilities.SYS_NICE: ""
{{- range $cap := split .Cluster.ConfigItems.teapot_admission_controller_pod_security_policy_additional_restricted_capabilities "," }}
pod.pod-security-policy.allowed-restricted-capabilities.{{ $cap }}: ""
{{- end}}

(Those that are not already mentioned in the list)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 🙌

- name: tmp-store
emptyDir:
sizeLimit: "100Mi"
medium: "Memory"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this memory volume will contribute to the memory limit of the pod. Would be good to understand with wiz if this must be memory backed or could be backed by disk and thereby allow to potentially lower the memory request/limit of daemonset pod.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure @mikkeloscar 👍 , will check with the team if we can adapt the disk instead of memory.

@@ -10,20 +10,21 @@ metadata:
helm.sh/chart: wiz-broker-2.1.0
application: "wiz"
component: "connector"
deployment: "wiz-connector-agent"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this should be job: wiz-connector-agent as we use the kind to avoid that job and deployment resources with the same name could overlap.

Sorry if I suggested deployment, then I didn't realize this was a Job manifest.

pod.pod-security-policy.allowed-restricted-capabilities.SYS_PTRACE: ""
pod.pod-security-policy.allowed-restricted-capabilities.SYS_RESOURCE: ""
pod.pod-security-policy.allowed-restricted-capabilities.SYS_RAWIO: ""
pod.pod-security-policy.allowed-restricted-capabilities.SYSLOG: ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks wrong. It removes the allowed-unsafe-sysctls.{{ $sysctl }}: "" setting and adds the capbilties based on the allowed_unsafe_sysctls config-item.

The capabilties should be behind the config-item: {{- if eq. .Cluster.ConfigItems.wiz_enable_runtime_sensor "true" }} and they should apply to the allowed-privileged-capabilities not allowed-restricted-capabilities. We only want to enable these for privileged pods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants