-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prateek Nandle <[email protected]>
- Loading branch information
1 parent
31753cc
commit d9eb6a5
Showing
5 changed files
with
352 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/k8s_env/throttling/res/ksp-wordpress-block-process.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorPolicy | ||
metadata: | ||
name: ksp-wordpress-block-process | ||
namespace: wordpress-mysql | ||
spec: | ||
severity: 3 | ||
selector: | ||
matchLabels: | ||
app: wordpress | ||
process: | ||
matchPaths: | ||
- path: /usr/bin/apt | ||
- path: /usr/bin/apt-get | ||
|
||
# apt update | ||
# apt-get update | ||
|
||
action: | ||
Block |
100 changes: 100 additions & 0 deletions
100
tests/k8s_env/throttling/res/wordpress-mysql-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: wordpress-mysql | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: wordpress | ||
namespace: wordpress-mysql | ||
labels: | ||
app: wordpress | ||
spec: | ||
selector: | ||
app: wordpress | ||
type: NodePort | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
nodePort: 30080 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: wordpress | ||
namespace: wordpress-mysql | ||
labels: | ||
app: wordpress | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: wordpress | ||
template: | ||
metadata: | ||
labels: | ||
app: wordpress | ||
# annotations: | ||
# kubearmor-policy: enabled | ||
# container.apparmor.security.beta.kubernetes.io/wordpress: localhost/kubearmor-wordpress-mysql-wordpress | ||
spec: | ||
containers: | ||
- name: wordpress | ||
image: wordpress:4.8-apache | ||
env: | ||
- name: WORDPRESS_DB_HOST | ||
value: mysql | ||
- name: WORDPRESS_DB_PASSWORD | ||
value: root-password | ||
securityContext: | ||
allowPrivilegeEscalation: true | ||
capabilities: | ||
add: ["NET_RAW"] | ||
ports: | ||
- name: wordpress | ||
containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mysql | ||
namespace: wordpress-mysql | ||
labels: | ||
app: mysql | ||
spec: | ||
selector: | ||
app: mysql | ||
ports: | ||
- port: 3306 | ||
targetPort: 3306 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mysql | ||
namespace: wordpress-mysql | ||
labels: | ||
app: mysql | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: mysql | ||
template: | ||
metadata: | ||
labels: | ||
app: mysql | ||
# annotations: | ||
# kubearmor-policy: enabled | ||
# container.apparmor.security.beta.kubernetes.io/mysql: localhost/kubearmor-wordpress-mysql-mysql | ||
spec: | ||
containers: | ||
- name: mysql | ||
image: mysql:5.6 | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: root-password | ||
ports: | ||
- name: mysql | ||
containerPort: 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package throttling_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestThrottling(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Throttling Suite") | ||
} |
Oops, something went wrong.