Skip to content

Commit

Permalink
test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Aryan-sharma11 <[email protected]>
  • Loading branch information
Aryan-sharma11 committed Feb 5, 2025
1 parent f11bfeb commit 17ad20a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/ci-test-controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,30 @@ jobs:
kubectl rollout status --timeout=5m daemonset -l kubearmor-app=kubearmor -n kubearmor
kubectl rollout status --timeout=5m deployment -n kubearmor -l kubearmor-app=kubearmor-controller -n kubearmor
kubectl get pods -A
done
done
- name: Get KubeArmor POD info
run: |
DAEMONSET_NAME=$(kubectl get daemonset -n kubearmor -o jsonpath='{.items[0].metadata.name}')
LABEL_SELECTOR=$(kubectl get daemonset $DAEMONSET_NAME -n kubearmor -o jsonpath='{.spec.selector.matchLabels}' | jq -r 'to_entries[] | "\(.key)=\(.value)"' | paste -sd, -)
POD_NAME=$(kubectl get pods -n kubearmor -l "$LABEL_SELECTOR" -o jsonpath='{.items[*].metadata.name}')
echo "Pod: $POD_NAME"
echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV
sleep 15
kubectl get pods -A
kubectl logs -n kubearmor "$POD_NAME"
- name: Test KubeArmor using Ginkgo
run: |
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
ginkgo --vv --flake-attempts=10 --timeout=10m smoke/
ginkgo --vv --flake-attempts=10 --timeout=10m blockposture/
working-directory: ./tests/k8s_env
timeout-minutes: 30

- name: Controller logs
if: ${{ failure() }}
run: |
kubectl logs -l app=kubearmor-controller -n kubearmor --all-containers=true -f
- name: Get karmor sysdump
if: ${{ failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci-test-ginkgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,21 @@ jobs:
POD_NAME=$(kubectl get pods -n kubearmor -l "$LABEL_SELECTOR" -o jsonpath='{.items[*].metadata.name}')
echo "Pod: $POD_NAME"
echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV
sleep 15
kubectl get pods -A
kubectl logs -n kubearmor "$POD_NAME"
kubectl logs -l app=kubearmor-controller -n kubearmor --all-containers=true
- name: Test KubeArmor using Ginkgo
run: |
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
make
working-directory: ./tests/k8s_env
timeout-minutes: 30
- name: Controller logs
if: ${{ failure() }}
run: |
kubectl logs -l app=kubearmor-controller -n kubearmor --all-containers=true -f
- name: Kill KubeArmor prcoess in the pod
run: |
Expand Down
6 changes: 6 additions & 0 deletions pkg/KubeArmorController/handlers/pod_mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package handlers
import (
"context"
"encoding/json"
"fmt"
"net/http"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -64,8 +65,11 @@ func (a *PodAnnotator) Handle(ctx context.Context, req admission.Request) admiss
}
a.Cluster.ClusterLock.RUnlock()
if annotate {
fmt.Println("updating pod annotation")
common.AppArmorAnnotatorBinding(binding, pod)
}
fmt.Println("annotation binidng", binding)

// == //
// send the mutation response
marshaledPod, err := json.Marshal(binding)
Expand Down Expand Up @@ -100,8 +104,10 @@ func (a *PodAnnotator) Handle(ctx context.Context, req admission.Request) admiss
}
a.Cluster.ClusterLock.RUnlock()
if annotate {
fmt.Println("updating pod annotation")
common.AppArmorAnnotator(pod)
}
fmt.Println("annotation pod", pod)

}
// == //
Expand Down
2 changes: 1 addition & 1 deletion tests/k8s_env/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
@go mod tidy
# run in two steps as syscall suite fails if run at the very end
# see - https://github.com/kubearmor/KubeArmor/issues/1269
@ginkgo --vv --flake-attempts=10 --timeout=15m syscalls/
# @ginkgo --vv --flake-attempts=10 --timeout=15m syscalls/
@ginkgo -r --vv --flake-attempts=10 --timeout=30m --skip-package "syscalls"
.PHONY: test
test:
Expand Down
1 change: 1 addition & 0 deletions tests/util/kartutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func K8sGetPods(podstr string, ns string, ants []string, timeout int) ([]string,
}
pods = []string{}
for _, p := range podList.Items {
fmt.Printf("pod name := %s , pod annotation:= %s", p.Name, p.Annotations)
if p.Status.Phase != corev1.PodRunning || p.DeletionTimestamp != nil {
continue
}
Expand Down

0 comments on commit 17ad20a

Please sign in to comment.