From 1631d7e1411e4ddf1d9660be78e2a3ad199a1634 Mon Sep 17 00:00:00 2001 From: Thiago Nobayashi Date: Mon, 15 Apr 2024 12:24:17 -0300 Subject: [PATCH] chore: use Job object to control cert-spammer (#17) --- charts/cert-spammer/Chart.yaml | 2 +- .../templates/00-cert-spammer-deployment.yaml | 52 +++++++++++-------- charts/cert-spammer/values.yaml | 2 + 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/charts/cert-spammer/Chart.yaml b/charts/cert-spammer/Chart.yaml index 254ef40..818f35a 100644 --- a/charts/cert-spammer/Chart.yaml +++ b/charts/cert-spammer/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.1 +version: 0.3.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/cert-spammer/templates/00-cert-spammer-deployment.yaml b/charts/cert-spammer/templates/00-cert-spammer-deployment.yaml index 637b2b4..ca1938e 100644 --- a/charts/cert-spammer/templates/00-cert-spammer-deployment.yaml +++ b/charts/cert-spammer/templates/00-cert-spammer-deployment.yaml @@ -3,32 +3,38 @@ {{- $name := $.Values.env.TOPOS_RUN_ID | required "$.Values.env.TOPOS_RUN_ID is required." -}} {{- $name := $.Values.env.TOPOS_RUN_NUMBER | required "$.Values.env.TOPOS_RUN_NUMBER is required." -}} -apiVersion: v1 -kind: Pod +apiVersion: batch/v1 +kind: Job metadata: name: cert-spammer labels: app: cert-spammer spec: + completions: {{ $.Values.replicas }} + parallelism: {{ $.Values.replicas }} + completionMode: Indexed restartPolicy: Never - containers: - - name: topos - image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" - imagePullPolicy: Always - command: ["topos"] - args: ["regtest", "spam", "--benchmark", "--target-hosts", "{{ $.Values.validator.target }}", "--number", "{{ $.Values.validator.replicas }}"] - env: - - name: RUST_LOG - value: info - - name: TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL - value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL }}" - - name: TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS - value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS }}" - - name: TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH - value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH }}" - - name: TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES - value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES }}" - - name: TOPOS_RUN_ID - value: "{{ $.Values.env.TOPOS_RUN_ID }}" - - name: TOPOS_RUN_NUMBER - value: "{{ $.Values.env.TOPOS_RUN_NUMBER }}" + template: + spec: + restartPolicy: Never # required for the feature + containers: + - name: topos + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" + imagePullPolicy: Always + command: ["topos"] + args: ["regtest", "spam", "--benchmark", "--target-hosts", "{{ $.Values.validator.target }}", "--number", "{{ $.Values.validator.replicas }}"] + env: + - name: RUST_LOG + value: info + - name: TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL + value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL }}" + - name: TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS + value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS }}" + - name: TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH + value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH }}" + - name: TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES + value: "{{ $.Values.env.TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES }}" + - name: TOPOS_RUN_ID + value: "{{ $.Values.env.TOPOS_RUN_ID }}" + - name: TOPOS_RUN_NUMBER + value: "{{ $.Values.env.TOPOS_RUN_NUMBER }}" diff --git a/charts/cert-spammer/values.yaml b/charts/cert-spammer/values.yaml index 45414b3..016812a 100644 --- a/charts/cert-spammer/values.yaml +++ b/charts/cert-spammer/values.yaml @@ -1,6 +1,8 @@ # Default values for tce-all-in-one. # This is a YAML-formatted file. # Declare variables to be passed into your templates. +replicas: 1 + image: repository: nobody tag: main