Skip to content

Commit

Permalink
add in cluster tests
Browse files Browse the repository at this point in the history
Signed-off-by: Achref ben saad <achref9612@gmail.com>
  • Loading branch information
achrefbensaad committed Jul 8, 2022
1 parent b7a0176 commit 1977832
Show file tree
Hide file tree
Showing 3 changed files with 847 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci-test-incluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: run-in-cluster-test

on:
push:
branches:
- "**"
paths:
- "deployments/annotations/**"
- "deployments/generic/**"
- "tests/test-scenarios-in-cluster.sh"
- ".github/workflows/ci-test-incluster.yml"
pull_request:
branches: ["*"]
paths:
- "deployments/annotations/**"
- "deployments/generic/**"
- "tests/test-scenarios-in-cluster.sh"
- ".github/workflows/ci-test-incluster.yml"

jobs:
manifest-test:
name: Run basic manifest tests / ${{ matrix.os }} / ${{ matrix.runtime }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-18.04]
runtime: ["docker", "containerd", "crio"]
steps:
- name: Kernel version
run: uname -r

- uses: actions/checkout@v2

- name: Setup Enviroment
run: |
echo "RUNTIME="$RUNTIME
if [ "$RUNTIME" == "docker" ]; then
./contribution/self-managed-k8s/docker/install_docker.sh
docker --version
elif [ "$RUNTIME" == "crio" ]; then
./contribution/self-managed-k8s/crio/install_crio.sh
crio --version
fi
./contribution/k3s/install_k3s.sh
- name: Test manifests
run: ./tests/test-scenarios-in-cluster.sh

- name: Archive log artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kubearmor.logs
path: |
/tmp/kubearmor.test
/tmp/kubearmor.log
/tmp/kubearmor.msg
- name: Check Results
if: ${{ always() }}
run: cat /tmp/kubearmor.test
11 changes: 11 additions & 0 deletions deployments/generic/kubearmor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ spec:
containers:
- image: kubearmor/kubearmor-relay-server:latest
name: kubearmor-relay-server
securityContext:
readOnlyRootFilesystem: true
ports:
- containerPort: 32767
nodeSelector:
Expand Down Expand Up @@ -103,6 +105,7 @@ spec:
- containerPort: 32767
securityContext:
privileged: true
readOnlyRootFilesystem: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
Expand Down Expand Up @@ -132,6 +135,8 @@ spec:
- mountPath: /var/lib/docker
name: docker-storage-path
readOnly: true
- mountPath: /tmp
name: tmp-path
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
hostPID: true
Expand Down Expand Up @@ -183,6 +188,8 @@ spec:
path: /var/lib/docker
type: DirectoryOrCreate
name: docker-storage-path
- emptyDir: {}
name: tmp-path
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -226,6 +233,8 @@ spec:
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
name: kube-rbac-proxy
securityContext:
readOnlyRootFilesystem: true
ports:
- containerPort: 8443
name: https
Expand Down Expand Up @@ -295,6 +304,8 @@ spec:
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
name: kube-rbac-proxy
securityContext:
readOnlyRootFilesystem: true
ports:
- containerPort: 8443
name: https
Expand Down
Loading

0 comments on commit 1977832

Please sign in to comment.