Skip to content

Commit

Permalink
Merge pull request #1772 from Prateeknandle/cluster-level-policy
Browse files Browse the repository at this point in the history
feat:Adding support for KubeArmorClusterPolicy
  • Loading branch information
daemon1024 authored Jul 9, 2024
2 parents 1fc5a38 + c53ff79 commit 5139feb
Show file tree
Hide file tree
Showing 66 changed files with 7,089 additions and 147 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci-test-ginkgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ jobs:
docker save kubearmor/kubearmor-snitch:latest | sudo k3s ctr images import -
else
if [ ${{ matrix.runtime }} == "crio" ]; then
sudo podman pull docker-daemon:kubearmor/kubearmor-init:latest
sudo podman pull docker-daemon:kubearmor/kubearmor:latest
sudo podman pull docker-daemon:kubearmor/kubearmor-operator:latest
sudo podman pull docker-daemon:kubearmor/kubearmor-snitch:latest
docker save kubearmor/kubearmor-init:latest | sudo podman load
sudo podman tag localhost/latest:latest docker.io/kubearmor/kubearmor-init:latest
docker save kubearmor/kubearmor:latest | sudo podman load
sudo podman tag localhost/latest:latest docker.io/kubearmor/kubearmor:latest
docker save kubearmor/kubearmor-operator:latest | sudo podman load
sudo podman tag localhost/latest:latest docker.io/kubearmor/kubearmor-operator:latest
docker save kubearmor/kubearmor-snitch:latest | sudo podman load
sudo podman tag localhost/latest:latest docker.io/kubearmor/kubearmor-snitch:latest
fi
fi
helm upgrade --install kubearmor-operator ./deployments/helm/KubeArmorOperator -n kubearmor --create-namespace --set kubearmorOperator.image.tag=latest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-test-ubi-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ jobs:
- name: Run KubeArmor
run: |
sudo podman pull docker-daemon:kubearmor/kubearmor-init:latest
sudo podman pull docker-daemon:kubearmor/kubearmor-ubi:latest
sudo podman pull docker-daemon:kubearmor/kubearmor-operator:latest
sudo podman pull docker-daemon:kubearmor/kubearmor-snitch:latest
docker save kubearmor/kubearmor-init:latest | sudo podman load
docker save kubearmor/kubearmor-ubi:latest | sudo podman load
docker save kubearmor/kubearmor-operator:latest | sudo podman load
docker save kubearmor/kubearmor-snitch:latest | sudo podman load
helm upgrade --install kubearmor-operator ./deployments/helm/KubeArmorOperator -n kubearmor --create-namespace --set kubearmorOperator.image.tag=latest
kubectl get pods -A
kubectl wait --for=condition=ready --timeout=5m -n kubearmor pod -l kubearmor-app=kubearmor-operator
Expand Down
1 change: 1 addition & 0 deletions KubeArmor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ build-test: testall
.PHONY: run
run: build
cd $(CRDDIR); kubectl apply -f KubeArmorPolicy.yaml
cd $(CRDDIR); kubectl apply -f KubeArmorClusterPolicy.yaml
cd $(CRDDIR); kubectl apply -f KubeArmorHostPolicy.yaml
cd $(CURDIR); sudo rm -f /tmp/kubearmor.log
cd $(CURDIR)/BPF; make clean
Expand Down
10 changes: 10 additions & 0 deletions KubeArmor/core/kubeArmor.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,16 @@ func KubeArmor() {
}
dm.Logger.Print("Started to monitor security policies")

// watch cluster security policies
clusterSecurityPoliciesSynced := dm.WatchClusterSecurityPolicies()
if clusterSecurityPoliciesSynced == nil {
// destroy the daemon
dm.DestroyKubeArmorDaemon()

return
}
dm.Logger.Print("Started to monitor cluster security policies")

// watch default posture
defaultPostureSynced := dm.WatchDefaultPosture()
if defaultPostureSynced == nil {
Expand Down
Loading

0 comments on commit 5139feb

Please sign in to comment.