k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/testing/load/modules/reconcile-objects.yaml (about)

     1  ## Input params
     2  # Valid actions: "create", "scale and update", "delete"
     3  {{$actionName := printf "%s objects" .actionName}}
     4  {{$namespaces := .namespaces}}
     5  {{$tuningSet := .tuningSet}}
     6  
     7  # Derivative variables
     8  {{$is_deleting := (eq .actionName "delete")}}
     9  {{$randomScaleFactor := DefaultParam .randomScaleFactor 0}}
    10  {{$minReplicaFactor := SubtractFloat 1 $randomScaleFactor}}
    11  {{$maxReplicaFactor := AddFloat 1 $randomScaleFactor}}
    12  {{$testMaxReplicaFactor := AddFloat 1 .testMaxReplicaFactor}}
    13  {{$operationTimeout := .operationTimeout}}
    14  
    15  # DaemonSets
    16  {{$daemonSetImage := DefaultParam .daemonSetImage "registry.k8s.io/pause:3.9"}}
    17  {{$daemonSetReplicas := .daemonSetReplicas}}
    18  {{$daemonSetEnv := .daemonSetEnv}}
    19  
    20  # Deployments
    21  {{$bigDeploymentSize := .bigDeploymentSize}}
    22  {{$bigDeploymentsPerNamespace := .bigDeploymentsPerNamespace}}
    23  {{$mediumDeploymentSize := .mediumDeploymentSize}}
    24  {{$mediumDeploymentsPerNamespace := .mediumDeploymentsPerNamespace}}
    25  {{$smallDeploymentSize := .smallDeploymentSize}}
    26  {{$smallDeploymentsPerNamespace := .smallDeploymentsPerNamespace}}
    27  
    28  # StatefulSets
    29  {{$smallStatefulSetSize := .smallStatefulSetSize}}
    30  {{$smallStatefulSetsPerNamespace := .smallStatefulSetsPerNamespace}}
    31  {{$mediumStatefulSetSize := .mediumStatefulSetSize}}
    32  {{$mediumStatefulSetsPerNamespace := .mediumStatefulSetsPerNamespace}}
    33  
    34  # Jobs
    35  {{$bigJobSize := .bigJobSize}}
    36  {{$bigJobsPerNamespace := .bigJobsPerNamespace}}
    37  {{$mediumJobSize := .mediumJobSize}}
    38  {{$mediumJobsPerNamespace := .mediumJobsPerNamespace}}
    39  {{$smallJobSize := .smallJobSize}}
    40  {{$smallJobsPerNamespace := .smallJobsPerNamespace}}
    41  {{$completionsFactor := MultiplyFloat 2 $testMaxReplicaFactor}}
    42  
    43  # PV
    44  {{$pvSmallStatefulSetSize := DefaultParam .pvSmallStatefulSetSize 0}}
    45  {{$pvMediumStatefulSetSize := DefaultParam .pvMediumStatefulSetSize 0}}
    46  
    47  ## CL2 params
    48  {{$CHECK_IF_PODS_ARE_UPDATED := DefaultParam .CL2_CHECK_IF_PODS_ARE_UPDATED true}}
    49  {{$DISABLE_DAEMONSETS := DefaultParam .CL2_DISABLE_DAEMONSETS false}}
    50  {{$ENABLE_DNSTESTS := DefaultParam .CL2_ENABLE_DNSTESTS false}}
    51  {{$ENABLE_NETWORKPOLICIES := DefaultParam .CL2_ENABLE_NETWORKPOLICIES false}}
    52  {{$ENABLE_PVS := DefaultParam .CL2_ENABLE_PVS true}}
    53  {{$ENABLE_NETWORK_POLICY_ENFORCEMENT_LATENCY_TEST := DefaultParam .CL2_ENABLE_NETWORK_POLICY_ENFORCEMENT_LATENCY_TEST false}}
    54  {{$NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_KEY := DefaultParam .CL2_NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_KEY "net-pol-test"}}
    55  {{$NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_VALUE := DefaultParam .CL2_NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_VALUE "enforcement-latency"}}
    56  {{$NET_POLICY_SERVER_EVERY_NTH_POD := DefaultParam .CL2_NET_POLICY_SERVER_EVERY_NTH_POD 3}}
    57  
    58  steps:
    59  - name: Starting measurement for '{{$actionName}}'
    60    measurements:
    61    - Method: WaitForControlledPodsRunning
    62      Instances:
    63      - Identifier: WaitForRunningDeployments
    64        Params:
    65          apiVersion: apps/v1
    66          kind: Deployment
    67      - Identifier: WaitForRunningStatefulSets
    68        Params:
    69          apiVersion: apps/v1
    70          kind: StatefulSet
    71      - Identifier: WaitForRunningDaemonSets
    72        Params:
    73          apiVersion: apps/v1
    74          kind: DaemonSet
    75      - Identifier: WaitForRunningJobs
    76        Params:
    77          apiVersion: batch/v1
    78          kind: Job
    79      Params:
    80        action: start
    81        checkIfPodsAreUpdated: {{$CHECK_IF_PODS_ARE_UPDATED}}
    82        labelSelector: group = load
    83        operationTimeout: {{$operationTimeout}}
    84  
    85  - name: {{$actionName}}
    86    phases:
    87  {{if not $DISABLE_DAEMONSETS}}
    88    - namespaceRange:
    89        min: 1
    90        max: 1
    91      replicasPerNamespace: {{$daemonSetReplicas}}
    92      tuningSet: {{$tuningSet}}
    93      objectBundle:
    94      - basename: daemonset
    95        objectTemplatePath: daemonset.yaml
    96        templateFillMap:
    97          Image: {{$daemonSetImage}}
    98          Env: {{$daemonSetEnv}}
    99  {{end}}
   100    - namespaceRange:
   101        min: 1
   102        max: {{$namespaces}}
   103      replicasPerNamespace: {{$bigDeploymentsPerNamespace}}
   104      tuningSet: {{$tuningSet}}
   105      objectBundle:
   106  {{if $ENABLE_NETWORKPOLICIES}}
   107      - basename: big-deployment
   108        objectTemplatePath: networkpolicy.yaml
   109  {{end}}
   110      - basename: big-deployment
   111        objectTemplatePath: deployment.yaml
   112        templateFillMap:
   113          # DNS Test clients are enabled only in the medium-size deployment.
   114          EnableDNSTests: false
   115          ReplicasMin: {{MultiplyInt $bigDeploymentSize $minReplicaFactor}}
   116          ReplicasMax: {{MultiplyInt $bigDeploymentSize $maxReplicaFactor}}
   117          SvcName: big-service
   118    - namespaceRange:
   119        min: 1
   120        max: {{$namespaces}}
   121      replicasPerNamespace: {{$mediumDeploymentsPerNamespace}}
   122      tuningSet: {{$tuningSet}}
   123      objectBundle:
   124  {{if $ENABLE_NETWORKPOLICIES}}
   125      - basename: medium-deployment
   126        objectTemplatePath: networkpolicy.yaml
   127  {{end}}
   128      - basename: medium-deployment
   129        objectTemplatePath: deployment.yaml
   130        templateFillMap:
   131          EnableDNSTests: {{$ENABLE_DNSTESTS}}
   132          ReplicasMin: {{MultiplyInt $mediumDeploymentSize $minReplicaFactor}}
   133          ReplicasMax: {{MultiplyInt $mediumDeploymentSize $maxReplicaFactor}}
   134          SvcName: medium-service
   135    - namespaceRange:
   136        min: 1
   137        max: {{$namespaces}}
   138      replicasPerNamespace: {{$smallDeploymentsPerNamespace}}
   139      tuningSet: {{$tuningSet}}
   140      objectBundle:
   141  {{if $ENABLE_NETWORKPOLICIES}}
   142      - basename: small-deployment
   143        objectTemplatePath: networkpolicy.yaml
   144  {{end}}
   145      - basename: small-deployment
   146        objectTemplatePath: deployment.yaml
   147        templateFillMap:
   148          # DNS Test clients are enabled only in the medium-size deployment.
   149          EnableDNSTests: false
   150          ReplicasMin: {{MultiplyInt $smallDeploymentSize $minReplicaFactor}}
   151          ReplicasMax: {{MultiplyInt $smallDeploymentSize $maxReplicaFactor}}
   152          SvcName: small-service
   153          EnableNetworkPolicyEnforcementLatencyTest: {{$ENABLE_NETWORK_POLICY_ENFORCEMENT_LATENCY_TEST}}
   154          TargetLabelKey: {{$NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_KEY}}
   155          TargetLabelValue: {{$NET_POLICY_ENFORCEMENT_LATENCY_TARGET_LABEL_VALUE}}
   156          NetPolServerOnEveryNthPod: {{$NET_POLICY_SERVER_EVERY_NTH_POD}}
   157    - namespaceRange:
   158        min: 1
   159        max: {{$namespaces}}
   160      replicasPerNamespace: {{$smallStatefulSetsPerNamespace}}
   161      tuningSet: {{$tuningSet}}
   162      objectBundle:
   163      - basename: small-statefulset
   164        objectTemplatePath: statefulset_service.yaml
   165      - basename: small-statefulset
   166        objectTemplatePath: statefulset.yaml
   167        templateFillMap:
   168          ReplicasMin: {{MultiplyInt $smallStatefulSetSize $minReplicaFactor}}
   169          ReplicasMax: {{MultiplyInt $smallStatefulSetSize $maxReplicaFactor}}
   170    - namespaceRange:
   171        min: 1
   172        max: {{$namespaces}}
   173      replicasPerNamespace: {{$mediumStatefulSetsPerNamespace}}
   174      tuningSet: {{$tuningSet}}
   175      objectBundle:
   176      - basename: medium-statefulset
   177        objectTemplatePath: statefulset_service.yaml
   178      - basename: medium-statefulset
   179        objectTemplatePath: statefulset.yaml
   180        templateFillMap:
   181          ReplicasMin: {{MultiplyInt $mediumStatefulSetSize $minReplicaFactor}}
   182          ReplicasMax: {{MultiplyInt $mediumStatefulSetSize $maxReplicaFactor}}
   183    - namespaceRange:
   184        min: 1
   185        max: {{$namespaces}}
   186      replicasPerNamespace: {{$smallJobsPerNamespace}}
   187      tuningSet: {{$tuningSet}}
   188      objectBundle:
   189      - basename: small-job
   190        objectTemplatePath: job.yaml
   191        templateFillMap:
   192          Completions: {{MultiplyInt $smallJobSize $completionsFactor}}
   193          ReplicasMin: {{MultiplyInt $smallJobSize $minReplicaFactor}}
   194          ReplicasMax: {{MultiplyInt $smallJobSize $maxReplicaFactor}}
   195    - namespaceRange:
   196        min: 1
   197        max: {{$namespaces}}
   198      replicasPerNamespace: {{$mediumJobsPerNamespace}}
   199      tuningSet: {{$tuningSet}}
   200      objectBundle:
   201      - basename: medium-job
   202        objectTemplatePath: job.yaml
   203        templateFillMap:
   204          Completions: {{MultiplyInt $mediumJobSize $completionsFactor}}
   205          ReplicasMin: {{MultiplyInt $mediumJobSize $minReplicaFactor}}
   206          ReplicasMax: {{MultiplyInt $mediumJobSize $maxReplicaFactor}}
   207    - namespaceRange:
   208        min: 1
   209        max: {{$namespaces}}
   210      replicasPerNamespace: {{$bigJobsPerNamespace}}
   211      tuningSet: {{$tuningSet}}
   212      objectBundle:
   213      - basename: big-job
   214        objectTemplatePath: job.yaml
   215        templateFillMap:
   216          Completions: {{MultiplyInt $bigJobSize $completionsFactor}}
   217          ReplicasMin: {{MultiplyInt $bigJobSize $minReplicaFactor}}
   218          ReplicasMax: {{MultiplyInt $bigJobSize $maxReplicaFactor}}
   219  {{if and $is_deleting $ENABLE_PVS}}
   220    - namespaceRange:
   221        min: 1
   222        max: {{$namespaces}}
   223      replicasPerNamespace: 0
   224      tuningSet: {{$tuningSet}}
   225      objectBundle:
   226    {{range $ssIndex := Loop $pvSmallStatefulSetSize}}
   227        - basename: pv-small-statefulset-{{$ssIndex}}
   228          objectTemplatePath: pvc.yaml
   229          listUnknownObjectOptions:
   230            labelSelector:
   231              matchLabels:
   232                name: small-statefulset-{{$ssIndex}}
   233    {{end}}
   234    - namespaceRange:
   235        min: 1
   236        max: {{$namespaces}}
   237      replicasPerNamespace: 0
   238      tuningSet: {{$tuningSet}}
   239      objectBundle:
   240    {{range $ssIndex := Loop $pvMediumStatefulSetSize}}
   241        - basename: pv-medium-statefulset-{{$ssIndex}}
   242          objectTemplatePath: pvc.yaml
   243          listUnknownObjectOptions:
   244            labelSelector:
   245              matchLabels:
   246                name: medium-statefulset-{{$ssIndex}}
   247    {{end}}
   248  {{end}}
   249  
   250  - name: Waiting for '{{$actionName}}' to be completed
   251    measurements:
   252    - Method: WaitForControlledPodsRunning
   253      Instances:
   254      - Identifier: WaitForRunningDeployments
   255      - Identifier: WaitForRunningStatefulSets
   256      - Identifier: WaitForRunningDaemonSets
   257      - Identifier: WaitForRunningJobs
   258      Params:
   259        action: gather
   260  {{if and $is_deleting $ENABLE_PVS}}
   261    - Identifier: WaitForPVCsToBeDeleted
   262      Method: WaitForBoundPVCs
   263      Params:
   264        desiredPVCCount: 0
   265        labelSelector: group = load
   266        timeout: {{$operationTimeout}}
   267  {{end}}