forked from kubernetes/perf-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#2234 from dlapcevic/netpol-enforcement-…
…latency-test Add network policy enforcement latency measurement
- Loading branch information
Showing
10 changed files
with
775 additions
and
0 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
11 changes: 11 additions & 0 deletions
11
clusterloader2/pkg/measurement/common/network-policy/manifests/clusterrole.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,11 @@ | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{.Name}} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["networking.k8s.io"] | ||
resources: ["networkpolicies"] | ||
verbs: ["get"] |
12 changes: 12 additions & 0 deletions
12
clusterloader2/pkg/measurement/common/network-policy/manifests/clusterrolebinding.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,12 @@ | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{.Name}} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{.Name}} | ||
apiGroup: rbac.authorization.k8s.io |
52 changes: 52 additions & 0 deletions
52
...loader2/pkg/measurement/common/network-policy/manifests/dep-test-client-pod-creation.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,52 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
labels: | ||
test: {{.TestClientLabel}} | ||
type: {{.TypeLabelValue}} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: {{.Name}} | ||
template: | ||
metadata: | ||
labels: | ||
name: {{.Name}} | ||
test: {{.TestClientLabel}} | ||
type: {{.TypeLabelValue}} | ||
spec: | ||
# Use separate nodes to avoid consuming CPU/Memory resources on default | ||
# nodes where all deployments of the performance test run. | ||
nodeSelector: | ||
{{.TestClientNodeSelectorKey}}: {{.TestClientNodeSelectorValue}} | ||
tolerations: | ||
- key: {{.TestClientNodeSelectorKey}} | ||
operator: Equal | ||
value: {{.TestClientNodeSelectorValue}} | ||
effect: NoSchedule | ||
containers: | ||
- name: net-policy-latency-client | ||
ports: | ||
- containerPort: {{.MetricsPort}} | ||
name: npdelaymetrics | ||
protocol: TCP | ||
imagePullPolicy: Always | ||
image: gcr.io/k8s-staging-perf-tests/network-policy-enforcement-latency/pod-creation-reachability-latency:v0.0.1 | ||
command: | ||
- sh | ||
- -c | ||
- ./pod-creation-reachability-latency | ||
-HostNamespace="{{.Namespace}}" | ||
-TargetLabelSelector="{{.TargetLabelSelector}}" | ||
-TargetNamespace="{{.TargetNamespace}}" | ||
-TargetPort={{.TargetPort}} | ||
-MaxTargets={{.MaxTargets}} | ||
-MetricsPort={{.MetricsPort}} | ||
resources: | ||
requests: | ||
cpu: 200m | ||
memory: 100Mi | ||
serviceAccountName: {{.ServiceAccountName}} |
53 changes: 53 additions & 0 deletions
53
...der2/pkg/measurement/common/network-policy/manifests/dep-test-client-policy-creation.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,53 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
labels: | ||
test: {{.TestClientLabel}} | ||
type: {{.TypeLabelValue}} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: {{.Name}} | ||
template: | ||
metadata: | ||
labels: | ||
name: {{.Name}} | ||
test: {{.TestClientLabel}} | ||
type: {{.TypeLabelValue}} | ||
spec: | ||
# Use separate nodes to avoid consuming CPU/Memory resources on default | ||
# nodes where all deployments of the performance test run. | ||
nodeSelector: | ||
{{.TestClientNodeSelectorKey}}: {{.TestClientNodeSelectorValue}} | ||
tolerations: | ||
- key: {{.TestClientNodeSelectorKey}} | ||
operator: Equal | ||
value: {{.TestClientNodeSelectorValue}} | ||
effect: NoSchedule | ||
containers: | ||
- name: net-policy-latency-client | ||
ports: | ||
- containerPort: {{.MetricsPort}} | ||
name: npdelaymetrics | ||
protocol: TCP | ||
imagePullPolicy: Always | ||
image: gcr.io/k8s-staging-perf-tests/network-policy-enforcement-latency/policy-creation-enforcement-latency:v0.0.1 | ||
command: | ||
- sh | ||
- -c | ||
- ./policy-creation-enforcement-latency | ||
-HostNamespace="{{.Namespace}}" | ||
-TargetLabelSelector="{{.TargetLabelSelector}}" | ||
-TargetNamespace="{{.TargetNamespace}}" | ||
-TargetPort={{.TargetPort}} | ||
-MaxTargets={{.MaxTargets}} | ||
-MetricsPort={{.MetricsPort}} | ||
-AllowPolicyName={{.AllowPolicyName}} | ||
resources: | ||
requests: | ||
cpu: 200m | ||
memory: 100Mi | ||
serviceAccountName: {{.ServiceAccountName}} |
22 changes: 22 additions & 0 deletions
22
...oader2/pkg/measurement/common/network-policy/manifests/policy-egress-allow-apiserver.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,22 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
labels: | ||
test: {{.TestClientLabel}} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
test: {{.TestClientLabel}} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- ports: | ||
- port: 443 | ||
protocol: TCP | ||
- port: 80 | ||
protocol: TCP | ||
to: | ||
- ipBlock: | ||
cidr: {{.kubeAPIServerIP}}/32 |
25 changes: 25 additions & 0 deletions
25
...der2/pkg/measurement/common/network-policy/manifests/policy-egress-allow-target-pods.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,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
labels: | ||
type: {{.TypeLabelValue}} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
type: {{.TypeLabelValue}} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
{{.TargetLabelKey}}: {{.TargetLabelValue}} | ||
{{if .OnlyTargetNamespace}} | ||
namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: {{.TargetNamespace}} | ||
{{else}} | ||
namespaceSelector: {} | ||
{{end}} |
23 changes: 23 additions & 0 deletions
23
clusterloader2/pkg/measurement/common/network-policy/manifests/policy-load.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,23 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} | ||
labels: | ||
group: load | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
{{.PodSelectorLabelKey}}: {{.PodSelectorLabelValue}} | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- ipBlock: | ||
cidr: {{.CIDR}} | ||
ports: | ||
# Use two ports to double the number of load network policy rules. | ||
- protocol: TCP | ||
port: 8080 | ||
- protocol: TCP | ||
port: 6355 |
5 changes: 5 additions & 0 deletions
5
clusterloader2/pkg/measurement/common/network-policy/manifests/serviceaccount.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,5 @@ | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{.Name}} | ||
namespace: {{.Namespace}} |
Oops, something went wrong.