Skip to content

Commit

Permalink
creating ccnp/cnp feature pipeline
Browse files Browse the repository at this point in the history
- added CNP and CCNP template files
- made changes to slo.py to include necessary variables
- additions to load config and reconcile objects to include ccnp and cnp variables
- added nginx deployment based on conditionals
- created ccnp-cnp feature pipeline yaml
- added necessary variables in existing slo steps
  • Loading branch information
karina-ranadive committed Jan 7, 2025
1 parent 463b8da commit 43d8920
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 13 deletions.
14 changes: 14 additions & 0 deletions modules/python/clusterloader2/slo/config/ccnp_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: {{.basename}}
spec:
endpointSelector:
matchLabels:
app: nginx
egress:
- toEndpoints:
- {}
ingress:
- fromEndpoints:
- {}
12 changes: 12 additions & 0 deletions modules/python/clusterloader2/slo/config/cnp_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: {{.basename}}
namespace: slo-1
spec:
endpointSelector:
matchLabels:
app: nginx
egress:
- toEndpoints:
- {}
23 changes: 23 additions & 0 deletions modules/python/clusterloader2/slo/config/deployment_template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{{$CpuRequest := DefaultParam .CpuRequest "5m"}}
{{$MemoryRequest := DefaultParam .MemoryRequest "20M"}}
{{$cnpsPerNamespace := .cnpsPerNamespace}}
{{$ccnps := .ccnps}}
{{$cnp_test:= .cnp_test}}
{{$ccnp_test:= .ccnp_test}}
{{$dualstack := .dualstack}}

{{$Image := DefaultParam .Image "mcr.microsoft.com/oss/kubernetes/pause:3.6"}}

Expand Down Expand Up @@ -35,13 +40,31 @@ spec:
nodeSelector:
slo: "true"
containers:
{{if or $cnp_test $ccnp_test}}
{{if $dualstack}}
- name: nginx
image: mcr.microsoft.com/mirror/docker/library/nginx:1.25
command: ["sh", "-c", "while true; do curl ipv6.bing.com; sleep 6; done"]
ports:
- name: http
containerPort: 80
{{else}}
- name: nginx
image: mcr.microsoft.com/mirror/docker/library/nginx:1.25
command: ["sh", "-c", "while true; do curl ipv4.bing.com; sleep 6; done"]
ports:
- name: http
containerPort: 80
{{end}}
{{else}}
- env:
- name: ENV_VAR
value: a
image: {{$Image}}
imagePullPolicy: IfNotPresent
name: {{.Name}}
ports:
{{end}}
resources:
requests:
cpu: {{$CpuRequest}}
Expand Down
70 changes: 69 additions & 1 deletion modules/python/clusterloader2/slo/config/load-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: load-config

# Config options for test type
{{$SERVICE_TEST := DefaultParam .CL2_SERVICE_TEST true}}
{{$CNP_TEST := DefaultParam .CL2_CNP_TEST false}}
{{$CCNP_TEST := DefaultParam .CL2_CCNP_TEST false}}

# Config options for test parameters
{{$nodesPerNamespace := DefaultParam .CL2_NODES_PER_NAMESPACE 100}}
Expand Down Expand Up @@ -34,6 +36,12 @@ name: load-config
{{$smallDeploymentPods := SubtractInt $podsPerNamespace (MultiplyInt $bigDeploymentsPerNamespace $BIG_GROUP_SIZE)}}
{{$smallDeploymentsPerNamespace := DivideInt $smallDeploymentPods $SMALL_GROUP_SIZE}}

# CNP & CCNP Test
{{$CNPS_PER_NAMESPACE := DefaultParam .CL2_CNPS_PER_NAMESPACE 0}}
{{$CCNPS := DefaultParam .CL2_CCNPS 0}}
{{$nameOfNs := "slo-1"}}
{{$DUALSTACK := DefaultParam .CL2_DUALSTACK false}}

namespace:
number: {{$namespaces}}
prefix: slo
Expand Down Expand Up @@ -85,17 +93,45 @@ steps:
bigServicesPerNamespace: {{$bigDeploymentsPerNamespace}}
{{end}}

{{if $CNP_TEST}}
- module:
path: /modules/ciliumnetworkpolicy.yaml
params:
actionName: "Creating"
namespaces: {{$namespaces}}
nameOfNs: {{$nameOfNs}}
cnpsPerNamespace: {{$CNPS_PER_NAMESPACE}}
{{end}}

{{if $CCNP_TEST}}
- module:
path: /modules/ciliumclusternetworkpolicy.yaml
params:
actionName: "Creating"
ccnps: {{$CCNPS}}
{{end}}

