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 44 commits into
base: dev
Choose a base branch
from
Open

feat: add wiz manifests #8679

wants to merge 44 commits into from

Conversation

vinaythupili
Copy link
Collaborator

-- add wiz manifests

@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.

- name: wiz-sensor
kind : ClusterRoleBinding
namespace: wiz
{{- end }}
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.

If both runtime_sensor and runtime_connector are false, then it should also delete the wiz namespace as a last step.

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.

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.

node-feature.zalando.org/wiz: enabled
{{ else }}
node.kubernetes.io/role: worker
{{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be node-feature.zalando.org/wiz: enabled or node.kubernetes.io/role: worker. It should always select nodes with node.kubernetes.io/role: worker and optionally it should limit this futher to nodes with: node-feature.zalando.org/wiz: enabled

E.g. you want this:

nodeSelector:
        {{ if eq .Cluster.ConfigItems.wiz_node_feature_rollout "true" }}
        node-feature.zalando.org/wiz: enabled
        {{ end }}
        node.kubernetes.io/role: worker

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.

- 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)

- 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.

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