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

     1  {{$HostNetworkMode := DefaultParam .CL2_USE_HOST_NETWORK_PODS false}}
     2  # Keep the CpuRequest/MemoryRequest request equal percentage of 1-core, 4GB node.
     3  # For now we're setting it to 0.5%.
     4  {{$CpuRequest := DefaultParam .CpuRequest "5m"}}
     5  {{$MemoryRequest := DefaultParam .MemoryRequest "20M"}}
     6  {{$dnsQPSPerClient := DefaultParam .CL2_DNS_QPS_PER_CLIENT 1}}
     7  # Guard the new DNS tests. Remove it once it's confirmed that it works on a subset of tests.
     8  {{$USE_ADVANCED_DNSTEST := DefaultParam .CL2_USE_ADVANCED_DNSTEST false}}
     9  {{$RUN_ON_ARM_NODES := DefaultParam .CL2_RUN_ON_ARM_NODES false}}
    10  
    11  {{$EnableNetworkPolicyEnforcementLatencyTest := DefaultParam .EnableNetworkPolicyEnforcementLatencyTest false}}
    12  {{$TargetLabelValue := DefaultParam .TargetLabelValue "enforcement-latency"}}
    13  # Run a server pod for network policy enforcement latency test only on every Nth pod.
    14  # Default every third pod.
    15  {{$NetPolServerOnEveryNthPod := DefaultParam .NetPolServerOnEveryNthPod 3}}
    16  {{$RunNetPolicyTest := and $EnableNetworkPolicyEnforcementLatencyTest (eq (Mod .Index $NetPolServerOnEveryNthPod) 0)}}
    17  
    18  apiVersion: apps/v1
    19  kind: Deployment
    20  metadata:
    21    name: {{.Name}}
    22    labels:
    23      group: load
    24      svc: {{.SvcName}}-{{.Index}}
    25  spec:
    26    replicas: {{RandIntRange .ReplicasMin .ReplicasMax}}
    27    selector:
    28      matchLabels:
    29        name: {{.Name}}
    30    template:
    31      metadata:
    32        labels:
    33          group: load
    34          name: {{.Name}}
    35          svc: {{.SvcName}}-{{.Index}}
    36  {{if and .EnableDNSTests $USE_ADVANCED_DNSTEST}}
    37          dns-test: dnsperfgo
    38  {{else}}
    39    {{if $RunNetPolicyTest}}
    40          net-pol-test: {{$TargetLabelValue}}
    41    {{end}}
    42  {{end}}
    43      spec:
    44        hostNetwork: {{$HostNetworkMode}}
    45        containers:
    46  {{if .EnableDNSTests}}
    47  {{if $USE_ADVANCED_DNSTEST}}
    48        - image: gcr.io/k8s-staging-perf-tests/dnsperfgo:v1.4.0
    49          ports:
    50          - containerPort: 9153
    51            name: dnsperfmetrics
    52            protocol: TCP
    53    {{else}}
    54        - image: gcr.io/k8s-staging-perf-tests/dnsperfgo:v1.2.0
    55    {{end}}
    56        # Fetches the dns server from /etc/resolv.conf and
    57        # sends 1 query per second.
    58        # With searchpath expansion, this is upto 12 queries per second.
    59        # dnsperfgo has a default client timeout of 5s. It sends queries for 60s,
    60        # then sleeps for 10s, to mimic bursts of DNS queries.
    61          command:
    62          - sh
    63          - -c
    64          - server=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2); echo
    65            "Using nameserver ${server}";
    66            ./dnsperfgo -duration 60s -idle-duration 10s -inputfile /var/configmap/all-queries -qps {{$dnsQPSPerClient}};
    67          name: {{.Name}}-dnsperf
    68  {{else}}
    69    {{if $RunNetPolicyTest}}
    70        - image: nginx
    71          name: nginx-server
    72          ports:
    73          - containerPort: 80
    74    {{else}}
    75        - image: registry.k8s.io/pause:3.9
    76          name: {{.Name}}
    77    {{end}}
    78  {{end}}
    79          resources:
    80            requests:
    81              cpu: {{$CpuRequest}}
    82              memory: {{$MemoryRequest}}
    83          volumeMounts:
    84            - name: configmap
    85              mountPath: /var/configmap
    86            - name: secret
    87              mountPath: /var/secret
    88        terminationGracePeriodSeconds: 1
    89        # Add not-ready/unreachable tolerations for 15 minutes so that node
    90        # failure doesn't trigger pod deletion.
    91        tolerations:
    92        - key: "node.kubernetes.io/not-ready"
    93          operator: "Exists"
    94          effect: "NoExecute"
    95          tolerationSeconds: 900
    96        - key: "node.kubernetes.io/unreachable"
    97          operator: "Exists"
    98          effect: "NoExecute"
    99          tolerationSeconds: 900
   100        {{if $RUN_ON_ARM_NODES}}
   101        - key: "kubernetes.io/arch"
   102          operator: Equal
   103          value: arm64
   104          effect: NoSchedule
   105        {{end}}
   106        volumes:
   107          - name: configmap
   108            configMap:
   109              name: {{.BaseName}}-{{.Index}}
   110          - name: secret
   111            secret:
   112              secretName: {{.BaseName}}-{{.Index}}