- module:
path: /modules/reconcile-objects.yaml
params:
actionName: "create"
namespaces: {{$namespaces}}
tuningSet: DeploymentCreateQps
operationTimeout: {{$operationTimeout}}
{{if or $CCNP_TEST $CNP_TEST}}
bigDeploymentSize: 0
bigDeploymentsPerNamespace: 0
{{else}}
bigDeploymentSize: {{$BIG_GROUP_SIZE}}
bigDeploymentsPerNamespace: {{$bigDeploymentsPerNamespace}}
{{end}}
smallDeploymentSize: {{$SMALL_GROUP_SIZE}}
smallDeploymentsPerNamespace: {{$smallDeploymentsPerNamespace}}
cnpsPerNamespace: {{$CNPS_PER_NAMESPACE}}
ccnps: {{$CCNPS}}
cnp_test: {{$CNP_TEST}}
ccnp_test: {{$CCNP_TEST}}
dualstack: {{$DUALSTACK}}
CpuRequest: {{$latencyPodCpu}}m
MemoryRequest: {{$latencyPodMemory}}M
Group: {{$groupName}}
Expand All @@ -108,10 +144,20 @@ steps:
namespaces: {{$namespaces}}
tuningSet: Sequence
operationTimeout: {{$operationTimeout}}
{{if or $CCNP_TEST $CNP_TEST}}
bigDeploymentSize: 0
bigDeploymentsPerNamespace: 0
{{else}}
bigDeploymentSize: {{$BIG_GROUP_SIZE}}
bigDeploymentsPerNamespace: {{$bigDeploymentsPerNamespace}}
{{end}}
smallDeploymentSize: {{$SMALL_GROUP_SIZE}}
smallDeploymentsPerNamespace: {{$smallDeploymentsPerNamespace}}
cnpsPerNamespace: {{$CNPS_PER_NAMESPACE}}
ccnps: {{$CCNPS}}
cnp_test: {{$CNP_TEST}}
ccnp_test: {{$CCNP_TEST}}
dualstack: {{$DUALSTACK}}
CpuRequest: {{$latencyPodCpu}}m
MemoryRequest: {{$latencyPodMemory}}M
Group: {{$groupName}}
Expand All @@ -124,13 +170,18 @@ steps:
namespaces: {{$namespaces}}
tuningSet: DeploymentDeleteQps
operationTimeout: {{$operationTimeout}}
{{if or $CCNP_TEST $CNP_TEST}}
bigDeploymentSize: 0
bigDeploymentsPerNamespace: 0
{{else}}
bigDeploymentSize: {{$BIG_GROUP_SIZE}}
bigDeploymentsPerNamespace: 0
{{end}}
smallDeploymentSize: {{$SMALL_GROUP_SIZE}}
smallDeploymentsPerNamespace: 0
deploymentLabel: restart
Group: {{$groupName}}

{{if $SERVICE_TEST}}
- module:
path: /modules/services.yaml
params:
Expand All @@ -139,6 +190,23 @@ steps:
smallServicesPerNamespace: 0
bigServicesPerNamespace: 0
{{end}}
{{if or $CCNP_TEST $CNP_TEST}}
- module:
path: /modules/ciliumnetworkpolicy.yaml
params:
actionName: "Deleting"
namespaces: {{$namespaces}}
nameOfNs: {{$nameOfNs}}
cnpsPerNamespace: 0

- module:
path: /modules/ciliumclusternetworkpolicy.yaml
params:
actionName: "Deleting"
namespaces: {{$namespaces}}
ccnps: 0
{{end}}
{{end}}

{{if $CILIUM_METRICS_ENABLED}}
- module:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## CCNP module provides a module for creating / deleting CCNPs.

## Input params
{{$actionName := .actionName}}
{{$ccnps := .ccnps}}

steps:
- name: "{{$actionName}} k8s CCNPs"
phases:
- namespaceRange: null
replicasPerNamespace: {{$ccnps}}
tuningSet: Sequence
objectBundle:
- basename: ccnp
objectTemplatePath: ccnp_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## CNP module provides a module for creating / deleting CNPs.

## Input params
{{$actionName := .actionName}}
{{$namespaces := .namespaces}}
{{$cnpsPerNamespace := .cnpsPerNamespace}}
{{$nameOfNs := .nameOfNs}}

steps:
- name: "{{$actionName}} k8s CNPs"
phases:
- namespaceRange:
min: 1
max: {{$namespaces}}
replicasPerNamespace: {{$cnpsPerNamespace}}
tuningSet: Sequence
objectBundle:
- basename: cnp
objectTemplatePath: cnp_template.yaml

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
{{$smallDeploymentSize := .smallDeploymentSize}}
{{$smallDeploymentsPerNamespace := .smallDeploymentsPerNamespace}}

{{$cnpsPerNamespace := .cnpsPerNamespace}}
{{$ccnps := .ccnps}}
{{$cnp_test:= .cnp_test}}
{{$ccnp_test:= .ccnp_test}}
{{$dualstack:= .dualstack}}

steps:
- name: Starting measurement for '{{$actionName}}'
measurements:
Expand Down Expand Up @@ -55,7 +61,13 @@ steps:
objectTemplatePath: deployment_template.yaml
templateFillMap:
Replicas: {{$smallDeploymentSize}}
{{if or $cnp_test $ccnp_test}}
cnp_test: {{$cnp_test}}
ccnp_test: {{$ccnp_test}}
dualstack: {{$dualstack}}
{{else}}
SvcName: small-service
{{end}}
Group: {{.Group}}
deploymentLabel: {{.deploymentLabel}}

Expand Down
Loading

0 comments on commit 43d8920

Please sign in to comment.